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

Function command_result plugin_enable

plugins/pet-uncapper.cpp:166–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
167 if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
168 out.printerr("Cannot enable {} without a loaded fort.\n", plugin_name);
169 return CR_FAILURE;
170 }
171
172 if (enable != is_enabled) {
173 is_enabled = enable;
174 DEBUG(control,out).print("{} from the API; persisting\n",
175 is_enabled ? "enabled" : "disabled");
176 config.set_bool(CONFIG_IS_ENABLED, is_enabled);
177 if (enable)
178 impregnateMany(out);
179 } else {
180 DEBUG(control,out).print("{} from the API, but already {}; no action\n",
181 is_enabled ? "enabled" : "disabled",
182 is_enabled ? "enabled" : "disabled");
183 }
184 return CR_OK;
185}
186
187DFhackCExport command_result plugin_load_site_data (color_ostream &out) {
188 cycle_timestamp = 0;

Callers

nothing calls this directly

Calls 2

impregnateManyFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected