From 1870336f4c175b067690fdd6c390ae74bed984b7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Dec 2020 22:35:01 -0500 Subject: update for item changes --- src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands') diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index d1dd758b..34149209 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -107,12 +107,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework // furniture foreach (int id in this.TryLoad("Data\\Furniture").Keys) - { - if (id == 1466 || id == 1468 || id == 1680) - yield return this.TryCreate(ItemType.Furniture, id, p => new TV(p.ID, Vector2.Zero)); - else - yield return this.TryCreate(ItemType.Furniture, id, p => new Furniture(p.ID, Vector2.Zero)); - } + yield return this.TryCreate(ItemType.Furniture, id, p => Furniture.GetFurnitureInstance(p.ID)); // craftables foreach (int id in Game1.bigCraftablesInformation.Keys) -- cgit From fb244dc936b8929dc032ad326f8cad0c9fc80d92 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Dec 2020 22:35:01 -0500 Subject: update for location furniture changes --- docs/release-notes.md | 3 +++ .../Framework/Commands/World/ClearCommand.cs | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands') diff --git a/docs/release-notes.md b/docs/release-notes.md index 176961d4..2c3720e8 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -15,6 +15,9 @@ * Added `PerScreen` utility and new `Context` fields to simplify split-screen support in mods. * Added screen ID to log when playing in split-screen mode. +* For the Console Commands mod: + * Added `furniture` option to `world_clear`. + ## 3.7.6 Released 21 November 2020 for Stardew Valley 1.4.1 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 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 *********/ /// The valid types that can be cleared. - private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "grass", "trees", "everything" }; + private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "furniture", "grass", "trees", "everything" }; /// The resource clump IDs to consider debris. 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 \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++; } } -- cgit