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

Function command_result plugin_enable

plugins/tailor.cpp:859–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857}
858
859DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
860 if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
861 out.printerr("Cannot enable {} without a loaded fort.\n", plugin_name);
862 return CR_FAILURE;
863 }
864
865 if (enable != is_enabled) {
866 is_enabled = enable;
867 DEBUG(control,out).print("{} from the API; persisting\n",
868 is_enabled ? "enabled" : "disabled");
869 config.set_bool(CONFIG_IS_ENABLED, is_enabled);
870 if (enable)
871 do_cycle(out);
872 } else {
873 DEBUG(control,out).print("{} from the API, but already {} ; no action\n",
874 is_enabled ? "enabled" : "disabled",
875 is_enabled ? "enabled" : "disabled");
876 }
877 return CR_OK;
878}
879
880DFhackCExport command_result plugin_shutdown (color_ostream &out) {
881 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