summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-20 22:35:58 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-20 22:35:58 -0500
commit77002d3e9965d9afa843a95129c6acb5d1c4a283 (patch)
treeb4f4a338945cd3f2cc5881e46fb0dd2b075a79ce /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World
parent1c70736c00e6e70f46f539cb26b5fd253f4eff3b (diff)
parent5e2f6f565d6ef5330ea2e8c6a5e796f937289255 (diff)
downloadSMAPI-77002d3e9965d9afa843a95129c6acb5d1c4a283.tar.gz
SMAPI-77002d3e9965d9afa843a95129c6acb5d1c4a283.tar.bz2
SMAPI-77002d3e9965d9afa843a95129c6acb5d1c4a283.zip
Merge branch 'stardew-valley-1.5' into develop
# Conflicts: # docs/release-notes.md
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
index 1190a4ab..29052be3 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
@@ -16,7 +16,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
** Fields
*********/
/// <summary>The valid types that can be cleared.</summary>
- private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "grass", "trees", "everything" };
+ private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "furniture", "grass", "trees", "everything" };
/// <summary>The resource clump IDs to consider debris.</summary>
private readonly int[] DebrisClumps = { ResourceClump.stumpIndex, ResourceClump.hollowLogIndex, ResourceClump.meteoriteIndex, ResourceClump.boulderIndex };
@@ -32,7 +32,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
description: "Clears in-game entities in a given location.\n\n"
+ "Usage: world_clear <location> <object type>\n"
+ "- location: the location name for which to clear objects (like Farm), or 'current' for the current location.\n"
- + " - object type: the type of object clear. You can specify 'crops', 'debris' (stones/twigs/weeds and dead crops), 'grass', and 'trees' / 'fruit-trees'. You can also specify 'everything', which includes things not removed by the other types (like furniture or resource clumps)."
+ + " - object type: the type of object clear. You can specify 'crops', 'debris' (stones/twigs/weeds and dead crops), 'furniture', 'grass', and 'trees' / 'fruit-trees'. You can also specify 'everything', which includes things not removed by the other types (like resource clumps)."
)
{ }
@@ -113,6 +113,13 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
break;
}
+ case "furniture":
+ {
+ int removed = this.RemoveFurniture(location, furniture => true);
+ monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
+ break;
+ }
+
case "grass":
{
int removed = this.RemoveTerrainFeatures(location, feature => feature is Grass);
@@ -244,15 +251,12 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- if (location is DecoratableLocation decoratableLocation)
+ foreach (Furniture furniture in location.furniture.ToArray())
{
- foreach (Furniture furniture in decoratableLocation.furniture.ToArray())
+ if (shouldRemove(furniture))
{
- if (shouldRemove(furniture))
- {
- decoratableLocation.furniture.Remove(furniture);
- removed++;
- }
+ location.furniture.Remove(furniture);
+ removed++;
}
}