Merge remote-tracking branches 'lethosor/remove-embark', 'lethosor/search-menus', 'lethosor/osx-package-name', 'lethosor/expose-modstate' and 'lethosor/patch-11' into develop

develop
expwnent 2015-01-15 22:24:05 -05:00
8 changed files with 250 additions and 166 deletions

@ -188,5 +188,10 @@ ELSEIF(WIN32)
SET(CPACK_GENERATOR "ZIP")
ENDIF()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${CMAKE_SYSTEM_NAME}")
IF(APPLE)
set(DFHACK_PACKAGE_PLATFORM_NAME OSX)
ELSE()
set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
ENDIF()
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_PACKAGE_PLATFORM_NAME}")
INCLUDE(CPack)

@ -533,69 +533,68 @@ access DF memory and allow for easier development of new tools.</p>
<li><a class="reference internal" href="#drain-aquifer" id="id141">drain-aquifer</a></li>
<li><a class="reference internal" href="#deathcause" id="id142">deathcause</a></li>
<li><a class="reference internal" href="#dfstatus" id="id143">dfstatus</a></li>
<li><a class="reference internal" href="#embark" id="id144">embark</a></li>
<li><a class="reference internal" href="#exterminate" id="id145">exterminate</a></li>
<li><a class="reference internal" href="#growcrops" id="id146">growcrops</a></li>
<li><a class="reference internal" href="#lever" id="id147">lever</a></li>
<li><a class="reference internal" href="#locate-ore" id="id148">locate-ore</a></li>
<li><a class="reference internal" href="#lua" id="id149">lua</a></li>
<li><a class="reference internal" href="#masspit" id="id150">masspit</a></li>
<li><a class="reference internal" href="#multicmd" id="id151">multicmd</a></li>
<li><a class="reference internal" href="#quicksave" id="id152">quicksave</a></li>
<li><a class="reference internal" href="#remove-stress" id="id153">remove-stress</a></li>
<li><a class="reference internal" href="#setfps" id="id154">setfps</a></li>
<li><a class="reference internal" href="#siren" id="id155">siren</a></li>
<li><a class="reference internal" href="#soundsense-season" id="id156">soundsense-season</a></li>
<li><a class="reference internal" href="#source" id="id157">source</a></li>
<li><a class="reference internal" href="#superdwarf" id="id158">superdwarf</a></li>
<li><a class="reference internal" href="#stripcaged" id="id159">stripcaged</a></li>
<li><a class="reference internal" href="#teleport" id="id160">teleport</a></li>
<li><a class="reference internal" href="#undump-buildings" id="id161">undump-buildings</a></li>
<li><a class="reference internal" href="#exterminate" id="id144">exterminate</a></li>
<li><a class="reference internal" href="#growcrops" id="id145">growcrops</a></li>
<li><a class="reference internal" href="#lever" id="id146">lever</a></li>
<li><a class="reference internal" href="#locate-ore" id="id147">locate-ore</a></li>
<li><a class="reference internal" href="#lua" id="id148">lua</a></li>
<li><a class="reference internal" href="#masspit" id="id149">masspit</a></li>
<li><a class="reference internal" href="#multicmd" id="id150">multicmd</a></li>
<li><a class="reference internal" href="#quicksave" id="id151">quicksave</a></li>
<li><a class="reference internal" href="#remove-stress" id="id152">remove-stress</a></li>
<li><a class="reference internal" href="#setfps" id="id153">setfps</a></li>
<li><a class="reference internal" href="#siren" id="id154">siren</a></li>
<li><a class="reference internal" href="#soundsense-season" id="id155">soundsense-season</a></li>
<li><a class="reference internal" href="#source" id="id156">source</a></li>
<li><a class="reference internal" href="#superdwarf" id="id157">superdwarf</a></li>
<li><a class="reference internal" href="#stripcaged" id="id158">stripcaged</a></li>
<li><a class="reference internal" href="#teleport" id="id159">teleport</a></li>
<li><a class="reference internal" href="#undump-buildings" id="id160">undump-buildings</a></li>
</ul>
</li>
<li><a class="reference internal" href="#modtools" id="id162">modtools</a></li>
<li><a class="reference internal" href="#in-game-interface-tools" id="id163">In-game interface tools</a><ul>
<li><a class="reference internal" href="#dwarf-manipulator" id="id164">Dwarf Manipulator</a></li>
<li><a class="reference internal" href="#search" id="id165">Search</a></li>
<li><a class="reference internal" href="#automaterial" id="id166">AutoMaterial</a></li>
<li><a class="reference internal" href="#stockpile-automation" id="id167">Stockpile Automation</a></li>
<li><a class="reference internal" href="#track-stop-menu" id="id168">Track Stop Menu</a></li>
<li><a class="reference internal" href="#gui-advfort" id="id169">gui/advfort</a></li>
<li><a class="reference internal" href="#gui-assign-rack" id="id170">gui/assign-rack</a></li>
<li><a class="reference internal" href="#gui-choose-weapons" id="id171">gui/choose-weapons</a></li>
<li><a class="reference internal" href="#gui-clone-uniform" id="id172">gui/clone-uniform</a></li>
<li><a class="reference internal" href="#gui-companion-order" id="id173">gui/companion-order</a></li>
<li><a class="reference internal" href="#gui-gm-editor" id="id174">gui/gm-editor</a></li>
<li><a class="reference internal" href="#hotkeys" id="id175">Hotkeys</a></li>
<li><a class="reference internal" href="#id1" id="id176">Hotkeys</a></li>
<li><a class="reference internal" href="#id2" id="id177">Stockpile Automation</a></li>
<li><a class="reference internal" href="#id3" id="id178">Stockpile Automation</a></li>
<li><a class="reference internal" href="#gui-liquids" id="id179">gui/liquids</a></li>
<li><a class="reference internal" href="#gui-mechanisms" id="id180">gui/mechanisms</a></li>
<li><a class="reference internal" href="#gui-mod-manager" id="id181">gui/mod-manager</a></li>
<li><a class="reference internal" href="#gui-rename" id="id182">gui/rename</a></li>
<li><a class="reference internal" href="#gui-room-list" id="id183">gui/room-list</a></li>
<li><a class="reference internal" href="#gui-guide-path" id="id184">gui/guide-path</a></li>
<li><a class="reference internal" href="#gui-workflow" id="id185">gui/workflow</a></li>
<li><a class="reference internal" href="#gui-workshop-job" id="id186">gui/workshop-job</a></li>
<li><a class="reference internal" href="#modtools" id="id161">modtools</a></li>
<li><a class="reference internal" href="#in-game-interface-tools" id="id162">In-game interface tools</a><ul>
<li><a class="reference internal" href="#dwarf-manipulator" id="id163">Dwarf Manipulator</a></li>
<li><a class="reference internal" href="#search" id="id164">Search</a></li>
<li><a class="reference internal" href="#automaterial" id="id165">AutoMaterial</a></li>
<li><a class="reference internal" href="#stockpile-automation" id="id166">Stockpile Automation</a></li>
<li><a class="reference internal" href="#track-stop-menu" id="id167">Track Stop Menu</a></li>
<li><a class="reference internal" href="#gui-advfort" id="id168">gui/advfort</a></li>
<li><a class="reference internal" href="#gui-assign-rack" id="id169">gui/assign-rack</a></li>
<li><a class="reference internal" href="#gui-choose-weapons" id="id170">gui/choose-weapons</a></li>
<li><a class="reference internal" href="#gui-clone-uniform" id="id171">gui/clone-uniform</a></li>
<li><a class="reference internal" href="#gui-companion-order" id="id172">gui/companion-order</a></li>
<li><a class="reference internal" href="#gui-gm-editor" id="id173">gui/gm-editor</a></li>
<li><a class="reference internal" href="#hotkeys" id="id174">Hotkeys</a></li>
<li><a class="reference internal" href="#id1" id="id175">Hotkeys</a></li>
<li><a class="reference internal" href="#id2" id="id176">Stockpile Automation</a></li>
<li><a class="reference internal" href="#id3" id="id177">Stockpile Automation</a></li>
<li><a class="reference internal" href="#gui-liquids" id="id178">gui/liquids</a></li>
<li><a class="reference internal" href="#gui-mechanisms" id="id179">gui/mechanisms</a></li>
<li><a class="reference internal" href="#gui-mod-manager" id="id180">gui/mod-manager</a></li>
<li><a class="reference internal" href="#gui-rename" id="id181">gui/rename</a></li>
<li><a class="reference internal" href="#gui-room-list" id="id182">gui/room-list</a></li>
<li><a class="reference internal" href="#gui-guide-path" id="id183">gui/guide-path</a></li>
<li><a class="reference internal" href="#gui-workflow" id="id184">gui/workflow</a></li>
<li><a class="reference internal" href="#gui-workshop-job" id="id185">gui/workshop-job</a></li>
</ul>
</li>
<li><a class="reference internal" href="#behavior-mods" id="id187">Behavior Mods</a><ul>
<li><a class="reference internal" href="#siege-engine" id="id188">Siege Engine</a><ul>
<li><a class="reference internal" href="#rationale" id="id189">Rationale</a></li>
<li><a class="reference internal" href="#configuration-ui" id="id190">Configuration UI</a></li>
<li><a class="reference internal" href="#behavior-mods" id="id186">Behavior Mods</a><ul>
<li><a class="reference internal" href="#siege-engine" id="id187">Siege Engine</a><ul>
<li><a class="reference internal" href="#rationale" id="id188">Rationale</a></li>
<li><a class="reference internal" href="#configuration-ui" id="id189">Configuration UI</a></li>
</ul>
</li>
<li><a class="reference internal" href="#power-meter" id="id191">Power Meter</a></li>
<li><a class="reference internal" href="#steam-engine" id="id192">Steam Engine</a><ul>
<li><a class="reference internal" href="#id4" id="id193">Rationale</a></li>
<li><a class="reference internal" href="#construction" id="id194">Construction</a></li>
<li><a class="reference internal" href="#operation" id="id195">Operation</a></li>
<li><a class="reference internal" href="#explosions" id="id196">Explosions</a></li>
<li><a class="reference internal" href="#save-files" id="id197">Save files</a></li>
<li><a class="reference internal" href="#power-meter" id="id190">Power Meter</a></li>
<li><a class="reference internal" href="#steam-engine" id="id191">Steam Engine</a><ul>
<li><a class="reference internal" href="#id4" id="id192">Rationale</a></li>
<li><a class="reference internal" href="#construction" id="id193">Construction</a></li>
<li><a class="reference internal" href="#operation" id="id194">Operation</a></li>
<li><a class="reference internal" href="#explosions" id="id195">Explosions</a></li>
<li><a class="reference internal" href="#save-files" id="id196">Save files</a></li>
</ul>
</li>
<li><a class="reference internal" href="#add-spatter" id="id198">Add Spatter</a></li>
<li><a class="reference internal" href="#add-spatter" id="id197">Add Spatter</a></li>
</ul>
</li>
</ul>
@ -3084,12 +3083,8 @@ Also works when selecting units from the 'u'nitlist viewscreen.</p>
<h2><a class="toc-backref" href="#id143">dfstatus</a></h2>
<p>Show a quick overview of critical stock quantities, including food, dirnks, wood, and various bars.</p>
</div>
<div class="section" id="embark">
<h2><a class="toc-backref" href="#id144">embark</a></h2>
<p>Allows to embark anywhere. Currently windows only.</p>
</div>
<div class="section" id="exterminate">
<h2><a class="toc-backref" href="#id145">exterminate</a></h2>
<h2><a class="toc-backref" href="#id144">exterminate</a></h2>
<p>Kills any unit of a given race.</p>
<p>With no argument, lists the available races and count eligible targets.</p>
<p>With the special argument <tt class="docutils literal">him</tt>, targets only the selected creature.</p>
@ -3121,7 +3116,7 @@ exterminate elve magma
</pre>
</div>
<div class="section" id="growcrops">
<h2><a class="toc-backref" href="#id146">growcrops</a></h2>
<h2><a class="toc-backref" href="#id145">growcrops</a></h2>
<p>Instantly grow seeds inside farming plots.</p>
<p>With no argument, this command list the various seed types currently in
use in your farming plots.
@ -3133,7 +3128,7 @@ growcrops plump 40
</pre>
</div>
<div class="section" id="lever">
<h2><a class="toc-backref" href="#id147">lever</a></h2>
<h2><a class="toc-backref" href="#id146">lever</a></h2>
<p>Allow manipulation of in-game levers from the dfhack console.</p>
<p>Can list levers, including state and links, with:</p>
<pre class="literal-block">
@ -3147,7 +3142,7 @@ lever pull 42 --now
</pre>
</div>
<div class="section" id="locate-ore">
<h2><a class="toc-backref" href="#id148">locate-ore</a></h2>
<h2><a class="toc-backref" href="#id147">locate-ore</a></h2>
<p>Scan the map for metal ores.</p>
<p>Finds and designate for digging one tile of a specific metal ore.
Only works for native metal ores, does not handle reaction stuff (eg STEEL).</p>
@ -3160,7 +3155,7 @@ locate-ore iron
</pre>
</div>
<div class="section" id="lua">
<h2><a class="toc-backref" href="#id149">lua</a></h2>
<h2><a class="toc-backref" href="#id148">lua</a></h2>
<p>There are the following ways to invoke this command:</p>
<ol class="arabic">
<li><p class="first"><tt class="docutils literal">lua</tt> (without any parameters)</p>
@ -3179,14 +3174,14 @@ directory. If the filename is not supplied, it loads &quot;dfhack.lua&quot;.</p>
</ol>
</div>
<div class="section" id="masspit">
<h2><a class="toc-backref" href="#id150">masspit</a></h2>
<h2><a class="toc-backref" href="#id149">masspit</a></h2>
<p>Designate all creatures in cages on top of a pit/pond activity zone for pitting.
Works best with an animal stockpile on top of the zone.</p>
<p>Works with a zone number as argument (eg <tt class="docutils literal">Activity Zone #6</tt> -&gt; <tt class="docutils literal">masspit 6</tt>)
or with the game cursor on top of the area.</p>
</div>
<div class="section" id="multicmd">
<h2><a class="toc-backref" href="#id151">multicmd</a></h2>
<h2><a class="toc-backref" href="#id150">multicmd</a></h2>
<p>Run multiple dfhack commands. The argument is split around the
character ; and all parts are run sequencially as independent
dfhack commands. Useful for hotkeys.</p>
@ -3196,21 +3191,21 @@ multicmd locate-ore iron ; digv
</pre>
</div>
<div class="section" id="quicksave">
<h2><a class="toc-backref" href="#id152">quicksave</a></h2>
<h2><a class="toc-backref" href="#id151">quicksave</a></h2>
<p>If called in dwarf mode, makes DF immediately auto-save the game by setting a flag
normally used in seasonal auto-save.</p>
</div>
<div class="section" id="remove-stress">
<h2><a class="toc-backref" href="#id153">remove-stress</a></h2>
<h2><a class="toc-backref" href="#id152">remove-stress</a></h2>
<p>Sets stress to -1,000,000; the normal range is 0 to 500,000 with very stable or very stressed dwarves taking on negative or greater values respectively. Applies to the selected unit, or use &quot;remove-stress -all&quot; to apply to all units.</p>
</div>
<div class="section" id="setfps">
<h2><a class="toc-backref" href="#id154">setfps</a></h2>
<h2><a class="toc-backref" href="#id153">setfps</a></h2>
<p>Run <tt class="docutils literal">setfps &lt;number&gt;</tt> to set the FPS cap at runtime, in case you want to watch
combat in slow motion or something :)</p>
</div>
<div class="section" id="siren">
<h2><a class="toc-backref" href="#id155">siren</a></h2>
<h2><a class="toc-backref" href="#id154">siren</a></h2>
<p>Wakes up sleeping units, cancels breaks and stops parties either everywhere,
or in the burrows given as arguments. In return, adds bad thoughts about
noise, tiredness and lack of protection. Also, the units with interrupted
@ -3218,7 +3213,7 @@ breaks will go on break again a lot sooner. The script is intended for
emergencies, e.g. when a siege appears, and all your military is partying.</p>
</div>
<div class="section" id="soundsense-season">
<h2><a class="toc-backref" href="#id156">soundsense-season</a></h2>
<h2><a class="toc-backref" href="#id155">soundsense-season</a></h2>
<p>It is a well known issue that Soundsense cannot detect the correct
current season when a savegame is loaded and has to play random
season music until a season switch occurs.</p>
@ -3227,7 +3222,7 @@ to gamelog.txt on every map load to fix this. For best results
call the script from <tt class="docutils literal">dfhack.init</tt>.</p>
</div>
<div class="section" id="source">
<h2><a class="toc-backref" href="#id157">source</a></h2>
<h2><a class="toc-backref" href="#id156">source</a></h2>
<p>Create an infinite magma or water source or drain on a tile.</p>
<p>This script registers a map tile as a liquid source, and every 12 game ticks
that tile receives or remove 1 new unit of flow based on the configuration.</p>
@ -3249,7 +3244,7 @@ source add water 0 - water drain
</pre>
</div>
<div class="section" id="superdwarf">
<h2><a class="toc-backref" href="#id158">superdwarf</a></h2>
<h2><a class="toc-backref" href="#id157">superdwarf</a></h2>
<p>Similar to fastdwarf, per-creature.</p>
<p>To make any creature superfast, target it ingame using 'v' and:</p>
<pre class="literal-block">
@ -3259,7 +3254,7 @@ superdwarf add
<p>This plugin also shortens the 'sleeping' and 'on break' periods of targets.</p>
</div>
<div class="section" id="stripcaged">
<h2><a class="toc-backref" href="#id159">stripcaged</a></h2>
<h2><a class="toc-backref" href="#id158">stripcaged</a></h2>
<p>For dumping items inside cages. Will mark selected items for dumping, then
a dwarf may come and actually dump it. See also <tt class="docutils literal">autodump</tt>.</p>
<p>With the <tt class="docutils literal">items</tt> argument, only dumps items laying in the cage, excluding
@ -3277,7 +3272,7 @@ stripcaged weapons 25321 34228
</pre>
</div>
<div class="section" id="teleport">
<h2><a class="toc-backref" href="#id160">teleport</a></h2>
<h2><a class="toc-backref" href="#id159">teleport</a></h2>
<p>Teleports a unit to given coordinates.</p>
<p>Examples:</p>
<pre class="literal-block">
@ -3287,12 +3282,12 @@ teleport -unit 1234 -x 56 -y 115 -z 26 - teleports unit 1234 to 56,115,26
</pre>
</div>
<div class="section" id="undump-buildings">
<h2><a class="toc-backref" href="#id161">undump-buildings</a></h2>
<h2><a class="toc-backref" href="#id160">undump-buildings</a></h2>
<p>Undesignates building base materials for dumping.</p>
</div>
</div>
<div class="section" id="modtools">
<h1><a class="toc-backref" href="#id162">modtools</a></h1>
<h1><a class="toc-backref" href="#id161">modtools</a></h1>
<p>These scripts are mostly useful for raw modders and scripters. They all have standard arguments: arguments are of the form <tt class="docutils literal">tool <span class="pre">-argName1</span> argVal1 <span class="pre">-argName2</span> argVal2</tt>. This is equivalent to <tt class="docutils literal">tool <span class="pre">-argName2</span> argVal2 <span class="pre">-argName1</span> argVal1</tt>. It is not necessary to provide a value to an argument name: <tt class="docutils literal">tool <span class="pre">-argName3</span></tt> is fine. Supplying the same argument name multiple times will result in an error. Argument names are preceded with a dash. The <tt class="docutils literal"><span class="pre">-help</span></tt> argument will print a descriptive usage string describing the nature of the arguments. For multiple word argument values, brackets must be used: <tt class="docutils literal">tool <span class="pre">-argName4</span> [ sadf1 sadf2 sadf3 ]</tt>. In order to allow passing literal braces as part of the argument, backslashes are used: <tt class="docutils literal">tool <span class="pre">-argName4</span> [ \] asdf \foo ]</tt> sets <tt class="docutils literal">argName4</tt> to <tt class="docutils literal">\] asdf foo</tt>. The <tt class="docutils literal"><span class="pre">*-trigger</span></tt> scripts have a similar policy with backslashes.</p>
<ul>
<li><p class="first">add-syndrome</p>
@ -3349,7 +3344,7 @@ teleport -unit 1234 -x 56 -y 115 -z 26 - teleports unit 1234 to 56,115,26
</ul>
</div>
<div class="section" id="in-game-interface-tools">
<h1><a class="toc-backref" href="#id163">In-game interface tools</a></h1>
<h1><a class="toc-backref" href="#id162">In-game interface tools</a></h1>
<p>These tools work by displaying dialogs or overlays in the game window, and
are mostly implemented by lua scripts.</p>
<div class="note">
@ -3364,7 +3359,7 @@ guideline because it arguably just fixes small usability bugs in the game UI.</p
you must enable the plugins which provide them.</p>
</div>
<div class="section" id="dwarf-manipulator">
<h2><a class="toc-backref" href="#id164">Dwarf Manipulator</a></h2>
<h2><a class="toc-backref" href="#id163">Dwarf Manipulator</a></h2>
<p>Implemented by the 'manipulator' plugin.</p>
<p>To activate, open the unit screen and press 'l'.</p>
<img alt="images/manipulator.png" src="images/manipulator.png" />
@ -3405,7 +3400,7 @@ cursor onto that cell instead of toggling it.</li>
directly to the main dwarf mode screen.</p>
</div>
<div class="section" id="search">
<h2><a class="toc-backref" href="#id165">Search</a></h2>
<h2><a class="toc-backref" href="#id164">Search</a></h2>
<p>Implemented by the 'search' plugin.</p>
<p>The search plugin adds search to the Stocks, Animals, Trading, Stockpile,
Noble (assignment candidates), Military (position candidates), Burrows
@ -3436,7 +3431,7 @@ only fat or tallow by forbidding fats, then searching for fat/tallow, and
using Permit Fats again while the list is filtered.</p>
</div>
<div class="section" id="automaterial">
<h2><a class="toc-backref" href="#id166">AutoMaterial</a></h2>
<h2><a class="toc-backref" href="#id165">AutoMaterial</a></h2>
<p>Implemented by the 'automaterial' plugin.</p>
<p>This makes building constructions (walls, floors, fortifications, etc) a little bit
easier by saving you from having to trawl through long lists of materials each time
@ -3464,7 +3459,7 @@ materials, it returns you back to this screen. If you use this along with severa
enabled materials, you should be able to place complex constructions more conveniently.</p>
</div>
<div class="section" id="stockpile-automation">
<h2><a class="toc-backref" href="#id167">Stockpile Automation</a></h2>
<h2><a class="toc-backref" href="#id166">Stockpile Automation</a></h2>
<p>Enable the automelt or autotrade plugins in your dfhack.init with:</p>
<pre class="literal-block">
enable automelt
@ -3475,7 +3470,7 @@ When automelt is enabled for a stockpile, any meltable items placed in it will b
When autotrade is enabled for a stockpile, any items placed in it will be designated to be taken to the Trade Depot whenever merchants are on the map.</p>
</div>
<div class="section" id="track-stop-menu">
<h2><a class="toc-backref" href="#id168">Track Stop Menu</a></h2>
<h2><a class="toc-backref" href="#id167">Track Stop Menu</a></h2>
<p>The <cite>q</cite> menu of track stops is completely blank by default. To enable one:</p>
<pre class="literal-block">
enable trackstop
@ -3489,7 +3484,7 @@ It re-uses the keybindings from the track stop building interface:</p>
</ul>
</div>
<div class="section" id="gui-advfort">
<h2><a class="toc-backref" href="#id169">gui/advfort</a></h2>
<h2><a class="toc-backref" href="#id168">gui/advfort</a></h2>
<p>This script allows to perform jobs in adventure mode. For more complete help
press '?' while script is running. It's most confortable to use this as a
keybinding. (e.g. keybinding set Ctrl-T gui/advfort). Possible arguments:</p>
@ -3508,7 +3503,7 @@ implies -a</li>
</div>
</div>
<div class="section" id="gui-assign-rack">
<h2><a class="toc-backref" href="#id170">gui/assign-rack</a></h2>
<h2><a class="toc-backref" href="#id169">gui/assign-rack</a></h2>
<p>Bind to a key (the example config uses P), and activate when viewing a weapon
rack in the 'q' mode.</p>
<img alt="images/assign-rack.png" src="images/assign-rack.png" />
@ -3532,7 +3527,7 @@ the intended user. In order to aid in the choice, it shows the number
of currently assigned racks for every valid squad.</p>
</div>
<div class="section" id="gui-choose-weapons">
<h2><a class="toc-backref" href="#id171">gui/choose-weapons</a></h2>
<h2><a class="toc-backref" href="#id170">gui/choose-weapons</a></h2>
<p>Bind to a key (the example config uses Ctrl-W), and activate in the Equip-&gt;View/Customize
page of the military screen.</p>
<p>Depending on the cursor location, it rewrites all 'individual choice weapon' entries
@ -3543,14 +3538,14 @@ only that entry, and does it even if it is not 'individual choice'.</p>
and may lead to inappropriate weapons being selected.</p>
</div>
<div class="section" id="gui-clone-uniform">
<h2><a class="toc-backref" href="#id172">gui/clone-uniform</a></h2>
<h2><a class="toc-backref" href="#id171">gui/clone-uniform</a></h2>
<p>Bind to a key (the example config uses Ctrl-C), and activate in the Uniforms
page of the military screen with the cursor in the leftmost list.</p>
<p>When invoked, the script duplicates the currently selected uniform template,
and selects the newly created copy.</p>
</div>
<div class="section" id="gui-companion-order">
<h2><a class="toc-backref" href="#id173">gui/companion-order</a></h2>
<h2><a class="toc-backref" href="#id172">gui/companion-order</a></h2>
<p>A script to issue orders for companions. Select companions with lower case chars, issue orders with upper
case. Must be in look or talk mode to issue command on tile.</p>
<img alt="images/companion-order.png" src="images/companion-order.png" />
@ -3566,7 +3561,7 @@ case. Must be in look or talk mode to issue command on tile.</p>
</ul>
</div>
<div class="section" id="gui-gm-editor">
<h2><a class="toc-backref" href="#id174">gui/gm-editor</a></h2>
<h2><a class="toc-backref" href="#id173">gui/gm-editor</a></h2>
<p>There are three ways to open this editor:</p>
<ul class="simple">
<li>using gui/gm-editor command/keybinding - opens editor on what is selected
@ -3581,7 +3576,7 @@ the same as version above.</li>
in-game help.</p>
</div>
<div class="section" id="hotkeys">
<h2><a class="toc-backref" href="#id175">Hotkeys</a></h2>
<h2><a class="toc-backref" href="#id174">Hotkeys</a></h2>
<p>Opens an in-game screen showing DFHack keybindings that are valid in the current mode.</p>
<img alt="images/hotkeys.png" src="images/hotkeys.png" />
<p>Type <tt class="docutils literal">hotkeys</tt> into the DFHack console to open the screen, or bind the command to a
@ -3591,7 +3586,7 @@ keybinding add Ctrl-F1 hotkeys
</pre>
</div>
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id176">Hotkeys</a></h2>
<h2><a class="toc-backref" href="#id175">Hotkeys</a></h2>
<p>Opens an in-game screen showing DFHack keybindings that are valid in the current mode.</p>
<img alt="images/hotkeys.png" src="images/hotkeys.png" />
<p>Type <tt class="docutils literal">hotkeys</tt> into the DFHack console to open the screen, or bind the command to a
@ -3600,7 +3595,7 @@ globally active hotkey in dfhack.init, e.g.:</p>
<tt class="docutils literal">keybinding add <span class="pre">Ctrl-F1</span> hotkeys</tt></blockquote>
</div>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id177">Stockpile Automation</a></h2>
<h2><a class="toc-backref" href="#id176">Stockpile Automation</a></h2>
<dl class="docutils">
<dt>Enable the autodump plugin in your dfhack.init with</dt>
<dd><tt class="docutils literal">enable autodump</tt></dd>
@ -3609,7 +3604,7 @@ globally active hotkey in dfhack.init, e.g.:</p>
Any items placed in this stockpile will be designated to be dumped.</p>
</div>
<div class="section" id="id3">
<h2><a class="toc-backref" href="#id178">Stockpile Automation</a></h2>
<h2><a class="toc-backref" href="#id177">Stockpile Automation</a></h2>
<dl class="docutils">
<dt>Enable the automelt plugin in your dfhack.init with</dt>
<dd><tt class="docutils literal">enable automelt</tt></dd>
@ -3618,7 +3613,7 @@ Any items placed in this stockpile will be designated to be dumped.</p>
Any items placed in this stockpile will be designated to be melted.</p>
</div>
<div class="section" id="gui-liquids">
<h2><a class="toc-backref" href="#id179">gui/liquids</a></h2>
<h2><a class="toc-backref" href="#id178">gui/liquids</a></h2>
<p>To use, bind to a key (the example config uses Alt-L) and activate in the 'k' mode.</p>
<img alt="images/liquids.png" src="images/liquids.png" />
<p>This script is a gui front-end to the liquids plugin and works similar to it,
@ -3638,7 +3633,7 @@ rivers power water wheels even when full and technically not flowing.</p>
<p>After setting up the desired operations using the described keys, use <tt class="docutils literal">Enter</tt> to apply them.</p>
</div>
<div class="section" id="gui-mechanisms">
<h2><a class="toc-backref" href="#id180">gui/mechanisms</a></h2>
<h2><a class="toc-backref" href="#id179">gui/mechanisms</a></h2>
<p>To use, bind to a key (the example config uses Ctrl-M) and activate in the 'q' mode.</p>
<img alt="images/mechanisms.png" src="images/mechanisms.png" />
<p>Lists mechanisms connected to the building, and their links. Navigating the list centers
@ -3648,13 +3643,13 @@ focus on the current one. Shift-Enter has an effect equivalent to pressing Enter
re-entering the mechanisms ui.</p>
</div>
<div class="section" id="gui-mod-manager">
<h2><a class="toc-backref" href="#id181">gui/mod-manager</a></h2>
<h2><a class="toc-backref" href="#id180">gui/mod-manager</a></h2>
<p>A way to simply install and remove small mods. It looks for specially formatted mods in
df subfolder 'mods'. Mods are not included, for example mods see: <a class="reference external" href="https://github.com/warmist/df-mini-mods">github mini mod repository</a></p>
<img alt="images/mod-manager.png" src="images/mod-manager.png" />
</div>
<div class="section" id="gui-rename">
<h2><a class="toc-backref" href="#id182">gui/rename</a></h2>
<h2><a class="toc-backref" href="#id181">gui/rename</a></h2>
<p>Backed by the rename plugin, this script allows entering the desired name
via a simple dialog in the game ui.</p>
<ul>
@ -3677,7 +3672,7 @@ their species string.</p>
unit profession change to Ctrl-Shift-T.</p>
</div>
<div class="section" id="gui-room-list">
<h2><a class="toc-backref" href="#id183">gui/room-list</a></h2>
<h2><a class="toc-backref" href="#id182">gui/room-list</a></h2>
<p>To use, bind to a key (the example config uses Alt-R) and activate in the 'q' mode,
either immediately or after opening the assign owner page.</p>
<img alt="images/room-list.png" src="images/room-list.png" />
@ -3685,7 +3680,7 @@ either immediately or after opening the assign owner page.</p>
list, and allows unassigning them.</p>
</div>
<div class="section" id="gui-guide-path">
<h2><a class="toc-backref" href="#id184">gui/guide-path</a></h2>
<h2><a class="toc-backref" href="#id183">gui/guide-path</a></h2>
<p>Bind to a key (the example config uses Alt-P), and activate in the Hauling menu with
the cursor over a Guide order.</p>
<img alt="images/guide-path.png" src="images/guide-path.png" />
@ -3693,7 +3688,7 @@ the cursor over a Guide order.</p>
computes it when the order is executed for the first time.</p>
</div>
<div class="section" id="gui-workflow">
<h2><a class="toc-backref" href="#id185">gui/workflow</a></h2>
<h2><a class="toc-backref" href="#id184">gui/workflow</a></h2>
<p>Bind to a key (the example config uses Alt-W), and activate with a job selected
in a workshop in the 'q' mode.</p>
<img alt="images/workflow.png" src="images/workflow.png" />
@ -3740,7 +3735,7 @@ the current stock value. The bright green dashed line is the target
limit (maximum) and the dark green line is that minus the gap (minimum).</p>
</div>
<div class="section" id="gui-workshop-job">
<h2><a class="toc-backref" href="#id186">gui/workshop-job</a></h2>
<h2><a class="toc-backref" href="#id185">gui/workshop-job</a></h2>
<p>Bind to a key (the example config uses Alt-A), and activate with a job selected in
a workshop in the 'q' mode.</p>
<img alt="images/workshop-job.png" src="images/workshop-job.png" />
@ -3777,7 +3772,7 @@ you have to unset the material first.</p>
</div>
</div>
<div class="section" id="behavior-mods">
<h1><a class="toc-backref" href="#id187">Behavior Mods</a></h1>
<h1><a class="toc-backref" href="#id186">Behavior Mods</a></h1>
<p>These plugins, when activated via configuration UI or by detecting certain
structures in RAWs, modify the game engine behavior concerning the target
objects to add features not otherwise present.</p>
@ -3788,20 +3783,20 @@ technical challenge, and do not represent any long-term plans to produce more
similar modifications of the game.</p>
</div>
<div class="section" id="siege-engine">
<h2><a class="toc-backref" href="#id188">Siege Engine</a></h2>
<h2><a class="toc-backref" href="#id187">Siege Engine</a></h2>
<p>The siege-engine plugin enables siege engines to be linked to stockpiles, and
aimed at an arbitrary rectangular area across Z levels, instead of the original
four directions. Also, catapults can be ordered to load arbitrary objects, not
just stones.</p>
<div class="section" id="rationale">
<h3><a class="toc-backref" href="#id189">Rationale</a></h3>
<h3><a class="toc-backref" href="#id188">Rationale</a></h3>
<p>Siege engines are a very interesting feature, but sadly almost useless in the current state
because they haven't been updated since 2D and can only aim in four directions. This is an
attempt to bring them more up to date until Toady has time to work on it. Actual improvements,
e.g. like making siegers bring their own, are something only Toady can do.</p>
</div>
<div class="section" id="configuration-ui">
<h3><a class="toc-backref" href="#id190">Configuration UI</a></h3>
<h3><a class="toc-backref" href="#id189">Configuration UI</a></h3>
<p>The configuration front-end to the plugin is implemented by the gui/siege-engine
script. Bind it to a key (the example config uses Alt-A) and activate after selecting
a siege engine in 'q' mode.</p>
@ -3824,7 +3819,7 @@ menu.</p>
</div>
</div>
<div class="section" id="power-meter">
<h2><a class="toc-backref" href="#id191">Power Meter</a></h2>
<h2><a class="toc-backref" href="#id190">Power Meter</a></h2>
<p>The power-meter plugin implements a modified pressure plate that detects power being
supplied to gear boxes built in the four adjacent N/S/W/E tiles.</p>
<p>The configuration front-end is implemented by the gui/power-meter script. Bind it to a
@ -3835,11 +3830,11 @@ in the build menu.</p>
configuration page, but configures parameters relevant to the modded power meter building.</p>
</div>
<div class="section" id="steam-engine">
<h2><a class="toc-backref" href="#id192">Steam Engine</a></h2>
<h2><a class="toc-backref" href="#id191">Steam Engine</a></h2>
<p>The steam-engine plugin detects custom workshops with STEAM_ENGINE in
their token, and turns them into real steam engines.</p>
<div class="section" id="id4">
<h3><a class="toc-backref" href="#id193">Rationale</a></h3>
<h3><a class="toc-backref" href="#id192">Rationale</a></h3>
<p>The vanilla game contains only water wheels and windmills as sources of
power, but windmills give relatively little power, and water wheels require
flowing water, which must either be a real river and thus immovable and
@ -3850,7 +3845,7 @@ it can be done just by combining existing features of the game engine
in a new way with some glue code and a bit of custom logic.</p>
</div>
<div class="section" id="construction">
<h3><a class="toc-backref" href="#id194">Construction</a></h3>
<h3><a class="toc-backref" href="#id193">Construction</a></h3>
<p>The workshop needs water as its input, which it takes via a
passable floor tile below it, like usual magma workshops do.
The magma version also needs magma.</p>
@ -3874,7 +3869,7 @@ short axles that can be built later than both of the engines.</p>
</div>
</div>
<div class="section" id="operation">
<h3><a class="toc-backref" href="#id195">Operation</a></h3>
<h3><a class="toc-backref" href="#id194">Operation</a></h3>
<p>In order to operate the engine, queue the Stoke Boiler job (optionally
on repeat). A furnace operator will come, possibly bringing a bar of fuel,
and perform it. As a result, a &quot;boiling water&quot; item will appear
@ -3905,7 +3900,7 @@ decrease it by further 4%, and also decrease the whole steam
use rate by 10%.</p>
</div>
<div class="section" id="explosions">
<h3><a class="toc-backref" href="#id196">Explosions</a></h3>
<h3><a class="toc-backref" href="#id195">Explosions</a></h3>
<p>The engine must be constructed using barrel, pipe and piston
from fire-safe, or in the magma version magma-safe metals.</p>
<p>During operation weak parts get gradually worn out, and
@ -3914,7 +3909,7 @@ toppled during operation by a building destroyer, or a
tantruming dwarf.</p>
</div>
<div class="section" id="save-files">
<h3><a class="toc-backref" href="#id197">Save files</a></h3>
<h3><a class="toc-backref" href="#id196">Save files</a></h3>
<p>It should be safe to load and view engine-using fortresses
from a DF version without DFHack installed, except that in such
case the engines won't work. However actually making modifications
@ -3925,7 +3920,7 @@ being generated.</p>
</div>
</div>
<div class="section" id="add-spatter">
<h2><a class="toc-backref" href="#id198">Add Spatter</a></h2>
<h2><a class="toc-backref" href="#id197">Add Spatter</a></h2>
<p>This plugin makes reactions with names starting with <tt class="docutils literal">SPATTER_ADD_</tt>
produce contaminants on the items instead of improvements. The produced
contaminants are immune to being washed away by water or destroyed by

@ -2291,10 +2291,6 @@ dfstatus
========
Show a quick overview of critical stock quantities, including food, dirnks, wood, and various bars.
embark
======
Allows to embark anywhere. Currently windows only.
exterminate
===========
Kills any unit of a given race.

@ -714,7 +714,7 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve
std::string keystr = parts[1];
if (parts[0] == "set")
ClearKeyBindings(keystr);
for (int i = parts.size()-1; i >= 2; i--)
for (int i = parts.size()-1; i >= 2; i--)
{
if (!AddKeyBinding(keystr, parts[i])) {
con.printerr("Invalid key spec: %s\n", keystr.c_str());
@ -910,7 +910,7 @@ void fIOthread(void * iodata)
main_history.add(command);
main_history.save("dfhack.history");
}
auto rv = core->runCommand(con, command);
if (rv == CR_NOT_IMPLEMENTED)
@ -1091,6 +1091,7 @@ bool Core::Init()
screen_window = new Windows::top_level_window();
screen_window->addChild(new Windows::dfhack_dummy(5,10));
started = true;
modstate = 0;
cerr << "Starting the TCP listener.\n";
server = new ServerMain();
@ -1579,7 +1580,7 @@ int UnicodeAwareSym(const SDL::KeyboardEvent& ke)
//MEMO: return false if event is consumed
int Core::DFH_SDL_Event(SDL::Event* ev)
{
static bool alt = 0;
//static bool alt = 0;
// do NOT process events before we are ready.
if(!started) return true;
@ -1589,31 +1590,27 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
{
auto ke = (SDL::KeyboardEvent *)ev;
if (ke->ksym.sym == SDL::K_LALT || ke->ksym.sym == SDL::K_RALT)
{
alt = (ev->type == SDL::ET_KEYDOWN);
}
else
if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
if (ke->ksym.sym == SDL::K_LSHIFT || ke->ksym.sym == SDL::K_RSHIFT)
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_SHIFT : modstate & ~MOD_SHIFT;
else if (ke->ksym.sym == SDL::K_LCTRL || ke->ksym.sym == SDL::K_RCTRL)
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_CTRL : modstate & ~MOD_CTRL;
else if (ke->ksym.sym == SDL::K_LALT || ke->ksym.sym == SDL::K_RALT)
modstate = (ev->type == SDL::ET_KEYDOWN) ? modstate | MOD_ALT : modstate & ~MOD_ALT;
else if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
{
hotkey_states[ke->ksym.sym] = true;
int mod = 0;
if (ke->ksym.mod & SDL::KMOD_SHIFT) mod |= 1;
if (ke->ksym.mod & SDL::KMOD_CTRL) mod |= 2;
if (alt) mod |= 4;
// Use unicode so Windows gives the correct value for the
// user's Input Language
if((ke->ksym.unicode & 0xff80) == 0)
{
int key = UnicodeAwareSym(*ke);
SelectHotkey(key, mod);
SelectHotkey(key, modstate);
}
else
{
// Pretend non-ascii characters don't happen:
SelectHotkey(ke->ksym.sym, mod);
SelectHotkey(ke->ksym.sym, modstate);
}
}
else if(ke->state == SDL::BTN_RELEASED)
@ -1710,7 +1707,7 @@ static bool parseKeySpec(std::string keyspec, int *psym, int *pmod, std::string
} else if (keyspec.size() > 4 && keyspec.substr(0, 4) == "Alt-") {
*pmod |= 4;
keyspec = keyspec.substr(4);
} else
} else
break;
}

@ -2008,10 +2008,12 @@ static void *checkaddr(lua_State *L, int idx, bool allow_null = false)
static uint32_t getImageBase() { return Core::getInstance().p->getBase(); }
static int getRebaseDelta() { return Core::getInstance().vinfo->getRebaseDelta(); }
static int8_t getModstate() { return Core::getInstance().getModstate(); }
static const LuaWrapper::FunctionReg dfhack_internal_module[] = {
WRAP(getImageBase),
WRAP(getRebaseDelta),
WRAP(getModstate),
{ NULL, NULL }
};
@ -2351,6 +2353,22 @@ static int internal_runCommand(lua_State *L)
return 1;
}
static int internal_getModifiers(lua_State *L)
{
int8_t modstate = Core::getInstance().getModstate();
lua_newtable(L);
lua_pushstring(L, "shift");
lua_pushboolean(L, modstate & MOD_SHIFT);
lua_settable(L, -3);
lua_pushstring(L, "ctrl");
lua_pushboolean(L, modstate & MOD_CTRL);
lua_settable(L, -3);
lua_pushstring(L, "alt");
lua_pushboolean(L, modstate & MOD_ALT);
lua_settable(L, -3);
return 1;
}
static const luaL_Reg dfhack_internal_funcs[] = {
{ "getAddress", internal_getAddress },
{ "setAddress", internal_setAddress },
@ -2365,6 +2383,7 @@ static const luaL_Reg dfhack_internal_funcs[] = {
{ "diffscan", internal_diffscan },
{ "getDir", internal_getDir },
{ "runCommand", internal_runCommand },
{ "getModifiers", internal_getModifiers },
{ NULL, NULL }
};

@ -36,6 +36,10 @@ distribution.
#include "RemoteClient.h"
#define MOD_SHIFT 1
#define MOD_CTRL 2
#define MOD_ALT 4
struct WINDOW;
namespace tthread
@ -142,6 +146,7 @@ namespace DFHack
bool ClearKeyBindings(std::string keyspec);
bool AddKeyBinding(std::string keyspec, std::string cmdline);
std::vector<std::string> ListKeyBindings(std::string keyspec);
int8_t getModstate() { return modstate; }
std::string getHackPath();
@ -216,6 +221,7 @@ namespace DFHack
std::string cmdline;
std::string focus;
};
int8_t modstate;
std::map<int, std::vector<KeyBinding> > key_bindings;
std::map<int, bool> hotkey_states;

@ -1,5 +1,6 @@
#!/bin/sh
PWD=`dirname "${0}"`
cd "${PWD}"
#thanks to Iriel for figuring this out
OSREV=`uname -r | cut -d. -f1`
if [ "$OSREV" -ge 11 ] ; then
@ -11,7 +12,6 @@ else
fi
old_tty_settings=$(stty -g)
cd "${PWD}"
DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@"
stty "$old_tty_settings"
echo ""

@ -43,6 +43,9 @@ DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(gview);
REQUIRE_GLOBAL(ui);
REQUIRE_GLOBAL(ui_building_assign_units);
REQUIRE_GLOBAL(ui_building_in_assign);
REQUIRE_GLOBAL(ui_building_item_cursor);
/*
Search Plugin
@ -981,9 +984,9 @@ private:
return desc;
}
bool should_check_input(set<df::interface_key> *input)
bool should_check_input(set<df::interface_key> *input)
{
if (input->count(interface_key::CURSOR_LEFT) || input->count(interface_key::CURSOR_RIGHT) ||
if (input->count(interface_key::CURSOR_LEFT) || input->count(interface_key::CURSOR_RIGHT) ||
(!in_entry_mode() && input->count(interface_key::UNITVIEW_PRF_PROF)))
{
if (!in_entry_mode())
@ -1006,17 +1009,17 @@ private:
return 'q';
}
vector<df::job*> *get_secondary_list()
vector<df::job*> *get_secondary_list()
{
return &viewscreen->jobs[viewscreen->page];
}
int32_t *get_viewscreen_cursor()
int32_t *get_viewscreen_cursor()
{
return &viewscreen->cursor_pos[viewscreen->page];
}
vector<df::unit*> *get_primary_list()
vector<df::unit*> *get_primary_list()
{
return &viewscreen->units[viewscreen->page];
}
@ -1089,7 +1092,7 @@ public:
// but the native hotkeys are where we normally write.
return;
}
print_search_option(2, -1);
if (!search_string.empty())
@ -1118,7 +1121,7 @@ private:
return &viewscreen->trader_items;
}
char get_search_select_key()
char get_search_select_key()
{
return 'q';
}
@ -1139,7 +1142,7 @@ public:
// but the native hotkeys are where we normally write.
return;
}
int32_t x = gps->dimx / 2 + 2;
print_search_option(x, -1);
@ -1168,7 +1171,7 @@ private:
return &viewscreen->broker_items;
}
char get_search_select_key()
char get_search_select_key()
{
return 'w';
}
@ -1203,12 +1206,12 @@ public:
print_search_option(51, 23);
}
vector<string *> *get_primary_list()
vector<string *> *get_primary_list()
{
return &viewscreen->item_names;
}
vector<bool *> *get_secondary_list()
vector<bool *> *get_secondary_list()
{
return &viewscreen->item_status;
}
@ -1257,7 +1260,7 @@ public:
return true;
}
vector<df::unit *> *get_primary_list()
vector<df::unit *> *get_primary_list()
{
return &viewscreen->positions.candidates;
}
@ -1270,7 +1273,7 @@ public:
int32_t *cursor = get_viewscreen_cursor();
df::unit *selected_unit = get_primary_list()->at(*cursor);
clear_search();
for (*cursor = 0; *cursor < get_primary_list()->size(); (*cursor)++)
{
if (get_primary_list()->at(*cursor) == selected_unit)
@ -1348,21 +1351,21 @@ private:
desc += name;
}
}
return desc;
}
vector<int32_t> *get_secondary_list()
vector<int32_t> *get_secondary_list()
{
return &viewscreen->room_value;
}
int32_t *get_viewscreen_cursor()
int32_t *get_viewscreen_cursor()
{
return &viewscreen->cursor;
}
vector<df::building*> *get_primary_list()
vector<df::building*> *get_primary_list()
{
return &viewscreen->buildings;
}
@ -1379,7 +1382,7 @@ IMPLEMENT_HOOKS(df::viewscreen_buildinglistst, roomlist_search);
//
// START: Announcement list search
//
class annoucnement_search : public search_generic<df::viewscreen_announcelistst, df::report*>
class announcement_search : public search_generic<df::viewscreen_announcelistst, df::report*>
{
public:
void render() const
@ -1407,7 +1410,7 @@ private:
};
IMPLEMENT_HOOKS(df::viewscreen_announcelistst, annoucnement_search);
IMPLEMENT_HOOKS(df::viewscreen_announcelistst, announcement_search);
//
// END: Announcement list search
@ -1449,7 +1452,7 @@ public:
return nobles_search_base::can_init(screen);
}
vector<T_candidates *> *get_primary_list()
vector<T_candidates *> *get_primary_list()
{
return &viewscreen->candidates;
}
@ -1479,7 +1482,7 @@ public:
print_search_option(2, 23);
}
vector<df::unit *> *get_primary_list()
vector<df::unit *> *get_primary_list()
{
return &viewscreen->workers;
}
@ -1506,7 +1509,7 @@ void get_job_details(string &desc, df::job *job)
desc += c;
}
desc += ".";
df::item_type itype = ENUM_ATTR(job_type, item, job->job_type);
MaterialInfo mat(job);
@ -1579,17 +1582,17 @@ private:
return 'q';
}
vector<df::unit*> *get_secondary_list()
vector<df::unit*> *get_secondary_list()
{
return &viewscreen->units;
}
int32_t *get_viewscreen_cursor()
int32_t *get_viewscreen_cursor()
{
return &viewscreen->cursor_pos;
}
vector<df::job*> *get_primary_list()
vector<df::job*> *get_primary_list()
{
return &viewscreen->jobs;
}
@ -1635,17 +1638,17 @@ public:
print_search_option(x, y);
}
vector<df::unit *> *get_primary_list()
vector<df::unit *> *get_primary_list()
{
return &ui->burrows.list_units;
}
vector<bool> *get_secondary_list()
vector<bool> *get_secondary_list()
{
return &ui->burrows.sel_units;
}
virtual int32_t * get_viewscreen_cursor()
virtual int32_t * get_viewscreen_cursor()
{
return &ui->burrows.unit_cursor_pos;
}
@ -1671,6 +1674,68 @@ IMPLEMENT_HOOKS(df::viewscreen_dwarfmodest, burrow_search);
//
//
// START: Room assignment search
//
typedef search_generic<df::viewscreen_dwarfmodest, df::unit*> room_assign_search_base;
class room_assign_search : public room_assign_search_base
{
public:
bool can_init(df::viewscreen_dwarfmodest *screen)
{
if (ui->main.mode == df::ui_sidebar_mode::QueryBuilding && *ui_building_in_assign)
{
return room_assign_search_base::can_init(screen);
}
return false;
}
string get_element_description(df::unit *element) const
{
return element ? get_unit_description(element) : "Nobody";
}
void render() const
{
auto dims = Gui::getDwarfmodeViewDims();
int left_margin = dims.menu_x1 + 1;
int x = left_margin;
int y = 19;
print_search_option(x, y);
}
vector<df::unit *> *get_primary_list()
{
return ui_building_assign_units;
}
virtual int32_t * get_viewscreen_cursor()
{
return ui_building_item_cursor;
}
bool should_check_input(set<df::interface_key> *input)
{
if (input->count(interface_key::SECONDSCROLL_UP) || input->count(interface_key::SECONDSCROLL_DOWN)
|| input->count(interface_key::SECONDSCROLL_PAGEUP) || input->count(interface_key::SECONDSCROLL_PAGEDOWN))
{
end_entry_mode();
return false;
}
return true;
}
};
IMPLEMENT_HOOKS(df::viewscreen_dwarfmodest, room_assign_search);
//
// END: Room assignment search
//
#define SEARCH_HOOKS \
HOOK_ACTION(unitlist_search_hook) \
HOOK_ACTION(roomlist_search_hook) \
@ -1681,10 +1746,11 @@ IMPLEMENT_HOOKS(df::viewscreen_dwarfmodest, burrow_search);
HOOK_ACTION(military_search_hook) \
HOOK_ACTION(nobles_search_hook) \
HOOK_ACTION(profiles_search_hook) \
HOOK_ACTION(annoucnement_search_hook) \
HOOK_ACTION(announcement_search_hook) \
HOOK_ACTION(joblist_search_hook) \
HOOK_ACTION(burrow_search_hook) \
HOOK_ACTION(stockpile_search_hook)
HOOK_ACTION(stockpile_search_hook) \
HOOK_ACTION(room_assign_search_hook)
DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable)
{