summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-08 11:31:20 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-08 11:31:20 -0500
commit194b96a79c335fa098a6cf55c2be75c7f2e9c6ad (patch)
treeb573d1141a3996104f257bd19cf528b9783be8aa /src/SMAPI
parent04b9a810dde93ff790e356f0af3510c7d20bebfc (diff)
downloadSMAPI-194b96a79c335fa098a6cf55c2be75c7f2e9c6ad.tar.gz
SMAPI-194b96a79c335fa098a6cf55c2be75c7f2e9c6ad.tar.bz2
SMAPI-194b96a79c335fa098a6cf55c2be75c7f2e9c6ad.zip
use GetLocations logic more consistently in asset propagation
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs
index 985e4e1b..8b00d893 100644
--- a/src/SMAPI/Metadata/CoreAssetPropagator.cs
+++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs
@@ -611,7 +611,7 @@ namespace StardewModdingAPI.Metadata
{
// get buildings
string type = Path.GetFileName(key);
- Building[] buildings = Game1.locations
+ Building[] buildings = this.GetLocations(buildingInteriors: false)
.OfType<BuildableGameLocation>()
.SelectMany(p => p.buildings)
.Where(p => p.buildingType.Value == type)
@@ -706,7 +706,7 @@ namespace StardewModdingAPI.Metadata
{
Grass[] grasses =
(
- from location in Game1.locations
+ from location in this.GetLocations()
from grass in location.terrainFeatures.Values.OfType<Grass>()
let textureName = this.NormalizeAssetNameIgnoringEmpty(
this.Reflection.GetMethod(grass, "textureName").Invoke<string>()
@@ -804,7 +804,7 @@ namespace StardewModdingAPI.Metadata
/// <returns>Returns whether any textures were reloaded.</returns>
private bool ReloadTreeTextures(LocalizedContentManager content, string key, int type)
{
- Tree[] trees = Game1.locations
+ Tree[] trees = this.GetLocations()
.SelectMany(p => p.terrainFeatures.Values.OfType<Tree>())
.Where(tree => tree.treeType.Value == type)
.ToArray();
@@ -909,7 +909,8 @@ namespace StardewModdingAPI.Metadata
}
/// <summary>Get all locations in the game.</summary>
- private IEnumerable<GameLocation> GetLocations()
+ /// <param name="buildingInteriors">Whether to also get the interior locations for constructable buildings.</param>
+ private IEnumerable<GameLocation> GetLocations(bool buildingInteriors = true)
{
// get available root locations
IEnumerable<GameLocation> rootLocations = Game1.locations;
@@ -921,7 +922,7 @@ namespace StardewModdingAPI.Metadata
{
yield return location;
- if (location is BuildableGameLocation buildableLocation)
+ if (buildingInteriors && location is BuildableGameLocation buildableLocation)
{
foreach (Building building in buildableLocation.buildings)
{