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

Function command_result plugin_onstatechange

plugins/steam-engine.cpp:904–925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903
904DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event)
905{
906 switch (event) {
907 case SC_MAP_LOADED:
908 if (World::isFortressMode() && find_engines(out))
909 {
910 out.print("Detected steam engine workshops - enabling plugin.\n");
911 enable_hooks(true);
912 }
913 else
914 enable_hooks(false);
915 break;
916 case SC_MAP_UNLOADED:
917 enable_hooks(false);
918 engines.clear();
919 break;
920 default:
921 break;
922 }
923
924 return CR_OK;
925}
926
927DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
928{

Callers

nothing calls this directly

Calls 4

find_enginesFunction · 0.85
enable_hooksFunction · 0.70
printMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected