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

Function command_result plugin_load_site_data

plugins/autonestbox.cpp:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83DFhackCExport command_result plugin_load_site_data (color_ostream &out) {
84 cycle_timestamp = 0;
85 config = World::GetPersistentSiteData(CONFIG_KEY);
86
87 if (!config.isValid()) {
88 DEBUG(control,out).print("no config found in this save; initializing\n");
89 config = World::AddPersistentSiteData(CONFIG_KEY);
90 config.set_bool(CONFIG_IS_ENABLED, is_enabled);
91 }
92
93 // we have to copy our enabled flag into the global plugin variable, but
94 // all the other state we can directly read/modify from the persistent
95 // data structure.
96 is_enabled = config.get_bool(CONFIG_IS_ENABLED);
97 DEBUG(control,out).print("loading persisted enabled state: {}\n",
98 is_enabled ? "true" : "false");
99 did_complain = false;
100 return CR_OK;
101}
102
103DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) {
104 if (event == DFHack::SC_WORLD_UNLOADED) {

Callers

nothing calls this directly

Calls 2

isValidMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected