| 60 | } |
| 61 | |
| 62 | DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) { |
| 63 | if (enable != is_enabled) { |
| 64 | is_enabled = enable; |
| 65 | DEBUG(status, out).print("{} from the API\n", is_enabled ? "enabled" : "disabled"); |
| 66 | reset(); |
| 67 | if (enable) { |
| 68 | init_diggers(out); |
| 69 | EventManager::registerListener(EventManager::EventType::JOB_STARTED, EventManager::EventHandler(plugin_self, jobStartedHandler, 0)); |
| 70 | EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, EventManager::EventHandler(plugin_self, jobCompletedHandler, 0)); |
| 71 | } else { |
| 72 | EventManager::unregisterAll(plugin_self); |
| 73 | } |
| 74 | } |
| 75 | else { |
| 76 | DEBUG(status, out).print("{} from the API, but already {}; no action\n", is_enabled ? "enabled" : "disabled", is_enabled ? "enabled" : "disabled"); |
| 77 | } |
| 78 | return CR_OK; |
| 79 | } |
| 80 | |
| 81 | DFhackCExport command_result plugin_shutdown(color_ostream &out) { |
| 82 | DEBUG(status, out).print("shutting down {}\n", plugin_name); |
nothing calls this directly
no test coverage detected