diff --git a/Lua API.html b/Lua API.html index 047ef9786..06fa5418e 100644 --- a/Lua API.html +++ b/Lua API.html @@ -1914,6 +1914,12 @@ utils.insert_or_update(soul.skills, {new=true, id=..., rating=...}, 'id')
(For an explanation of new=true, see table assignment in the wrapper section)
+utils.erase_sorted_key(vector,key,field,cmpfun)
+Removes the item with the given key from the list. Returns: did_erase, vector[idx], idx.
+utils.erase_sorted(vector,item,field,cmpfun)
+Exactly like erase_sorted_key, but if field is specified, takes the key from item[field].
+utils.prompt_yes_no(prompt, default)
Presents a yes/no prompt to the user. If default is not nil, allows just pressing Enter to submit the default choice. diff --git a/Lua API.rst b/Lua API.rst index bf7ee45a7..fbb4b7d82 100644 --- a/Lua API.rst +++ b/Lua API.rst @@ -1806,6 +1806,14 @@ utils (For an explanation of ``new=true``, see table assignment in the wrapper section) +* ``utils.erase_sorted_key(vector,key,field,cmpfun)`` + + Removes the item with the given key from the list. Returns: *did_erase, vector[idx], idx*. + +* ``utils.erase_sorted(vector,item,field,cmpfun)`` + + Exactly like ``erase_sorted_key``, but if field is specified, takes the key from ``item[field]``. + * ``utils.prompt_yes_no(prompt, default)`` Presents a yes/no prompt to the user. If ``default`` is not *nil*, diff --git a/NEWS b/NEWS index b36d2f121..5072cebc3 100644 --- a/NEWS +++ b/NEWS @@ -4,8 +4,10 @@ DFHack future - support for displaying active keybindings properly. Notable bugfixes: - autobutcher can be re-enabled again after being stopped. + - stopped Dwarf Manipulator from unmasking vampires. Misc improvements: - fastdwarf: new mode using debug flags, and some internal consistency fixes. + - added a small stand-alone utility for applying and removing binary patches. DFHack v0.34.11-r2 diff --git a/Readme.html b/Readme.html index caf1f6a0e..c1d2d0d3c 100644 --- a/Readme.html +++ b/Readme.html @@ -338,187 +338,190 @@ access DF memory and allow for easier development of new tools.
Interactive commands like 'liquids' cannot be used as hotkeys.
Most of the commands come from plugins. Those reside in 'hack/plugins/'.
+On linux and OSX, users of patched binaries may have to find the relevant +section in symbols.xml, and add a new line with the checksum of their +executable:
++<md5-hash value='????????????????????????????????'/> ++
In order to find the correct value of the hash, look into stderr.log; +DFHack prints an error there if it does not recognize the hash.
+DFHack includes a small stand-alone utility for applying and removing +binary patches from the game executable. Use it from the regular operating +system console:
++++
+- +
binpatch check "Dwarf Fortress.exe" patch.dif
+Checks and prints if the patch is currently applied.
+- +
binpatch apply "Dwarf Fortress.exe" patch.dif
+Applies the patch, unless it is already applied or in conflict.
+- +
binpatch remove "Dwarf Fortress.exe" patch.dif
+Removes the patch, unless it is already removed.
+
The patches are expected to be encoded in text format used by IDA.
+First, don't panic :) Second, dfhack keeps a few log files in DF's folder
- stderr.log and stdout.log. You can look at those and possibly find out what's
happening.
@@ -596,13 +627,13 @@ the issues tracker on github, contact me (
- If your DF folder contains a file named dfhack.init, its contents will be run
every time you start DF. This allows setting up keybindings. An example file
is provided as dfhack.init-example - you can tweak it and rename to dfhack.init
if you want to use this functionality. To set keybindings, use the built-in keybinding command. Like any other
command it can be used at any time from the console, but it is also meaningful
in the DFHack init file.The init file
+The init file
Setting keybindings
+Setting keybindings
DFHack command syntax consists of a command name, followed by arguments separated by whitespace. To include whitespace in an argument, quote it in double quotes. To include a double quote character, use \" inside double quotes.
@@ -669,13 +700,13 @@ The following two command lines are exactly equivalent: to retrieve further help without having to look at this document. Alternatively, some accept a 'help'/'?' option on their command line.Forces DF to pause. This is useful when your FPS drops below 1 and you lose control of the game.
@@ -686,12 +717,12 @@ control of the game.
Makes the game view follow the currently highlighted unit after you exit from current menu/cursor mode. Handy for watching dwarves running around. Deactivated by moving the view manually.
This allows taking control over your followers and other creatures in adventure mode. For example, you can make them pick up new arms and armor and equip them properly.
@@ -777,7 +808,7 @@ properly.Changes material of the geology layer under cursor to the specified inorganic RAW material. Can have impact on all surrounding regions, not only your embark! By default changing stone to soil and vice versa is not allowed. By default @@ -877,7 +908,7 @@ You did save your game, right?
Changes material of the vein under cursor to the specified inorganic RAW material. Only affects tiles within the current 16x16 block - for veins and large clusters, you will need to use this command multiple times.
@@ -890,7 +921,7 @@ large clusters, you will need to use this command multiple times.Allows changing item material and base quality. By default the item currently selected in the UI will be changed (you can select items in the 'k' list or inside containers/inventory). By default change is only allowed if materials @@ -930,7 +961,7 @@ crafters/haulers.
Allows listing all the vermin colonies on the map and optionally turning them into honey bee colonies.
Options:
@@ -945,12 +976,12 @@ crafters/haulers.
Removes all ramps designated for removal from the map. This is useful for replicating the old channel digging designation. It also removes any and all 'down ramps' that can remain after a cave-in (you don't have to designate anything for that to happen).
Enables management of map features.
Allows adding magma, water and obsidian to the game. It replaces the normal dfhack command line and can't be used from a hotkey. Settings will be remembered as long as dfhack runs. Intended for use in combination with the command @@ -988,13 +1019,13 @@ temperatures (creating heat traps). You've been warned.
Run the liquid spawner with the current/last settings made in liquids (if no settings in liquids were made it paints a point of 7/7 magma by default).
Intended to be used as keybinding. Requires an active in-game cursor.
Can be used for painting map tiles and is an interactive command, much like liquids.
The tool works with two set of options and a brush. The brush determines which @@ -1055,27 +1086,27 @@ up.
For more details, see the 'help' command while using this.
Runs tiletypes commands, separated by ;. This makes it possible to change tiletypes modes from a hotkey.
Apply the current tiletypes options at the in-game cursor position, including the brush. Can be used from a hotkey.
Apply the current tiletypes options at the in-game cursor position to a single tile. Can be used from a hotkey.
Fills all the adamantine veins again. Veins that were empty will be filled in too, but might still trigger a demon invasion (this is a known bug).
A tool for getting rid of trees and shrubs. By default, it only kills a tree/shrub under the cursor. The plants are turned into ashes instantly.
Options:
@@ -1095,20 +1126,20 @@ a tree/shrub under the cursor. The plants are turned into ashes instantly.Very similar to extirpate, but additionally sets the plants on fire. The fires can and will spread ;)
Prints the current weather map by default.
Also lets you change the current weather to 'clear sky', 'rainy' or 'snowing'.
Options:
@@ -1129,9 +1160,9 @@ can and will spread ;)Checks a single map tile or the whole map/world for cursed creatures (ghosts, vampires, necromancers, werebeasts, zombies).
With an active in-game cursor only the selected tile will be observed. @@ -1186,17 +1217,17 @@ of curses, for example.
A tool for checking how many tiles contain flowing liquids. If you suspect that your magma sea leaks into HFS, you can use this tool to be sure without revealing the map.
Prints a big list of all the present minerals and plants. By default, only the visible part of the map is scanned.
Options:
@@ -1215,7 +1246,7 @@ the visible part of the map is scanned.If prospect is called during the embark selection screen, it displays an estimate of layer stone availability.
This reveals the map. By default, HFS will remain hidden so that the demons don't spawn. You can use 'reveal hell' to reveal everything. With hell revealed, you won't be able to unpause until you hide the map again. If you really want @@ -1249,34 +1280,34 @@ to unpause with hell revealed, use 'reveal demons'.
you move. When you use it this way, you don't need to run 'unreveal'.This command will hide the whole map and then reveal all the tiles that have a path to the in-game cursor.
When you use reveal, it saves information about what was/wasn't visible before revealing everything. Unreveal uses this information to hide things again. This command throws away the information. For example, use in cases where you abandoned with the fort revealed and no longer want the data.
Miscellaneous burrow control. Allows manipulating burrows and automated burrow expansion while digging.
Options:
@@ -1324,17 +1355,17 @@ Digging 1-wide corridors with the miner inside the burrow is SLOW.Designates a whole vein for digging. Requires an active in-game cursor placed over a vein tile. With the 'x' option, it will traverse z-levels (putting stairs between the same-material tiles).
Designates layer stone for digging. Requires an active in-game cursor placed over a layer stone tile. With the 'x' option, it will traverse z-levels (putting stairs between the same-material tiles). With the 'undo' option it @@ -1342,11 +1373,11 @@ will remove the dig designation instead (if you realize that digging out a 50 z-level deep layer was not such a good idea after all).
This command can be used for exploratory mining.
See: http://df.magmawiki.com/index.php/DF2010:Exploratory_mining
There are two variables that can be set: pattern and filter.
@@ -1409,7 +1440,7 @@ z-level deep layer was not such a good idea after all).A command for easy designation of filled and hollow circles. It has several types of options.
Shape:
@@ -1472,7 +1503,7 @@ repeats with the last selected parameters.For every tile on the map of the same vein type as the selected tile, this command designates it to have the same designation as the selected tile. If the selected tile has no designation, they will be dig designated. If an argument is given, the designation of the selected tile is ignored, and all appropriate tiles are set to the specified designation.
Options:
@@ -1500,7 +1531,7 @@ If an argument is given, the designation of the selected tile is ignored, and alSet traffic designations using flood-fill starting at the cursor.
Traffic Type Codes:
@@ -1539,7 +1570,7 @@ If an argument is given, the designation of the selected tile is ignored, and al 'filltraffic H' - When used in a room with doors, it will set traffic to HIGH in just that room.
Set traffic designations for every single tile of the map (useful for resetting traffic designations).
Traffic Type Codes:
@@ -1563,7 +1594,7 @@ If an argument is given, the designation of the selected tile is ignored, and al 'alltraffic N' - Set traffic to 'normal' for all tiles.
Cleans all the splatter that get scattered all over the map, items and creatures. In an old fortress, this can significantly reduce FPS lag. It can also spoil your !!FUN!!, so think before you use it.
@@ -1626,12 +1657,12 @@ also spoil your !!FUN!!, so think before you use it.Works like 'clean map snow mud', but only for the tile under the cursor. Ideal if you want to keep that bloody entrance 'clean map' would clean up.
This utility lets you quickly move all items designated to be dumped. Items are instantly moved to the cursor position, the dump flag is unset, and the forbid flag is set, as if it had been dumped normally. @@ -1658,17 +1689,17 @@ Be aware that any active dump item tasks still point at the item.
Destroy items marked for dumping under cursor. Identical to autodump destroy-here, but intended for use as keybinding.
Destroy the selected item. The item may be selected in the 'k' list, or inside a container. If called again before the game is resumed, cancels destroy.
Confiscates items owned by dwarfs. By default, owned food on the floor and rotten items are confistacted and dumped.
Options:
@@ -1702,13 +1733,13 @@ worn items with 'X' damage and above.This utility removes water from all buckets in your fortress, allowing them to be safely used for making lye.
Up to version 0.31.12, Elves only sent Diplomats to your fortress to propose tree cutting quotas due to a bug; once that bug was fixed, Elves stopped caring about excess tree cutting. This command adds a Diplomat position to all Elven @@ -1717,19 +1748,19 @@ to violate them and potentially start wars) in case you haven't already modified your raws accordingly.
This command adds the Guild Representative position to all Human civilizations, allowing them to make trade agreements (just as they did back in 0.28.181.40d and earlier) in case you haven't already modified your raws accordingly.
Removes invalid references to mineral inclusions and restores missing ones. Use this if you broke your embark with tools like tiletypes, or if you accidentally placed a construction on top of a valuable mineral floor.
Contains various tweaks for minor bugs.
One-shot subcommands:
One convenient way to use the zone tool is to bind the command 'zone assign' to a hotkey, maybe also the command 'zone set'. Place the in-game cursor over a pen/pasture or pit, use 'zone set' to mark it. Then you can select units @@ -2124,7 +2155,7 @@ and use 'zone assign' to assign them to their new home. Allows pitting your own dwarves, by the way.
All filters can be used together with the 'assign' command.
Restrictions: It's not possible to assign units who are inside built cages or chained because in most cases that won't be desirable anyways. @@ -2142,14 +2173,14 @@ are not properly added to your own stocks; slaughtering them should work).
Most filters can be negated (e.g. 'not grazer' -> race is not a grazer).
Using the 'nick' command you can set the same nickname for multiple units. If used without 'assign', 'all' or 'count' it will rename all units in the current default target zone. Combined with 'assign', 'all' or 'count' (and further optional filters) it will rename units matching the filter conditions.
Using the 'tocages' command you can assign units to a set of cages, for example a room next to your butcher shop(s). They will be spread evenly among available cages to optimize hauling to and butchering from them. For this to work you need @@ -2160,7 +2191,7 @@ would make no sense, but can be used together with 'nick' or 'remnick' and all the usual filters.
Assigns unpastured female egg-layers to nestbox zones. Requires that you create pen/pasture zones above nestboxes. If the pen is bigger than 1x1 the nestbox must be in the top left corner. Only 1 unit will be assigned per pen, regardless @@ -2215,7 +2246,7 @@ frames between runs.
Assigns lifestock for slaughter once it reaches a specific count. Requires that you add the target race(s) to a watch list. Only tame units will be processed.
Named units will be completely ignored (to protect specific animals from @@ -2323,7 +2354,7 @@ autobutcher.bat
Makes cats just multiply. It is not a good idea to run this more than once or twice.
This is the DFusion lua plugin system by warmist/darius, running as a DFHack plugin.
See the bay12 thread for details: http://www.bay12forums.com/smf/index.php?topic=69682.15
Confirmed working DFusion plugins:
@@ -2366,7 +2397,7 @@ twice.When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default).
Usage: