From 4246dbd02ab26a0c0a4003daa1942f086a45da7c Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 26 Jun 2015 23:18:08 -0400 Subject: [PATCH] New tweak: kitchen-prefs-color Disabled in default dfhack.init to avoid confusion --- NEWS | 1 + Readme.rst | 1 + plugins/tweak/tweak.cpp | 6 ++ plugins/tweak/tweaks/kitchen-prefs-color.h | 70 ++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 plugins/tweak/tweaks/kitchen-prefs-color.h diff --git a/NEWS b/NEWS index 729e71087..ec36df918 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ DFHack Future item-descriptions: holds a default description for every item type and subtype warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found New tweaks + kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs Fixes Plugins with vmethod hooks can now be reloaded on OS X diff --git a/Readme.rst b/Readme.rst index 1c4f4dc6a..b32663d37 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1313,6 +1313,7 @@ Subcommands that persist until disabled or DF quits: :fps-min: Fixes the in-game minimum FPS setting :import-priority-category: Allows changing the priority of all goods in a category when discussing an import agreement with the liaison +:kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences :kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs (bug 9000) :manager-quantity: Removes the limit of 30 jobs per manager order :max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index c43709144..10b36b178 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -84,6 +84,7 @@ #include "tweaks/fast-trade.h" #include "tweaks/fps-min.h" #include "tweaks/import-priority-category.h" +#include "tweaks/kitchen-prefs-color.h" #include "tweaks/kitchen-prefs-empty.h" #include "tweaks/manager-quantity.h" #include "tweaks/max-wheelbarrow.h" @@ -103,6 +104,7 @@ using namespace df::enums; DFHACK_PLUGIN("tweak"); DFHACK_PLUGIN_IS_ENABLED(is_enabled); +REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_building_item_cursor); @@ -186,6 +188,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector dimx; x++) + { + std::string word = read_string(x, start_y, 4); + if (word == "Cook" || word == "----") + { + start_x = x; + break; + } + } + if (!start_x) + return; + + for (int y = start_y; y < gps->dimy; y++) + { + recolor(start_x, y, "Cook", COLOR_GREEN); + recolor(start_x + 5, y, "Brew", COLOR_GREEN); + } + } +}; + +IMPLEMENT_VMETHOD_INTERPOSE(kitchen_prefs_color_hook, render);