-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul cleaners plugin; Add Maps::isPlantInBox #4949
base: develop
Are you sure you want to change the base?
Conversation
* Cuboid selections * Lua argparse * Allow remove grass, skip blood removal * Better track affected blocks (arrow debris) * Debug logging
command_result spotclean(color_ostream &out, vector<string> ¶meters) | ||
{ // Hotkey command, already suspended | ||
DEBUG(log, out).print("Doing spotclean.\n"); | ||
if (!Maps::IsValid()) | ||
{ | ||
out.printerr("Map is not available.\n"); | ||
return CR_FAILURE; | ||
} | ||
df::map_block *block = Maps::getTileBlock(cursor->x, cursor->y, cursor->z); | ||
if (block == NULL) | ||
auto pos = Gui::getCursorPos(); | ||
if (!pos.isValid()) | ||
{ | ||
out.printerr("The keyboard cursor is not active.\n"); | ||
return CR_WRONG_USAGE; | ||
} | ||
auto block = Maps::getTileBlock(pos); | ||
if (!block) | ||
{ | ||
out.printerr("Invalid map block selected!\n"); | ||
return CR_FAILURE; | ||
} | ||
clean_options options; | ||
options.mud = true; | ||
options.snow = true; | ||
|
||
for (auto evt : block->block_events) | ||
{ | ||
if (evt->getType() != block_square_event_type::material_spatter) | ||
continue; | ||
// type verified - recast to subclass | ||
df::block_square_event_material_spatterst *spatter = (df::block_square_event_material_spatterst *)evt; | ||
clean_mud_safely(spatter, block->map_pos, df::coord(cursor->x % 16, cursor->y % 16, 0)); | ||
} | ||
clean_block(out, block, cuboid(pos), options); | ||
return CR_OK; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make spotclean
an alias for clean here -mds
or possibly clean here -ads
? (Should it include item spatter? A full command can be used if you want to avoid cleaning tree fruit.)
I also don't think we can assume core is suspended unless invoking it from the terminal ensures that. Using an alias would fix that issue either way.
Need to properly document syntax changes and |
* Update cleaners.rst * Update regrass.rst
* Update regrass.rst * Update cleaners.rst
Overhaul
cleaners
to use cuboid selection instead of operating on entire map only. Can now remove grass (or just unused grass events for performance), skip cleaning blood/vomit/ooze when performing other cleanings, and counts arrow debris removal as affecting block.Now uses argparse, which will affect existing command syntax. Spotclean now just calls the existing map cleaning fn with a 1x1x1 cuboid. It could probably be replaced by an alias, assuming those work with hotkeys.
Removed
clean plants
option, as this was just rainwater (which evaporates and will be reapplied when it rains).Moved a
plant
plugin utility fn out toMaps::isPlantInBox
because it was going to be used for plant contaminant removal. This will detect if trees intersect with a box, so someone might have use for it.Made
burrows.cpp
useMaps::forCoord
instead of a nested x,y,z iterator.Made
tile-material.lua
usemaps.getPlantAtTile
and handle tree root material properly.