add crops to world_clear

This commit is contained in:
Jesse Plamondon-Willard 2019-03-17 19:42:49 -04:00
parent 552886a0f3
commit 2a976f7236
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
2 changed files with 13 additions and 3 deletions

View File

@ -5,7 +5,8 @@ These changes have not been released yet.
* For players: * For players:
* Updated game version check for the upcoming Stardew Valley 1.4. * Updated game version check for the upcoming Stardew Valley 1.4.
* Updated compatibility list. * Updated compatibility list.
* Fixed `world_clear debris` console command removing chests edited to have a debris name. * Added crops option to `world_clear` console command.
* Fixed `world_clear` console command removing chests edited to have a debris name.
* For the web UI: * For the web UI:
* The log parser now hides some messages by default, like the mod list. * The log parser now hides some messages by default, like the mod list.

View File

@ -16,7 +16,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
** Fields ** Fields
*********/ *********/
/// <summary>The valid types that can be cleared.</summary> /// <summary>The valid types that can be cleared.</summary>
private readonly string[] ValidTypes = { "debris", "fruit-trees", "grass", "trees", "everything" }; private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "grass", "trees", "everything" };
/// <summary>The resource clump IDs to consider debris.</summary> /// <summary>The resource clump IDs to consider debris.</summary>
private readonly int[] DebrisClumps = { ResourceClump.stumpIndex, ResourceClump.hollowLogIndex, ResourceClump.meteoriteIndex, ResourceClump.boulderIndex }; 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" description: "Clears in-game entities in a given location.\n\n"
+ "Usage: world_clear <location> <object type>\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" + "- 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 '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), 'grass', and 'trees' / 'fruit-trees'. You can also specify 'everything', which includes things not removed by the other types (like furniture or resource clumps)."
) )
{ } { }
@ -69,6 +69,15 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
// apply // apply
switch (type) switch (type)
{ {
case "crops":
{
int removed =
this.RemoveTerrainFeatures(location, p => p is HoeDirt)
+ this.RemoveResourceClumps(location, p => p is GiantCrop);
monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
break;
}
case "debris": case "debris":
{ {
int removed = 0; int removed = 0;