summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md4
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs18
2 files changed, 12 insertions, 10 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index ad644532..3d505b8b 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -7,6 +7,10 @@
* Migrated to Harmony 2.0 (see [_migrate to Harmony 2.0_](https://stardewvalleywiki.com/Modding:Migrate_to_Harmony_2.0) for more info).
-->
+## Upcoming release
+* For players:
+ * Fixed `world_clear` console command not removing resource clumps outside the farm and secret woods.
+
## 3.9.5
Released 21 March 2021 for Stardew Valley 1.5.4 or later.
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
index 4b0e45a0..4cfaf242 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using StardewValley;
using StardewValley.Locations;
@@ -224,18 +223,17 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- // get resource clumps
- IList<ResourceClump> resourceClumps =
- (location as Farm)?.resourceClumps
- ?? (IList<ResourceClump>)(location as Woods)?.stumps
- ?? new List<ResourceClump>();
+ foreach (var clump in location.resourceClumps.Where(shouldRemove).ToArray())
+ {
+ location.resourceClumps.Remove(clump);
+ removed++;
+ }
- // remove matching clumps
- foreach (var clump in resourceClumps.ToArray())
+ if (location is Woods woods)
{
- if (shouldRemove(clump))
+ foreach (ResourceClump clump in woods.stumps.Where(shouldRemove).ToArray())
{
- resourceClumps.Remove(clump);
+ woods.stumps.Remove(clump);
removed++;
}
}