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

Function command_result plugin_enable

plugins/nestboxes.cpp:60–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
61 if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
62 out.printerr("Cannot enable {} without a loaded fort.\n", plugin_name);
63 return CR_FAILURE;
64 }
65
66 if (enable != is_enabled) {
67 is_enabled = enable;
68 DEBUG(control,out).print("{} from the API; persisting\n",
69 is_enabled ? "enabled" : "disabled");
70 config.set_bool(CONFIG_IS_ENABLED, is_enabled);
71 if (enable)
72 do_cycle(out);
73 } else {
74 DEBUG(control,out).print("{} from the API, but already {}; no action\n",
75 is_enabled ? "enabled" : "disabled",
76 is_enabled ? "enabled" : "disabled");
77 }
78 return CR_OK;
79}
80
81DFhackCExport command_result plugin_shutdown (color_ostream &out) {
82 DEBUG(control,out).print("shutting down {}\n", plugin_name);

Callers

nothing calls this directly

Calls 2

do_cycleFunction · 0.70
printMethod · 0.45

Tested by

no test coverage detected