diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 7b9c9d2c7..7299da67e 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -54,6 +54,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector "Options:\n" " destroy - instead of dumping, destroy the items instantly.\n" " destroy-here - only affect the tile under cursor.\n" + " visible - only process items that are not hidden.\n" + " hidden - only process hidden items.\n" + " forbidden - only process forbidden items (default: only unforbidden).\n" )); commands.push_back(PluginCommand( "autodump-destroy-here", "Destroy items marked for dumping under cursor.", @@ -82,6 +85,9 @@ static command_result autodump_main(Core * c, vector & parameters) // Command line options bool destroy = false; bool here = false; + bool need_visible = false; + bool need_hidden = false; + bool need_forbidden = false; if(parameters.size() > 0) { string & p = parameters[0]; @@ -89,10 +95,22 @@ static command_result autodump_main(Core * c, vector & parameters) destroy = true; else if (p == "destroy-here") destroy = here = true; + else if (p == "visible") + need_visible = true; + else if (p == "hidden") + need_hidden = true; + else if (p == "forbidden") + need_forbidden = true; else return CR_WRONG_USAGE; } + if (need_visible && need_hidden) + { + c->con.printerr("An item can't be both hidden and visible.\n"); + return CR_WRONG_USAGE; + } + DFHack::VersionInfo *mem = c->vinfo; DFHack::Gui * Gui = c->getGui(); if (!Maps::IsValid()) @@ -158,7 +176,6 @@ static command_result autodump_main(Core * c, vector & parameters) if ( !itm->flags.bits.dump || !itm->flags.bits.on_ground || itm->flags.bits.construction - || itm->flags.bits.hidden || itm->flags.bits.in_building || itm->flags.bits.in_chest || itm->flags.bits.in_inventory @@ -166,6 +183,15 @@ static command_result autodump_main(Core * c, vector & parameters) ) continue; + if (need_visible && itm->flags.bits.hidden) + continue; + if (need_hidden && !itm->flags.bits.hidden) + continue; + if (need_forbidden && !itm->flags.bits.forbid) + continue; + if (!need_forbidden && itm->flags.bits.forbid) + continue; + if(!destroy) // move to cursor { // Change flags to indicate the dump was completed, as if by super-dwarfs