diff --git a/NEWS b/NEWS index 75c751900..04ea1a1a4 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ DFHack future - support for calling a lua function via a protobuf request (demonstrated by dfhack-run --lua). - Lua API for listing files in directory. Needed for mod-manager. - Lua API for creating unit combat reports and writing to gamelog. + - Lua API for running arbitrary DFHack commands - support for multiple raw/init.d/*.lua init scripts in one save. - eventful now has a more friendly way of making custom sidebars - new plugin: building-hacks. Allows to add custom functionality and/or animations to buildings. @@ -26,10 +27,12 @@ DFHack future New tweaks: - craft-age-wear: make crafted items wear out with time like in old versions (bug 6003) - adamantine-cloth-wear: stop adamantine clothing from wearing out (bug 6481) + - confirm-embark: adds a prompt before embarking (on the "prepare carefully" screen) New plugins: - rendermax: replace the renderer with something else. Most interesting is "rendermax light"- a lighting engine for df. - stockflow (by eswald): queues manager jobs of the configured type based on the state of a stockpile. + - embark-tools: implementations of Embark Anywhere, Nano Embark, and a few other embark-related utilities Misc improvements: - digfort: improved csv parsing, add start() comment handling diff --git a/Readme.html b/Readme.html index f03522734..6d3b28aa8 100644 --- a/Readme.html +++ b/Readme.html @@ -519,79 +519,80 @@ access DF memory and allow for easier development of new tools.
A collection of embark-related tools.
+Usage:
++embark-tools enable/disable tool [tool]... ++
Tools:
+When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default).
Usage:
Creates a strange mood job the same way the game itself normally does it.
Options:
@@ -3004,13 +3020,13 @@ Valid values are "miner", "carpenter", "engraver",Known limitations: if the selected unit is currently performing a job, the mood will not be started.
When enabled in dfhack.init, each time a fort is loaded identifying information will be written to the gamelog. Assists in parsing the file if you switch between forts, and adds information for story-building.
Lua or ruby scripts placed in the hack/scripts/ directory are considered for execution as if they were native DFHack commands. They are listed at the end of the 'ls' command output.
@@ -3019,7 +3035,7 @@ only be listed by ls if called as 'ls -a'. This is intended as a way to hide scripts that are obscure, developer-oriented, or should be used as keybindings.Some notable scripts:
Scripts in this subdirectory fix various bugs and issues, some of them obscure.
fix/dead-units
@@ -3056,12 +3072,12 @@ hopefully avoid jamming it again, and unsuspends them.Scripts that implement dialogs inserted into the main game window are put in this directory.
Checks, applies or removes binary patches directly in memory at runtime:
binpatch check/apply/remove <patchname>
@@ -3071,17 +3087,17 @@ script uses hack/patches/<df-v
the version appropriate for the currently loaded executable.
If called in dwarf mode, makes DF immediately auto-save the game by setting a flag normally used in seasonal auto-save.
Run setfps <number> to set the FPS cap at runtime, in case you want to watch combat in slow motion or something :)
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 @@ -3089,7 +3105,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.
Instantly grow seeds inside farming plots.
With no argument, this command list the various seed types currently in use in your farming plots. @@ -3101,7 +3117,7 @@ growcrops plump 40
This script remove negative thoughts from your dwarves. Very useful against tantrum spirals.
The script can target a single creature, when used with the him argument, @@ -3115,7 +3131,7 @@ but in the short term your dwarves will get much more joyful.
quickly after you unpause.Kills any unit of a given race.
With no argument, lists the available races and count eligible targets.
With the special argument him, targets only the selected creature.
@@ -3147,7 +3163,7 @@ exterminate elve magmaCreate an infinite magma or water source or drain on a tile.
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.
@@ -3169,14 +3185,14 @@ source add water 0 - water drainDesignate 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.
Works with a zone number as argument (eg Activity Zone #6 -> masspit 6) or with the game cursor on top of the area.
A script to designate an area for digging according to a plan in csv format.
This script, inspired from quickfort, can designate an area for digging. Your plan should be stored in a .csv file like this:
@@ -3198,7 +3214,7 @@ as an offset for the pattern: instead of starting at the cursor, it will start Dwarf Fortress.exe is found).Triggers an invasion, or several in the near future.
invasion-now civName trigger an invasion from the civilization with the id civName, starting in about ten ticks
invasion-now civName start trigger an invasion from civName in a number of ticks between 10*start and 11*start-1 (inclusive)
@@ -3206,7 +3222,7 @@ Dwarf Fortress.exe is found).Probably fails if the start time of a triggered invasion is later than the start of the next year.
Designates a tile for digging. Monitors the tile, and when it is dug out, add surrounding discovered tiles of the same material for digging. Similar to 'digv', but less cheaty. Works for stone layers, soil layers, veins, etc.
@@ -3215,7 +3231,7 @@ same designation for future digging (eg dig up/downstairs). When digging stairs, also designate tiles on z-1 and z+1 when they are discovered.Similar to fastdwarf, per-creature.
To make any creature superfast, target it ingame using 'v' and:
@@ -3225,17 +3241,17 @@ superdwarf addThis plugin also shortens the 'sleeping' and 'on break' periods of targets.
Focus a body part ingame, and this script will display the cause of death of the creature. Also works when selecting units from the 'u'nitlist viewscreen.
There are the following ways to invoke this command:
lua (without any parameters)
@@ -3254,11 +3270,11 @@ directory. If the filename is not supplied, it loads "dfhack.lua".Allow manipulation of in-game levers from the dfhack console.
Can list levers, including state and links, with:
@@ -3272,7 +3288,7 @@ lever pull 42 --now
For dumping items inside cages. Will mark selected items for dumping, then a dwarf may come and actually dump it. See also autodump.
With the items argument, only dumps items laying in the cage, excluding @@ -3290,11 +3306,11 @@ stripcaged weapons 25321 34228
Spawn arbitrary items under the cursor.
The first argument gives the item category, the second gives the material, and the optionnal third gives the number of items to create (defaults to 20).
@@ -3316,7 +3332,7 @@ create-items bar adamantineScan the map for metal ores.
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).
@@ -3329,7 +3345,7 @@ locate-ore ironIt 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.
@@ -3338,7 +3354,7 @@ to gamelog.txt on every map load to fix this. For best results call the script from dfhack.init.These tools work by displaying dialogs or overlays in the game window, and are mostly implemented by lua scripts.
Implemented by the 'manipulator' plugin.
To activate, open the unit screen and press 'l'.
This tool implements a Dwarf Therapist-like interface within the game UI. The far left column displays the unit's Happiness (color-coded based on its -value), and the right half of the screen displays each dwarf's labor settings -and skill levels (0-9 for Dabbling thru Professional, A-E for Great thru Grand -Master, and U-Z for Legendary thru Legendary+5).
+value), Name, Profession/Squad, and the right half of the screen displays each +dwarf's labor settings and skill levels (0-9 for Dabbling thru Professional, A-E for +Great thru Grand Master, and U-Z for Legendary thru Legendary+5).Cells with teal backgrounds denote skills not controlled by labors, e.g. military and social skills.
+Press t to toggle between Profession and Squad view.
+Use the arrow keys or number pad to move the cursor around, holding Shift to move 10 tiles at a time.
Press the Z-Up (<) and Z-Down (>) keys to move quickly between labor/skill @@ -3388,7 +3406,7 @@ in the list. Backspace seeks to the top left corner.
Press Enter to toggle the selected labor for the selected unit, or Shift+Enter to toggle all labors within the selected category.
Press the +- keys to sort the unit list according to the currently selected -skill/labor, and press the */ keys to sort the unit list by Name, Profession, +skill/labor, and press the */ keys to sort the unit list by Name, Profession/Squad, Happiness, or Arrival order (using Tab to select which sort method to use here).
With a unit selected, you can press the "v" key to view its properties (and possibly set a custom nickname or profession) or the "c" key to exit @@ -3396,18 +3414,18 @@ Manipulator and zoom to its position within your fortress.
The following mouse shortcuts are also available:
Pressing ESC normally returns to the unit screen, but Shift-ESC would exit directly to the main dwarf mode screen.
Implemented by the 'search' plugin.
The search plugin adds search to the Stocks, Animals, Trading, Stockpile, Noble (assignment candidates), Military (position candidates), Burrows @@ -3438,7 +3456,7 @@ only fat or tallow by forbidding fats, then searching for fat/tallow, and using Permit Fats again while the list is filtered.
Implemented by the 'automaterial' plugin.
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 @@ -3466,7 +3484,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.
To use, bind to a key (the example config uses Alt-L) and activate in the 'k' mode.
This script is a gui front-end to the liquids plugin and works similar to it, @@ -3486,7 +3504,7 @@ rivers power water wheels even when full and technically not flowing.
After setting up the desired operations using the described keys, use Enter to apply them.
To use, bind to a key (the example config uses Ctrl-M) and activate in the 'q' mode.
Lists mechanisms connected to the building, and their links. Navigating the list centers @@ -3496,7 +3514,7 @@ focus on the current one. Shift-Enter has an effect equivalent to pressing Enter re-entering the mechanisms ui.
Backed by the rename plugin, this script allows entering the desired name via a simple dialog in the game ui.
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.
@@ -3527,7 +3545,7 @@ either immediately or after opening the assign owner page. list, and allows unassigning them.Bind to a key (the example config uses Ctrl-W), and activate in the Equip->View/Customize page of the military screen.
Depending on the cursor location, it rewrites all 'individual choice weapon' entries @@ -3538,14 +3556,14 @@ only that entry, and does it even if it is not 'individual choice'.
and may lead to inappropriate weapons being selected.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.
When invoked, the script duplicates the currently selected uniform template, and selects the newly created copy.
Bind to a key (the example config uses Alt-P), and activate in the Hauling menu with the cursor over a Guide order.
@@ -3553,7 +3571,7 @@ the cursor over a Guide order. computes it when the order is executed for the first time.Bind to a key (the example config uses Alt-A), and activate with a job selected in a workshop in the 'q' mode.
@@ -3589,7 +3607,7 @@ and then try to change the input item type, now it won't let you select plan you have to unset the material first.Bind to a key (the example config uses Alt-W), and activate with a job selected in a workshop in the 'q' mode.
@@ -3636,7 +3654,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).Bind to a key (the example config uses P), and activate when viewing a weapon rack in the 'q' mode.
@@ -3660,7 +3678,7 @@ the intended user. In order to aid in the choice, it shows the number of currently assigned racks for every valid squad.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:
@@ -3679,7 +3697,7 @@ implies -aA 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.
@@ -3695,7 +3713,7 @@ case. Must be in look or talk mode to issue command on tile.There are three ways to open this editor:
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: github mini mod repository
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.
@@ -3728,20 +3746,20 @@ technical challenge, and do not represent any long-term plans to produce more similar modifications of the game.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.
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.
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.
@@ -3764,7 +3782,7 @@ menu.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.
The configuration front-end is implemented by the gui/power-meter script. Bind it to a @@ -3775,11 +3793,11 @@ in the build menu.
configuration page, but configures parameters relevant to the modded power meter building.The steam-engine plugin detects custom workshops with STEAM_ENGINE in their token, and turns them into real steam engines.
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 @@ -3790,7 +3808,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.
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.
@@ -3814,7 +3832,7 @@ short axles that can be built later than both of the engines.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 "boiling water" item will appear @@ -3845,7 +3863,7 @@ decrease it by further 4%, and also decrease the whole steam use rate by 10%.
The engine must be constructed using barrel, pipe and piston from fire-safe, or in the magma version magma-safe metals.
During operation weak parts get gradually worn out, and @@ -3854,7 +3872,7 @@ toppled during operation by a building destroyer, or a tantruming dwarf.
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 @@ -3865,7 +3883,7 @@ being generated.
This plugin makes reactions with names starting with SPATTER_ADD_
produce contaminants on the items instead of improvements. The produced
contaminants are immune to being washed away by water or destroyed by
diff --git a/Readme.rst b/Readme.rst
index 99a852cd6..1129cd225 100644
--- a/Readme.rst
+++ b/Readme.rst
@@ -2053,6 +2053,21 @@ See the bay12 thread for details: http://www.bay12forums.com/smf/index.php?topic
* Some of the DFusion plugins aren't completely ported yet. This can lead to crashes.
* The game will be suspended while you're using dfusion. Don't panic when it doesn't respond.
+embark-tools
+------------
+A collection of embark-related tools.
+
+Usage::
+
+ embark-tools enable/disable tool [tool]...
+
+Tools:
+
+* ``anywhere``: Allows embarking anywhere (including sites, mountain-only biomes, and oceans). Use with caution.
+* ``nano``: An implementation of nano embark - allows resizing below 2x2 when enabled.
+* ``sand``: Displays an indicator when sand is present in the currently-selected area, similar to the default clay/stone indicators.
+* ``sticky``: Maintains the selected local area while navigating the world map
+
misery
------
When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default).
@@ -2523,15 +2538,19 @@ To activate, open the unit screen and press 'l'.
This tool implements a Dwarf Therapist-like interface within the game UI. The
far left column displays the unit's Happiness (color-coded based on its
-value), and the right half of the screen displays each dwarf's labor settings
-and skill levels (0-9 for Dabbling thru Professional, A-E for Great thru Grand
-Master, and U-Z for Legendary thru Legendary+5).
+value), Name, Profession/Squad, and the right half of the screen displays each
+dwarf's labor settings and skill levels (0-9 for Dabbling thru Professional, A-E for
+Great thru Grand Master, and U-Z for Legendary thru Legendary+5).
Cells with teal backgrounds denote skills not controlled by labors, e.g.
military and social skills.
.. image:: images/manipulator2.png
+Press ``t`` to toggle between Profession and Squad view.
+
+.. image:: images/manipulator3.png
+
Use the arrow keys or number pad to move the cursor around, holding Shift to
move 10 tiles at a time.
@@ -2543,7 +2562,7 @@ Press Enter to toggle the selected labor for the selected unit, or Shift+Enter
to toggle all labors within the selected category.
Press the ``+-`` keys to sort the unit list according to the currently selected
-skill/labor, and press the ``*/`` keys to sort the unit list by Name, Profession,
+skill/labor, and press the ``*/`` keys to sort the unit list by Name, Profession/Squad,
Happiness, or Arrival order (using Tab to select which sort method to use here).
With a unit selected, you can press the "v" key to view its properties (and
@@ -2553,12 +2572,12 @@ Manipulator and zoom to its position within your fortress.
The following mouse shortcuts are also available:
* Click on a column header to sort the unit list. Left-click to sort it in one
- direction (descending for happiness or labors/skills, ascending for name or
- profession) and right-click to sort it in the opposite direction.
+ direction (descending for happiness or labors/skills, ascending for name,
+ profession or squad) and right-click to sort it in the opposite direction.
* Left-click on a labor cell to toggle that labor. Right-click to move the
cursor onto that cell instead of toggling it.
-* Left-click on a unit's name or profession to view its properties.
-* Right-click on a unit's name or profession to zoom to it.
+* Left-click on a unit's name, profession or squad to view its properties.
+* Right-click on a unit's name, profession or squad to zoom to it.
Pressing ESC normally returns to the unit screen, but Shift-ESC would exit
directly to the main dwarf mode screen.
diff --git a/images/manipulator.png b/images/manipulator.png
index 1f452549f..59e7226a6 100644
Binary files a/images/manipulator.png and b/images/manipulator.png differ
diff --git a/images/manipulator2.png b/images/manipulator2.png
index 38c6c3cfb..e415200a6 100644
Binary files a/images/manipulator2.png and b/images/manipulator2.png differ
diff --git a/images/manipulator3.png b/images/manipulator3.png
new file mode 100644
index 000000000..0ee952306
Binary files /dev/null and b/images/manipulator3.png differ
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp
index f81e9274c..e830189c5 100644
--- a/library/LuaApi.cpp
+++ b/library/LuaApi.cpp
@@ -2242,6 +2242,64 @@ static int internal_getDir(lua_State *L)
}
return 1;
}
+
+static int internal_runCommand(lua_State *L)
+{
+ buffered_color_ostream out;
+ command_result res;
+ if (lua_gettop(L) == 0)
+ {
+ lua_pushstring(L, "");
+ }
+ int type_1 = lua_type(L, 1);
+ if (type_1 == LUA_TTABLE)
+ {
+ std::string command = "";
+ std::vector