update resource clump logic for SDV 1.5 (#770)
This commit is contained in:
parent
c48f6d78cc
commit
0d5b4e9983
|
@ -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).
|
* 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
|
## 3.9.5
|
||||||
Released 21 March 2021 for Stardew Valley 1.5.4 or later.
|
Released 21 March 2021 for Stardew Valley 1.5.4 or later.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Locations;
|
using StardewValley.Locations;
|
||||||
|
@ -224,18 +223,17 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
|
||||||
{
|
{
|
||||||
int removed = 0;
|
int removed = 0;
|
||||||
|
|
||||||
// get resource clumps
|
foreach (var clump in location.resourceClumps.Where(shouldRemove).ToArray())
|
||||||
IList<ResourceClump> resourceClumps =
|
|
||||||
(location as Farm)?.resourceClumps
|
|
||||||
?? (IList<ResourceClump>)(location as Woods)?.stumps
|
|
||||||
?? new List<ResourceClump>();
|
|
||||||
|
|
||||||
// remove matching clumps
|
|
||||||
foreach (var clump in resourceClumps.ToArray())
|
|
||||||
{
|
{
|
||||||
if (shouldRemove(clump))
|
location.resourceClumps.Remove(clump);
|
||||||
|
removed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location is Woods woods)
|
||||||
|
{
|
||||||
|
foreach (ResourceClump clump in woods.stumps.Where(shouldRemove).ToArray())
|
||||||
{
|
{
|
||||||
resourceClumps.Remove(clump);
|
woods.stumps.Remove(clump);
|
||||||
removed++;
|
removed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue