diff --git a/docs/Authors.rst b/docs/Authors.rst index 55ecbb17c..31789aa52 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -110,6 +110,7 @@ Nikolay Amiantov abbradar nocico nocico Omniclasm OwnageIsMagic OwnageIsMagic +palenerd dlmarquis Patrik Lundell PatrikLundell Paul Fenwick pjf PeridexisErrant PeridexisErrant diff --git a/docs/Plugins.rst b/docs/Plugins.rst index 3a4133873..120dae1d4 100644 --- a/docs/Plugins.rst +++ b/docs/Plugins.rst @@ -305,6 +305,7 @@ Subcommands that persist until disabled or DF quits: :craft-age-wear: Fixes the behavior of crafted items wearing out over time (:bug:`6003`). With this tweak, items made from cloth and leather will gain a level of wear every 20 years. +:do-job-now: Adds a job priority toggle to the jobs list :embark-profile-name: Allows the use of lowercase letters when saving embark profiles :eggs-fertile: Displays a fertility indicator on nestboxes :farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus diff --git a/docs/changelog.txt b/docs/changelog.txt index 95d18693f..e7a01f4fe 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -34,6 +34,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: # Future ## New Tweaks +- `tweak` do-job-now: adds a job priority toggle to the jobs list - `tweak` reaction-gloves: adds an option to make reactions produce gloves in sets with correct handedness ## Fixes diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index 13e08f174..2c15c3903 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -86,6 +86,7 @@ #include "tweaks/civ-agreement-ui.h" #include "tweaks/condition-material.h" #include "tweaks/craft-age-wear.h" +#include "tweaks/do-job-now.h" #include "tweaks/eggs-fertile.h" #include "tweaks/embark-profile-name.h" #include "tweaks/farm-plot-select.h" @@ -200,6 +201,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector *input) { + if (input->count(interface_key::CUSTOM_N)) { + df::job *job = vector_get(jobs, cursor_pos); + if (job) { + job->flags.bits.do_now = !job->flags.bits.do_now; + } + + return true; + } + + return false; + } + + DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set *input)) { + if (!handleInput(input)) { + INTERPOSE_NEXT(feed)(input); + } + } + + DEFINE_VMETHOD_INTERPOSE(void, render, ()) { + INTERPOSE_NEXT(render)(); + int x = 32; + auto dim = Screen::getWindowSize(); + int y = dim.y - 2; + bool do_now = false; + + df::job *job = vector_get(jobs, cursor_pos); + if (job) { + do_now = job->flags.bits.do_now; + } + + OutputHotkeyString(x, y, (!do_now ? "Do job now!" : "Normal priority"), + interface_key::CUSTOM_N, false, x, COLOR_WHITE, COLOR_LIGHTRED); + } +}; + +IMPLEMENT_VMETHOD_INTERPOSE(do_job_now_hook, feed); +IMPLEMENT_VMETHOD_INTERPOSE(do_job_now_hook, render);