|
|
|
@ -68,12 +68,27 @@ static void set_config_bool(PersistentDataItem &c, int index, bool value) {
|
|
|
|
|
static bool assign_to_tomb(int32_t unit_id, int32_t building_id);
|
|
|
|
|
static void update_tomb_assignments(color_ostream& out);
|
|
|
|
|
void onUnitDeath(color_ostream& out, void* ptr);
|
|
|
|
|
static command_result do_command(color_ostream& out, std::vector<std::string>& params);
|
|
|
|
|
|
|
|
|
|
DFhackCExport command_result plugin_init(color_ostream &out, std::vector <PluginCommand> &commands) {
|
|
|
|
|
tomb_assignments.clear();
|
|
|
|
|
commands.push_back(PluginCommand(
|
|
|
|
|
plugin_name,
|
|
|
|
|
"Preserves tomb assignments to units when they die.",
|
|
|
|
|
do_command));
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static command_result do_command(color_ostream& out, std::vector<std::string>& params) {
|
|
|
|
|
if (params.size() != 1 || params[0] != "status") {
|
|
|
|
|
out.print("%s wrong usage", plugin_name);
|
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
out.print("%s is currently %s", plugin_name, is_enabled ? "enabled" : "disabled");
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// event listener
|
|
|
|
|
EventManager::EventHandler assign_tomb_handler(onUnitDeath, 0);
|
|
|
|
|
|
|
|
|
|