diff --git a/NEWS.rst b/NEWS.rst index 4c804d1f3..1a0544136 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -168,6 +168,7 @@ Misc Improvements - `stocks`: can now match beginning and end of item names - `teleport`: Fixed cursor recognition +- `tidlers`, `twaterlvl`: now implemented by scripts instead of a plugin - `tweak`: - debug output now logged to stderr.log instead of console - makes DFHack start faster diff --git a/docs/Plugins.rst b/docs/Plugins.rst index 9ea4b309f..20a54279e 100644 --- a/docs/Plugins.rst +++ b/docs/Plugins.rst @@ -564,10 +564,6 @@ resume Allows automatic resumption of suspended constructions, along with colored UI hints for construction status. -tidlers -------- -Toggle between all possible positions where the idlers count can be placed. - .. _trackstop: trackstop @@ -576,10 +572,6 @@ Adds a :kbd:`q` menu for track stops, which is completely blank by default. This allows you to view and/or change the track stop's friction and dump direction settings, using the keybindings from the track stop building interface. -twaterlvl ---------- -Toggle between displaying/not displaying liquid depth as numbers. - .. _stocks: stocks diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 0cb8b6df2..115f6196e 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -133,7 +133,6 @@ if (BUILD_SUPPORTED) DFHACK_PLUGIN(getplants getplants.cpp) DFHACK_PLUGIN(hotkeys hotkeys.cpp) DFHACK_PLUGIN(infiniteSky infiniteSky.cpp) - DFHACK_PLUGIN(initflags initflags.cpp) DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote) DFHACK_PLUGIN(jobutils jobutils.cpp) DFHACK_PLUGIN(lair lair.cpp) diff --git a/plugins/initflags.cpp b/plugins/initflags.cpp deleted file mode 100644 index 7a4ad30b0..000000000 --- a/plugins/initflags.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "Core.h" -#include "Console.h" -#include "Export.h" -#include "PluginManager.h" - -#include "DataDefs.h" -#include "df/d_init.h" - -using std::vector; -using std::string; -using std::endl; -using namespace DFHack; -using namespace df::enums; - -DFHACK_PLUGIN("initflags"); -REQUIRE_GLOBAL(d_init); - -command_result twaterlvl(color_ostream &out, vector & parameters); -command_result tidlers(color_ostream &out, vector & parameters); - -DFhackCExport command_result plugin_init (color_ostream &out, std::vector &commands) -{ - if (d_init) { - commands.push_back(PluginCommand("twaterlvl", "Toggle display of water/magma depth.", - twaterlvl, Gui::dwarfmode_hotkey)); - commands.push_back(PluginCommand("tidlers", "Toggle display of idlers.", - tidlers, Gui::dwarfmode_hotkey)); - } - return CR_OK; -} - -DFhackCExport command_result plugin_shutdown ( color_ostream &out ) -{ - return CR_OK; -} - -command_result twaterlvl(color_ostream &out, vector & parameters) -{ - // HOTKEY COMMAND: CORE ALREADY SUSPENDED - d_init->flags1.toggle(d_init_flags1::SHOW_FLOW_AMOUNTS); - out << "Toggled the display of water/magma depth." << endl; - return CR_OK; -} - -command_result tidlers(color_ostream &out, vector & parameters) -{ - // HOTKEY COMMAND: CORE ALREADY SUSPENDED - d_init->idlers = ENUM_NEXT_ITEM(d_init_idlers, d_init->idlers); - out << "Toggled the display of idlers to " << ENUM_KEY_STR(d_init_idlers, d_init->idlers) << endl; - return CR_OK; -} diff --git a/scripts/tidlers.lua b/scripts/tidlers.lua new file mode 100644 index 000000000..5d450f631 --- /dev/null +++ b/scripts/tidlers.lua @@ -0,0 +1,17 @@ +--Toggle idlers count +--[[=begin + +tidlers +======= +Toggle between all possible positions where the idlers count can be placed. + +=end]] +-- see also the enum: df.d_init_idlers +if df.global.d_init.idlers == 0 then + df.global.d_init.idlers = 1 +elseif df.global.d_init.idlers == 1 then + df.global.d_init.idlers = -1 +else + df.global.d_init.idlers = 0 +end +print('Toggled the display of idlers.') diff --git a/scripts/twaterlvl.lua b/scripts/twaterlvl.lua new file mode 100644 index 000000000..50f487686 --- /dev/null +++ b/scripts/twaterlvl.lua @@ -0,0 +1,11 @@ +-- Toggle display of water depth +--[[=begin + +twaterlvl +========= +Toggle between displaying/not displaying liquid depth as numbers. + +=end]] + +df.global.d_init.flags1.SHOW_FLOW_AMOUNTS = not df.global.d_init.flags1.SHOW_FLOW_AMOUNTS +print('Water level display toggled.')