MCPcopy Create free account
hub / github.com/DFHack/dfhack / command_result plugin_enable

Function command_result plugin_enable

plugins/burrow.cpp:62–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62DFhackCExport 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
81DFhackCExport command_result plugin_shutdown(color_ostream &out) {
82 DEBUG(status, out).print("shutting down {}\n", plugin_name);

Callers

nothing calls this directly

Calls 4

init_diggersFunction · 0.85
EventHandlerClass · 0.85
resetFunction · 0.70
printMethod · 0.45

Tested by

no test coverage detected