| 81 | } |
| 82 | |
| 83 | DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) { |
| 84 | if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) { |
| 85 | out.printerr("Cannot enable {} without a loaded fort.\n", plugin_name); |
| 86 | return CR_FAILURE; |
| 87 | } |
| 88 | |
| 89 | if (enable != is_enabled) { |
| 90 | is_enabled = enable; |
| 91 | DEBUG(control,out).print("{} from the API; persisting\n", |
| 92 | is_enabled ? "enabled" : "disabled"); |
| 93 | config.set_bool(CONFIG_IS_ENABLED, is_enabled); |
| 94 | // don't autorun cycle on first frame of fortress so we don't mark animals for butchering before |
| 95 | // all initial configuration has been applied |
| 96 | if (enable && plotinfo->fortress_age > 0) |
| 97 | autobutcher_cycle(out); |
| 98 | } else { |
| 99 | DEBUG(control,out).print("{} from the API, but already {}; no action\n", |
| 100 | is_enabled ? "enabled" : "disabled", |
| 101 | is_enabled ? "enabled" : "disabled"); |
| 102 | } |
| 103 | return CR_OK; |
| 104 | } |
| 105 | |
| 106 | DFhackCExport command_result plugin_shutdown (color_ostream &out) { |
| 107 | DEBUG(control,out).print("shutting down {}\n", plugin_name); |
nothing calls this directly
no test coverage detected