summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-03-17 21:55:38 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-03-17 21:55:38 -0400
commit013255d89e1a802e05f9fd61a16701ca73fa4411 (patch)
tree684714b18faba6d4413a106f885bcba18a2e5edb /src/SMAPI.Mods.ConsoleCommands
parent10c7192bb9f06ff96b9b98a812d9f72a8d77ac76 (diff)
parent4a494c67bdfe2c07ef5c49c55541a0f6e29627cf (diff)
downloadSMAPI-013255d89e1a802e05f9fd61a16701ca73fa4411.tar.gz
SMAPI-013255d89e1a802e05f9fd61a16701ca73fa4411.tar.bz2
SMAPI-013255d89e1a802e05f9fd61a16701ca73fa4411.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs22
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/manifest.json4
2 files changed, 21 insertions, 5 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
index c769b622..e9545575 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 = { "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>
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 '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
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":
{
int removed = 0;
@@ -83,7 +92,14 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
}
removed +=
- this.RemoveObjects(location, obj => obj.Name.ToLower().Contains("weed") || obj.Name == "Twig" || obj.Name == "Stone")
+ this.RemoveObjects(location, obj =>
+ !(obj is Chest)
+ && (
+ obj.Name == "Weeds"
+ || obj.Name == "Stone"
+ || (obj.ParentSheetIndex == 294 || obj.ParentSheetIndex == 295)
+ )
+ )
+ this.RemoveResourceClumps(location, clump => this.DebrisClumps.Contains(clump.parentSheetIndex.Value));
monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json
index afefd733..1c4ea7d8 100644
--- a/src/SMAPI.Mods.ConsoleCommands/manifest.json
+++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
- "Version": "2.11.0",
+ "Version": "2.11.1",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
- "MinimumApiVersion": "2.11.0"
+ "MinimumApiVersion": "2.11.1"
}