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

Function command_result plugin_onstatechange

plugins/autogems.cpp:340–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) {
341 if (event == DFHack::SC_MAP_LOADED) {
342 if (enabled && World::isFortressMode()) {
343 // Determine whether auto gem cutting has been disabled for this fort.
344 auto config = World::GetPersistentData(CONFIG_KEY);
345 running = config.isValid() && !config.ival(0);
346 read_config(out);
347 }
348 } else if (event == DFHack::SC_MAP_UNLOADED) {
349 running = false;
350 }
351
352 return CR_OK;
353}
354
355DFhackCExport command_result plugin_enable(color_ostream& out, bool enable) {
356 if (enable != enabled) {

Callers

nothing calls this directly

Calls 3

read_configFunction · 0.85
ivalMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected