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

Function command_result plugin_onstatechange

plugins/power-meter.cpp:199–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197};
198
199DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event)
200{
201 switch (event) {
202 case SC_WORLD_LOADED:
203 {
204 bool enable = World::GetPersistentData("power-meter/enabled").isValid();
205
206 if (enable)
207 {
208 out.print("Enabling the power meter plugin.\n");
209 enable_hooks(true);
210 }
211 }
212 break;
213 case SC_WORLD_UNLOADED:
214 enable_hooks(false);
215 break;
216 default:
217 break;
218 }
219
220 return CR_OK;
221}
222
223DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
224{

Callers

nothing calls this directly

Calls 3

enable_hooksFunction · 0.70
isValidMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected