Add `tweak shift-8-scroll`; misc. tweak plugin changes

* Avoid dumping complete usage information for unrecognized tweaks
* Alphabetize tweaks in Readme.rst
develop
lethosor 2015-02-17 10:43:55 -05:00
parent e19123b71b
commit abc60f53ad
4 changed files with 51 additions and 23 deletions

@ -22,6 +22,7 @@ DFHack Future
New Scripts New Scripts
modtools/reaction-product-trigger: triggers callbacks when products are produced (contrast with when reactions complete) modtools/reaction-product-trigger: triggers callbacks when products are produced (contrast with when reactions complete)
New Tweaks New Tweaks
shift-8-scroll: Gives Shift+8 (or *) priority when scrolling menus, instead of scrolling the map
tradereq-pet-gender: Displays pet genders on the trade request screen tradereq-pet-gender: Displays pet genders on the trade request screen
Removed Removed
Misc Improvements Misc Improvements

@ -1292,40 +1292,39 @@ One-shot subcommands:
for slaughter. Grabbing wagons results in some funny spam, then for slaughter. Grabbing wagons results in some funny spam, then
they are scuttled. they are scuttled.
Subcommands that persist until disabled or DF quit: Subcommands that persist until disabled or DF quits:
:stable-cursor: Saves the exact cursor position between t/q/k/d/etc menus of dwarfmode. :adamantine-cloth-wear: Prevents adamantine clothing from wearing out while being worn (bug 6481).
:advmode-contained: Works around bug 6202, i.e. custom reactions with container inputs
in advmode. The issue is that the screen tries to force you to select
the contents separately from the container. This forcefully skips child
reagents.
:civ-view-agreement: Fixes overlapping text on the "view agreement" screen
: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.
:eggs-fertile: Displays a fertility indicator on nestboxes
:farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus
:fast-heat: Further improves temperature update performance by ensuring that 1 degree :fast-heat: Further improves temperature update performance by ensuring that 1 degree
of item temperature is crossed in no more than specified number of frames of item temperature is crossed in no more than specified number of frames
when updating from the environment temperature. This reduces the time it when updating from the environment temperature. This reduces the time it
takes for stable-temp to stop updates again when equilibrium is disturbed. takes for stable-temp to stop updates again when equilibrium is disturbed.
:advmode-contained: Works around bug 6202, i.e. custom reactions with container inputs
in advmode. The issue is that the screen tries to force you to select
the contents separately from the container. This forcefully skips child
reagents.
:fast-trade: Makes Shift-Down in the Move Goods to Depot and Trade screens select :fast-trade: Makes Shift-Down in the Move Goods to Depot and Trade screens select
the current item (fully, in case of a stack), and scroll down one line. the current item (fully, in case of a stack), and scroll down one line.
:import-priority-category: Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison
:manager-quantity: Removes the limit of 30 jobs per manager order
:max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile
:military-color-assigned: Color squad candidates already assigned to other squads in yellow/green
to make them stand out more in the list.
.. image:: images/tweak-mil-color.png
:military-stable-assign: Preserve list order and cursor position when assigning to squad, :military-stable-assign: Preserve list order and cursor position when assigning to squad,
i.e. stop the rightmost list of the Positions page of the military i.e. stop the rightmost list of the Positions page of the military
screen from constantly resetting to the top. screen from constantly resetting to the top.
:military-color-assigned: Color squad candidates already assigned to other squads in yellow/green
to make them stand out more in the list.
.. image:: images/tweak-mil-color.png
: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.
:adamantine-cloth-wear: Prevents adamantine clothing from wearing out while being worn (bug 6481).
:farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus
:import-priority-category: Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison
:manager-quantity: Removes the limit of 30 jobs per manager order
:civ-view-agreement: Fixes overlapping text on the "view agreement" screen
:nestbox-color: Fixes the color of built nestboxes :nestbox-color: Fixes the color of built nestboxes
:eggs-fertile: Displays a fertility indicator on nestboxes :shift-8-scroll: Gives Shift-8 (or ``*``) priority when scrolling menus, instead of scrolling the map
:max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile :stable-cursor: Saves the exact cursor position between t/q/k/d/b/etc menus of fortress mode.
:tradereq-pet-gender: Displays pet genders on the trade request screen :tradereq-pet-gender: Displays pet genders on the trade request screen
fix-armory fix-armory

@ -86,6 +86,7 @@
#include "tweaks/max-wheelbarrow.h" #include "tweaks/max-wheelbarrow.h"
#include "tweaks/military-assign.h" #include "tweaks/military-assign.h"
#include "tweaks/nestbox-color.h" #include "tweaks/nestbox-color.h"
#include "tweaks/shift-8-scroll.h"
#include "tweaks/stable-cursor.h" #include "tweaks/stable-cursor.h"
#include "tweaks/tradereq-pet-gender.h" #include "tweaks/tradereq-pet-gender.h"
@ -179,6 +180,9 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" Preserve list order and cursor position when assigning to squad,\n" " Preserve list order and cursor position when assigning to squad,\n"
" i.e. stop the rightmost list of the Positions page of the military\n" " i.e. stop the rightmost list of the Positions page of the military\n"
" screen from constantly jumping to the top.\n" " screen from constantly jumping to the top.\n"
" tweak shift-8-scroll [disable]\n"
" Gives Shift+8 (or *) priority when scrolling menus, instead of \n"
" scrolling the map\n"
" tweak tradereq-pet-gender [disable]\n" " tweak tradereq-pet-gender [disable]\n"
" Displays the gender of pets in the trade request list\n" " Displays the gender of pets in the trade request list\n"
// " tweak military-training [disable]\n" // " tweak military-training [disable]\n"
@ -223,6 +227,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_HOOK("nestbox-color", nestbox_color_hook, drawBuilding); TWEAK_HOOK("nestbox-color", nestbox_color_hook, drawBuilding);
TWEAK_HOOK("shift-8-scroll", shift_8_scroll_hook, feed);
TWEAK_HOOK("stable-cursor", stable_cursor_hook, feed); TWEAK_HOOK("stable-cursor", stable_cursor_hook, feed);
TWEAK_HOOK("tradereq-pet-gender", pet_gender_hook, render); TWEAK_HOOK("tradereq-pet-gender", pet_gender_hook, render);
@ -656,7 +662,8 @@ static command_result enable_tweak(string tweak, color_ostream &out, vector <str
if (!recognized) if (!recognized)
{ {
out.printerr("Unrecognized tweak: %s\n", cmd.c_str()); out.printerr("Unrecognized tweak: %s\n", cmd.c_str());
return CR_WRONG_USAGE; out.print("Run 'help tweak' to display a full list\n");
return CR_FAILURE; // Avoid dumping usage information
} }
return CR_OK; return CR_OK;
} }

@ -0,0 +1,21 @@
#include "df/viewscreen_dwarfmodest.h"
using namespace df::enums;
using df::global::ui;
struct shift_8_scroll_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key>* input))
{
if (ui->main.mode != ui_sidebar_mode::Default &&
input->count(interface_key::CURSOR_UP_FAST) &&
input->count(interface_key::SECONDSCROLL_PAGEDOWN)
)
{
input->erase(interface_key::CURSOR_UP_FAST);
}
INTERPOSE_NEXT(feed)(input);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(shift_8_scroll_hook, feed);