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

Function command_result plugin_onstatechange

plugins/siege-engine.cpp:2010–2035  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2008}
2009
2010DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event)
2011{
2012 switch (event) {
2013 case SC_MAP_LOADED:
2014 if (!gamemode || *gamemode == game_mode::DWARF)
2015 {
2016 bool enable = World::GetPersistentData("siege-engine/enabled").isValid();
2017
2018 if (enable)
2019 {
2020 out.print("Enabling the siege engine plugin.\n");
2021 enable_hooks(true);
2022 }
2023 else
2024 enable_hooks(false);
2025 }
2026 break;
2027 case SC_MAP_UNLOADED:
2028 enable_hooks(false);
2029 break;
2030 default:
2031 break;
2032 }
2033
2034 return CR_OK;
2035}
2036
2037DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
2038{

Callers

nothing calls this directly

Calls 3

enable_hooksFunction · 0.70
isValidMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected