2011-10-29 19:50:29 -06:00
|
|
|
// Dry Buckets : Remove all "water" objects from buckets scattered around the fortress
|
|
|
|
|
2011-12-31 04:48:42 -07:00
|
|
|
#include "Core.h"
|
|
|
|
#include <Console.h>
|
|
|
|
#include <Export.h>
|
|
|
|
#include <PluginManager.h>
|
2011-10-29 19:50:29 -06:00
|
|
|
|
2012-01-07 22:04:49 -07:00
|
|
|
#include <DataDefs.h>
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/item.h"
|
|
|
|
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
2011-10-29 19:50:29 -06:00
|
|
|
using namespace DFHack;
|
|
|
|
|
2012-01-07 22:04:49 -07:00
|
|
|
using df::global::world;
|
|
|
|
|
|
|
|
DFhackCExport command_result df_drybuckets (Core * c, vector <string> & parameters)
|
|
|
|
{
|
|
|
|
if (!parameters.empty())
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
|
|
|
|
CoreSuspender suspend(c);
|
|
|
|
|
|
|
|
int dried_total = 0;
|
|
|
|
for (int i = 0; i < world->items.all.size(); i++)
|
|
|
|
{
|
|
|
|
df::item *item = world->items.all[i];
|
|
|
|
if ((item->getType() == df::item_type::LIQUID_MISC) && (item->getMaterial() == DFHack::Materials::WATER))
|
|
|
|
{
|
|
|
|
item->flags.bits.garbage_colect = 1;
|
|
|
|
dried_total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dried_total)
|
|
|
|
c->con.print("Done. %d buckets of water marked for emptying.\n", dried_total);
|
|
|
|
return CR_OK;
|
|
|
|
}
|
2011-10-29 19:50:29 -06:00
|
|
|
|
|
|
|
DFhackCExport const char * plugin_name ( void )
|
|
|
|
{
|
|
|
|
return "drybuckets";
|
|
|
|
}
|
|
|
|
|
|
|
|
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
|
|
|
|
{
|
|
|
|
commands.clear();
|
|
|
|
commands.push_back(PluginCommand("drybuckets", "Removes water from buckets.", df_drybuckets));
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
DFhackCExport command_result plugin_shutdown ( Core * c )
|
|
|
|
{
|
|
|
|
return CR_OK;
|
|
|
|
}
|