summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs9
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 73b9376d..27786e18 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -24,6 +24,7 @@
* For modders:
* Added asset propagation for `Data\Concessions`.
* Added SMAPI version and bitness to the console title before startup to simplify troubleshooting.
+ * Added support for [ignoring local map tilesheet files when loading a map](https://stardewvalleywiki.com/Modding:Maps#Local_copy_of_a_vanilla_tilesheet).
* If a map loads a tilesheet path with no file extension, SMAPI now automatically links it to a `.png` version in the map folder if possible.
* Improved error-handling during asset propagation.
* Fixed `Context.IsMainPlayer` returning true for a farmhand in split-screen mode before the screen is initialized.
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index 0cd431e8..f32e3be6 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -317,6 +317,15 @@ namespace StardewModdingAPI.Framework.ContentManagers
return true;
}
+ // special case: local filenames starting with a dot should be ignored
+ // For example, this lets mod authors have a '.spring_town.png' file in their map folder so it can be
+ // opened in Tiled, while still mapping it to the vanilla 'Maps/spring_town' asset at runtime.
+ {
+ string filename = Path.GetFileName(relativePath);
+ if (filename.StartsWith("."))
+ relativePath = Path.Combine(Path.GetDirectoryName(relativePath) ?? "", filename.TrimStart('.'));
+ }
+
// get relative to map file
{
string localKey = Path.Combine(modRelativeMapFolder, relativePath);