|
|
@ -54,6 +54,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
|
|
|
|
"Options:\n"
|
|
|
|
"Options:\n"
|
|
|
|
" destroy - instead of dumping, destroy the items instantly.\n"
|
|
|
|
" destroy - instead of dumping, destroy the items instantly.\n"
|
|
|
|
" destroy-here - only affect the tile under cursor.\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(
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
"autodump-destroy-here", "Destroy items marked for dumping under cursor.",
|
|
|
|
"autodump-destroy-here", "Destroy items marked for dumping under cursor.",
|
|
|
@ -82,6 +85,9 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
|
|
|
|
// Command line options
|
|
|
|
// Command line options
|
|
|
|
bool destroy = false;
|
|
|
|
bool destroy = false;
|
|
|
|
bool here = false;
|
|
|
|
bool here = false;
|
|
|
|
|
|
|
|
bool need_visible = false;
|
|
|
|
|
|
|
|
bool need_hidden = false;
|
|
|
|
|
|
|
|
bool need_forbidden = false;
|
|
|
|
if(parameters.size() > 0)
|
|
|
|
if(parameters.size() > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string & p = parameters[0];
|
|
|
|
string & p = parameters[0];
|
|
|
@ -89,10 +95,22 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
|
|
|
|
destroy = true;
|
|
|
|
destroy = true;
|
|
|
|
else if (p == "destroy-here")
|
|
|
|
else if (p == "destroy-here")
|
|
|
|
destroy = here = true;
|
|
|
|
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
|
|
|
|
else
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
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::VersionInfo *mem = c->vinfo;
|
|
|
|
DFHack::Gui * Gui = c->getGui();
|
|
|
|
DFHack::Gui * Gui = c->getGui();
|
|
|
|
if (!Maps::IsValid())
|
|
|
|
if (!Maps::IsValid())
|
|
|
@ -158,7 +176,6 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
|
|
|
|
if ( !itm->flags.bits.dump
|
|
|
|
if ( !itm->flags.bits.dump
|
|
|
|
|| !itm->flags.bits.on_ground
|
|
|
|
|| !itm->flags.bits.on_ground
|
|
|
|
|| itm->flags.bits.construction
|
|
|
|
|| itm->flags.bits.construction
|
|
|
|
|| itm->flags.bits.hidden
|
|
|
|
|
|
|
|
|| itm->flags.bits.in_building
|
|
|
|
|| itm->flags.bits.in_building
|
|
|
|
|| itm->flags.bits.in_chest
|
|
|
|
|| itm->flags.bits.in_chest
|
|
|
|
|| itm->flags.bits.in_inventory
|
|
|
|
|| itm->flags.bits.in_inventory
|
|
|
@ -166,6 +183,15 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
continue;
|
|
|
|
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
|
|
|
|
if(!destroy) // move to cursor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Change flags to indicate the dump was completed, as if by super-dwarfs
|
|
|
|
// Change flags to indicate the dump was completed, as if by super-dwarfs
|
|
|
|