added command to show status of preservetombs (is enabled or disabled)

develop
Najeeb Al-Shabibi 2023-09-29 13:38:52 +01:00
parent e713e63ea3
commit b0a15b2e8a
1 changed files with 22 additions and 7 deletions

@ -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);