summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-01 00:27:53 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-01 00:27:53 -0500
commitc8191449a00e3db08214e3b1146e17f89f0245c5 (patch)
tree8cbd42ac3585e11d8a05f58e87f652c4c136aec5 /src/SMAPI/Framework
parent125b38c6e62d86115045c2cece6c6c3d1da35600 (diff)
downloadSMAPI-c8191449a00e3db08214e3b1146e17f89f0245c5.tar.gz
SMAPI-c8191449a00e3db08214e3b1146e17f89f0245c5.tar.bz2
SMAPI-c8191449a00e3db08214e3b1146e17f89f0245c5.zip
add support for *.tmx map files
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs1
-rw-r--r--src/SMAPI/Framework/SCore.cs13
2 files changed, 13 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index fdf76b24..0a526fc8 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -154,6 +154,7 @@ namespace StardewModdingAPI.Framework.ContentManagers
// unpacked map
case ".tbin":
+ case ".tmx":
{
// validate
if (typeof(T) != typeof(Map))
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 44c495ff..77c2fab8 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -234,7 +234,7 @@ namespace StardewModdingAPI.Framework
#endif
AppDomain.CurrentDomain.UnhandledException += (sender, e) => this.Monitor.Log($"Critical app domain exception: {e.ExceptionObject}", LogLevel.Error);
- // add more lenient assembly resolvers
+ // add more lenient assembly resolver
AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => AssemblyLoader.ResolveAssembly(e.Name);
// hook locale event
@@ -420,6 +420,17 @@ namespace StardewModdingAPI.Framework
return;
}
+ // init TMX support
+ try
+ {
+ xTile.Format.FormatManager.Instance.RegisterMapFormat(new TMXTile.TMXFormat(Game1.tileSize / Game1.pixelZoom, Game1.tileSize / Game1.pixelZoom, Game1.pixelZoom, Game1.pixelZoom));
+ }
+ catch (Exception ex)
+ {
+ this.Monitor.Log("SMAPI couldn't load TMX support. Some mods may not work correctly.", LogLevel.Warn);
+ this.Monitor.Log($"Technical details: {ex.GetLogSummary()}", LogLevel.Trace);
+ }
+
// load mod data
ModToolkit toolkit = new ModToolkit();
ModDatabase modDatabase = toolkit.GetModDatabase(Constants.ApiMetadataPath);