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

Function command_result plugin_enable

plugins/diggingInvaders/diggingInvaders.cpp:135–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135DFhackCExport command_result plugin_enable(color_ostream& out, bool enable) {
136 if ( enabled == enable )
137 return CR_OK;
138
139 enabled = enable;
140 EventManager::unregisterAll(plugin_self);
141 clearDijkstra();
142 lastInvasionJob = lastInvasionDigger = -1;
143 activeDigging = false;
144 invaderJobs.clear();
145 if ( enabled ) {
146 EventManager::EventHandler handler(plugin_self, newInvasionHandler, 1000);
147 EventManager::registerListener(EventManager::EventType::INVASION, handler);
148 findAndAssignInvasionJob(out, (void*)0);
149 }
150
151 return CR_OK;
152}
153
154DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event)
155{

Callers

nothing calls this directly

Calls 3

clearDijkstraFunction · 0.85
findAndAssignInvasionJobFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected