diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index 4ce596d..b522145 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -26,7 +26,16 @@ namespace stardew_access.Features foreach (var location in data) { - if (locationName.ToLower().Equals(location.Key.ToLower())) + if (location.Key.Contains("||") && MainClass.ModHelper != null) + { + string uniqueModID = location.Key.Substring(location.Key.LastIndexOf("||") + 2); + string locationNameInJson = location.Key.Remove(location.Key.LastIndexOf("||")); + bool isLoaded = MainClass.ModHelper.ModRegistry.IsLoaded(uniqueModID); + + if (!isLoaded) continue; // Skip if the specified mod is not loaded + if (locationName.ToLower().Equals(locationNameInJson.ToLower())) return true; + } + else if (locationName.ToLower().Equals(location.Key.ToLower())) return true; } @@ -45,8 +54,35 @@ namespace stardew_access.Features foreach (var location in data) { - if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower())) - continue; + if (location.Key.Contains("||") && MainClass.ModHelper != null) + { + // Mod Specific Tiles + // We can add tiles that only get detected when the specified mod is loaded. + // Syntax: || + // Example: THe following tile will only be detected if Stardew Valley Expanded mod is installed + // { + // . + // . + // . + // "Town||FlashShifter.StardewValleyExpandedCP":{ + // "":{ + // "x": [], + // "y": [], + // "type": "" + // } + // }, + // . + // . + // . + // } + string uniqueModID = location.Key.Substring(location.Key.LastIndexOf("||") + 2); + string locationName = location.Key.Remove(location.Key.LastIndexOf("||")); + bool isLoaded = MainClass.ModHelper.ModRegistry.IsLoaded(uniqueModID); + + if (!isLoaded) continue; // Skip if the specified mod is not loaded + if (!Game1.currentLocation.Name.ToLower().Equals(locationName.ToLower())) continue; + } + else if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower())) continue; if (location.Value != null) foreach (var tile in ((JObject)location.Value)) diff --git a/stardew-access/assets/static-tiles.json b/stardew-access/assets/static-tiles.json index cbc2549..99789aa 100644 --- a/stardew-access/assets/static-tiles.json +++ b/stardew-access/assets/static-tiles.json @@ -2995,4 +2995,4 @@ "type": "interactable" } } -} +} \ No newline at end of file