refactor new code a bit
This commit is contained in:
parent
428f0c5880
commit
e3010f7c41
|
@ -5,7 +5,7 @@
|
||||||
* For players:
|
* For players:
|
||||||
* Added error if the wrong SMAPI bitness is installed (e.g. 32-bit SMAPI with 64-bit game).
|
* Added error if the wrong SMAPI bitness is installed (e.g. 32-bit SMAPI with 64-bit game).
|
||||||
* Added error if some SMAPI files aren't updated correctly.
|
* Added error if some SMAPI files aren't updated correctly.
|
||||||
* Added `removeable` option to `world_clear`
|
* Added `removable` option to the `world_clear` console command (thanks to bladeoflight16!).
|
||||||
* Fixed intermittent error if a mod fetches mod-provided APIs asynchronously.
|
* Fixed intermittent error if a mod fetches mod-provided APIs asynchronously.
|
||||||
|
|
||||||
* For mod authors:
|
* For mod authors:
|
||||||
|
|
|
@ -15,7 +15,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 = { "crops", "debris", "fruit-trees", "furniture", "grass", "trees", "removeable", "everything" };
|
private readonly string[] ValidTypes = { "crops", "debris", "fruit-trees", "furniture", "grass", "trees", "removable", "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 };
|
||||||
|
@ -31,7 +31,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 'crops', 'debris' (stones/twigs/weeds and dead crops), 'furniture', 'grass', and 'trees' / 'fruit-trees'. You can also specify 'removeable', which includes everything that can be removed or destroyed during normal game play, or 'everything', which includes permanent bushes."
|
+ " - 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 'removable' (remove everything that can be removed or destroyed during normal gameplay) or 'everything' (remove everything including permanent bushes)."
|
||||||
)
|
)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -133,25 +133,15 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "removeable":
|
case "removable":
|
||||||
{
|
|
||||||
int removed =
|
|
||||||
this.RemoveFurniture(location, p => true)
|
|
||||||
+ this.RemoveObjects(location, p => true)
|
|
||||||
+ this.RemoveTerrainFeatures(location, p => true)
|
|
||||||
+ this.RemoveLargeTerrainFeatures(location, p => !(p is Bush) || ((Bush)p).isDestroyable(location, p.currentTileLocation))
|
|
||||||
+ this.RemoveResourceClumps(location, p => true);
|
|
||||||
monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "everything":
|
case "everything":
|
||||||
{
|
{
|
||||||
|
bool everything = type == "everything";
|
||||||
int removed =
|
int removed =
|
||||||
this.RemoveFurniture(location, p => true)
|
this.RemoveFurniture(location, p => true)
|
||||||
+ this.RemoveObjects(location, p => true)
|
+ this.RemoveObjects(location, p => true)
|
||||||
+ this.RemoveTerrainFeatures(location, p => true)
|
+ this.RemoveTerrainFeatures(location, p => true)
|
||||||
+ this.RemoveLargeTerrainFeatures(location, p => true)
|
+ this.RemoveLargeTerrainFeatures(location, p => everything || p is not Bush bush || bush.isDestroyable(location, p.currentTileLocation))
|
||||||
+ this.RemoveResourceClumps(location, p => true);
|
+ this.RemoveResourceClumps(location, p => true);
|
||||||
monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
|
monitor.Log($"Done! Removed {removed} entities from {location.Name}.", LogLevel.Info);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=fallbacks/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=fallbacks/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=filenames/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=filenames/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=gamepad/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=gamepad/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=gameplay/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hangfire/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hangfire/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=initializers/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=initializers/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Junimo/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Junimo/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Reference in New Issue