Merge branch 'develop' into plugin-manager

develop
lethosor 2015-08-17 08:17:56 -04:00
commit ec4a3bda54
11 changed files with 345 additions and 63 deletions

@ -80,6 +80,7 @@ melkor217 melkor217
acwatkins acwatkins
Wes Malone wesQ3
Michon van Dooren MaienM
Seth Woodworth sethwoodworth
======================= ==================== ===========================
And these are the cool people who made **Stonesense**.

@ -24,8 +24,9 @@ DFHack Future
New scripts
burial: sets all unowned coffins to allow burial ("-pets" to allow pets too)
fix-ster: changes fertility/sterility of animals or dwarves
view-item-info: adds information and customisable descriptions to item viewscreens
view-item-info: adds information and customisable descriptions to item viewscreens
warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found
points: set number of points available at embark screen
New tweaks
kitchen-keys: Fixes DF kitchen meal keybindings
kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences

@ -291,6 +291,11 @@ control of the game.
* Activate with 'forcepause 1'
* Deactivate with 'forcepause 0'
hide / show
-----------
Hides or shows the DFHack terminal window, respectively. To use ``show``, use
the in-game console (default keybinding Ctrl-Shift-P). Only available on Windows.
nopause
-------
Disables pausing (both manual and automatic) with the exception of pause forced
@ -640,6 +645,39 @@ Options:
:show X: Marks the selected map feature as discovered.
:hide X: Marks the selected map feature as undiscovered.
fortplan
--------
Usage: fortplan [filename]
Designates furniture for building according to a .csv file with
quickfort-style syntax. Companion to digfort.
The first line of the file must contain the following::
#build start(X; Y; <start location description>)
...where X and Y are the offset from the top-left corner of the file's area
where the in-game cursor should be located, and <start location description>
is an optional description of where that is. You may also leave a description
of the contents of the file itself following the closing parenthesis on the
same line.
The syntax of the file itself is similar to digfort or quickfort. At present,
only buildings constructed of an item with the same name as the building
are supported. All other characters are ignored. For example::
`,`,d,`,`
`,f,`,t,`
`,s,b,c,`
This section of a file would designate for construction a door and some
furniture inside a bedroom: specifically, clockwise from top left, a cabinet,
a table, a chair, a bed, and a statue.
All of the building designation uses Planning Mode, so you do not need to
have the items available to construct all the buildings when you run
fortplan with the .csv file.
infiniteSky
-----------
Automatically allocates new z-levels of sky at the top of the map as you build up, or on request allocates many levels all at once.
@ -2115,6 +2153,7 @@ Advanced usage:
:`autolabor reset-all`: Return all labors to the default handling.
:`autolabor list`: List current status of all labors.
:`autolabor status`: Show basic status information.
:`autolabor-artisans <command>`: Run a command for labors where skill affects output quality
*Examples:*
@ -2246,6 +2285,11 @@ scripts that are obscure, developer-oriented, or should be used as keybindings.
The following scripts are distibuted with DFHack:
devel/*
=======
Scripts in this subdirectory are intended for developers, or still substantially
under development. If you don't already know what they do, best to leave them alone.
fix/*
=====
Scripts in this subdirectory fix various bugs and issues, some of them obscure.
@ -2260,19 +2304,17 @@ Scripts in this subdirectory fix various bugs and issues, some of them obscure.
on the same exact tile (bug 5991), designates the tile restricted traffic to
hopefully avoid jamming it again, and unsuspends them.
* fix/cloth-stockpile
Fixes erratic behavior of cloth stockpiles by scanning material objects
in memory and patching up some invalid reference fields. Needs to be run
every time a save game is loaded; putting ``fix/cloth-stockpile enable``
in ``dfhack.init`` makes it run automatically.
* fix/dead-units
Removes uninteresting dead units from the unit list. Doesn't seem to give any
noticeable performance gain, but migrants normally stop if the unit list grows
to around 3000 units, and this script reduces it back.
* fix/fat-dwarves
Avoids 5-10% FPS loss due to constant recalculation of insulation for dwarves at
maximum fatness, by reducing the cap from 1,000,000 to 999,999.
* fix/feeding-timers
Reset the GiveWater and GiveFood timers of all units as appropriate.
@ -2287,6 +2329,10 @@ Scripts in this subdirectory fix various bugs and issues, some of them obscure.
Diagnoses and fixes issues with nonexistant 'items occupying site', usually
caused by autodump bugs or other hacking mishaps.
* fix/loyaltycascade
Aborts loyalty cascades by fixing units whose own civ is the enemy.
* fix/population-cap
Run this after every migrant wave to ensure your population cap is not exceeded.
@ -2300,6 +2346,11 @@ Scripts in this subdirectory fix various bugs and issues, some of them obscure.
the environment and stops temperature updates. In order to maintain this efficient
state however, use ``tweak stable-temp`` and ``tweak fast-heat``.
* fix/stuckdoors
Fix doors that are stuck open due to incorrect map occupancy flags, eg due to
incorrect use of teleport.
gui/*
=====
@ -2310,6 +2361,10 @@ directory.
A graphical interface for creating items.
* gui/dfstatus
Show a quick overview of critical stock quantities, including food, drinks, wood, and various bars.
* gui/stockpiles
Load and save stockpile settings from the 'q' menu.
@ -2323,6 +2378,40 @@ directory.
Don't forget to `enable stockpiles` and create the `stocksettings` directory in
the DF folder before trying to use this plugin.
adaptation
==========
View or set level of cavern adaptation for the selected unit or the whole fort.
Usage: ``adaptation <show|set> <him|all> [value]``. The ``value`` must be
between 0 and 800,000 inclusive.
add-thought
===========
Adds a thought or emotion to the selected unit. Can be used by other scripts,
or the gui invoked by running ``add-thought gui`` with a unit selected.
autofarm
========
Automatically handle crop selection in farm plots based on current plant stocks.
Selects a crop for planting if current stock is below a threshold.
Selected crops are dispatched on all farmplots.
Usage::
autofarm start
autofarm default 30
autofarm threshold 150 helmet_plump tail_pig
autounsuspend
=============
Automatically unsuspend construction jobs, on a recurring basis.
See ``unsuspend`` for one-off use, or ``resume all``.
ban-cooking
===========
A more convenient way to ban cooking various categories of foods than the
kitchen interface. Usage: ``ban-cooking <type>``. Valid types are ``booze``,
``honey``, ``tallow``, ``oil``, and ``seeds`` (non-tree plants with seeds).
binpatch
========
Checks, applies or removes binary patches directly in memory at runtime::
@ -2365,6 +2454,12 @@ Examples::
create-items bar CREATURE:CAT:SOAP
create-items bar adamantine
deathcause
==========
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``) unitlist viewscreen.
digfort
=======
A script to designate an area for digging according to a plan in csv format.
@ -2395,16 +2490,6 @@ drain-aquifer
=============
Remove all 'aquifer' tag from the map blocks. Irreversible.
deathcause
==========
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``) unitlist viewscreen.
dfstatus
========
Show a quick overview of critical stock quantities, including food, drinks, wood, and various bars.
exterminate
===========
Kills any unit of a given race.
@ -2444,6 +2529,10 @@ To purify all elves on the map with fire (may have side-effects)::
exterminate elve magma
fixnaked
========
Removes all unhappy thoughts due to lack of clothing.
fix-ster
========
Utilizes the orientation tag to either fix infertile creatures or inflict
@ -2456,38 +2545,20 @@ or sterile. Optional arguments specify the target: no argument for the
selected unit, ``all`` for all units on the map, ``animals`` for all non-dwarf
creatures, or ``only:<creature>`` to only process matching creatures.
fortplan
========
Usage: fortplan [filename]
Designates furniture for building according to a .csv file with
quickfort-style syntax. Companion to digfort.
The first line of the file must contain the following::
#build start(X; Y; <start location description>)
...where X and Y are the offset from the top-left corner of the file's area
where the in-game cursor should be located, and <start location description>
is an optional description of where that is. You may also leave a description
of the contents of the file itself following the closing parenthesis on the
same line.
The syntax of the file itself is similar to digfort or quickfort. At present,
only buildings constructed of an item with the same name as the building
are supported. All other characters are ignored. For example::
`,`,d,`,`
`,f,`,t,`
`,s,b,c,`
forum-dwarves
=============
Saves a copy of a text screen, formatted in bbcode for posting to the Bay12 Forums.
Use ``forum-dwarves help`` for more information.
This section of a file would designate for construction a door and some
furniture inside a bedroom: specifically, clockwise from top left, a cabinet,
a table, a chair, a bed, and a statue.
full-heal
=========
Attempts to fully heal the selected unit. ``full-heal -r`` attempts to resurrect the unit.
All of the building designation uses Planning Mode, so you do not need to
have the items available to construct all the buildings when you run
fortplan with the .csv file.
gaydar
======
Shows the sexual orientation of units, useful for social engineering or checking
the viability of livestock breeding programs. Use ``gaydar -help`` for information
on available filters for orientation, citizenship, species, etc.
growcrops
=========
@ -2571,6 +2642,15 @@ There are the following ways to invoke this command:
Parses and executes the lua statement like the interactive interpreter would.
make-monarch
============
Make the selected unit King or Queen of your civilisation.
markdown
========
Save a copy of a text screen in markdown (for reddit among others).
Use 'markdown help' for more details.
masspit
=======
Designate all creatures in cages on top of a pit/pond activity zone for pitting.
@ -2582,13 +2662,19 @@ or with the game cursor on top of the area.
multicmd
========
Run multiple dfhack commands. The argument is split around the
character ; and all parts are run sequencially as independent
character ; and all parts are run sequentially as independent
dfhack commands. Useful for hotkeys.
Example::
multicmd locate-ore iron ; digv
points
======
Sets available points at the embark screen to the specified number. Eg.
``points 1000000`` would allow you to buy everything, or ``points 0`` would
make life quite difficult.
position
========
Reports the current time: date, clock time, month, and season. Also reports
@ -2604,15 +2690,52 @@ quicksave
If called in dwarf mode, makes DF immediately auto-save the game by setting a flag
normally used in seasonal auto-save.
region-pops
===========
Show or modify the populations of animals in the region. Use ``region-pops`` for details.
remove-stress
=============
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 "remove-stress -all" to apply to all units.
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 "remove-stress -all" to apply to all units.
remove-wear
===========
Sets the wear on all items in your fort to zero.
repeat
======
Repeatedly calls a lua script at the specified interval.
This allows neat background changes to the function of the game, especially when
invoked from an init file. For detailed usage instructions, use ``repeat -help``.
Usage examples::
repeat -name jim -time delay -timeUnits units -printResult true -command [ printArgs 3 1 2 ]
repeat -time 1 -timeUnits months -command [ multicmd cleanowned scattered x; clean all ] -name clean
The first example is abstract; the second will regularly remove all contaminants
and worn items from the game.
``-name`` sets the name for the purposes of cancelling and making sure you don't schedule the
same repeating event twice. If not specified, it's set to the first argument after ``-command``.
``-time delay -timeUnits units``; delay is some positive integer, and units is some valid time
unit for ``dfhack.timeout(delay,timeUnits,function)``. ``-command [ ... ]`` specifies the
command to be run.
setfps
======
Run ``setfps <number>`` to set the FPS cap at runtime, in case you want to watch
combat in slow motion or something :)
show-unit-syndromes
===================
Show syndromes affecting units and the remaining and maximum duration, along
with (optionally) substantial detail on the effects. Call
``show-unit-syndromes help`` for further options.
siren
=====
Wakes up sleeping units, cancels breaks and stops parties either everywhere,
@ -2658,17 +2781,12 @@ Ex::
source add magma 7 - magma source
source add water 0 - water drain
superdwarf
startdwarf
==========
Similar to fastdwarf, per-creature.
To make any creature superfast, target it ingame using 'v' and::
superdwarf add
Other options available: ``del``, ``clear``, ``list``.
This plugin also shortens the 'sleeping' and 'on break' periods of targets.
Use at the embark screen to embark with the specified number of dwarves. Eg.
``startdwarf 500`` would lead to a severe food shortage and FPS issues, while
``startdwarf 10`` would just allow a few more warm bodies to dig in.
The number must be 7 or greater.
stripcaged
==========
@ -2690,6 +2808,18 @@ alternatively pass cage IDs as arguments::
stripcaged weapons 25321 34228
superdwarf
==========
Similar to fastdwarf, per-creature.
To make any creature superfast, target it ingame using 'v' and::
superdwarf add
Other options available: ``del``, ``clear``, ``list``.
This plugin also shortens the 'sleeping' and 'on break' periods of targets.
teleport
========
Teleports a unit to given coordinates.
@ -2704,6 +2834,11 @@ undump-buildings
================
Undesignates building base materials for dumping.
unsuspend
=========
Unsuspend construction jobs, on a one-off basis. See ``autounsuspend`` for regular use.
Equivalent to ``resume all``.
view-item-info
==============
A script to extend the item or unit viewscreen with additional information

@ -294,4 +294,11 @@ message WorldMap
repeated int32 savagery = 12;
repeated Cloud clouds = 13;
repeated int32 salinity = 14;
optional int32 map_x = 15;
optional int32 map_y = 16;
}
message RegionMaps
{
repeated WorldMap world_maps = 1;
}

@ -41,6 +41,7 @@
#include "df/color_modifier_raw.h"
#include "df/region_map_entry.h"
#include "df/world_region_details.h"
#include "df/unit.h"
@ -90,6 +91,7 @@ static command_result ResetMapHashes(color_ostream &stream, const EmptyMessage *
static command_result GetItemList(color_ostream &stream, const EmptyMessage *in, MaterialList *out);
static command_result GetBuildingDefList(color_ostream &stream, const EmptyMessage *in, BuildingList *out);
static command_result GetWorldMap(color_ostream &stream, const EmptyMessage *in, WorldMap *out);
static command_result GetRegionMaps(color_ostream &stream, const EmptyMessage *in, RegionMaps *out);
void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock, MapExtras::MapCache * MC, DFCoord pos);
@ -139,6 +141,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("GetItemList", GetItemList);
svc->addFunction("GetBuildingDefList", GetBuildingDefList);
svc->addFunction("GetWorldMap", GetWorldMap);
svc->addFunction("GetRegionMaps", GetRegionMaps);
return svc;
}
@ -1222,3 +1225,127 @@ static command_result GetWorldMap(color_ostream &stream, const EmptyMessage *in,
}
return CR_OK;
}
static void AddAveragedRegionTiles(WorldMap * out, df::region_map_entry * e1, df::region_map_entry * e2, df::region_map_entry * e3, df::region_map_entry * e4)
{
out->add_rainfall((e1->rainfall + e2->rainfall + e3->rainfall + e4->rainfall) / 4);
out->add_vegetation((e1->vegetation + e2->vegetation + e3->vegetation + e4->vegetation) / 4);
out->add_temperature((e1->temperature + e2->temperature + e3->temperature + e4->temperature) / 4);
out->add_evilness((e1->evilness + e2->evilness + e3->evilness + e4->evilness) / 4);
out->add_drainage((e1->drainage + e2->drainage + e3->drainage + e4->drainage) / 4);
out->add_volcanism((e1->volcanism + e2->volcanism + e3->volcanism + e4->volcanism) / 4);
out->add_savagery((e1->savagery + e2->savagery + e3->savagery + e4->savagery) / 4);
out->add_salinity((e1->salinity + e2->salinity + e3->salinity + e4->salinity) / 4);
}
static void AddAveragedRegionTiles(WorldMap * out, df::region_map_entry * e1, df::region_map_entry * e2)
{
AddAveragedRegionTiles(out, e1, e1, e2, e2);
}
static void AddAveragedRegionTiles(WorldMap * out, df::region_map_entry * e1)
{
AddAveragedRegionTiles(out, e1, e1, e1, e1);
}
static void CopyLocalMap(df::world_data * worldData, df::world_region_details* worldRegionDetails, WorldMap * out)
{
int pos_x = worldRegionDetails->pos.x;
int pos_y = worldRegionDetails->pos.y;
out->set_map_x(pos_x);
out->set_map_y(pos_y);
out->set_world_width(17);
out->set_world_height(17);
char name[256];
sprintf(name, "Region %d, %d", pos_x, pos_y);
out->set_name_english(name);
out->set_name(name);
df::world_region_details * south = NULL;
df::world_region_details * east = NULL;
df::world_region_details * southEast = NULL;
for (int i = 0; i < worldData->region_details.size(); i++)
{
auto region = worldData->region_details[i];
if (region->pos.x == pos_x + 1 && region->pos.y == pos_y + 1)
southEast = region;
else if (region->pos.x == pos_x + 1 && region->pos.y == pos_y)
east = region;
else if (region->pos.x == pos_x && region->pos.y == pos_y + 1)
south = region;
}
df::region_map_entry * maps[] =
{
&worldData->region_map[pos_x][pos_y], &worldData->region_map[pos_x + 1][pos_y],
&worldData->region_map[pos_x][pos_y + 1], &worldData->region_map[pos_x + 1][pos_y + 1]
};
for (int yy = 0; yy < 17; yy++)
for (int xx = 0; xx < 17; xx++)
{
//This is because the bottom row doesn't line up.
if (xx == 16 && yy == 16 && southEast != NULL)
out->add_elevation(southEast->elevation[0][0]);
else if (xx == 16 && east != NULL)
out->add_elevation(east->elevation[0][yy]);
else if (yy == 16 && south != NULL)
out->add_elevation(south->elevation[xx][0]);
else
out->add_elevation(worldRegionDetails->elevation[xx][yy]);
switch (worldRegionDetails->biome[xx][yy])
{
case 1:
AddAveragedRegionTiles(out, maps[1]);
break;
case 2:
AddAveragedRegionTiles(out, maps[2], maps[3]);
break;
case 3:
AddAveragedRegionTiles(out, maps[3]);
break;
case 4:
AddAveragedRegionTiles(out, maps[0], maps[2]);
break;
case 5:
AddAveragedRegionTiles(out, maps[0], maps[1], maps[2], maps[3]);
break;
case 6:
AddAveragedRegionTiles(out, maps[1], maps[3]);
break;
case 7:
AddAveragedRegionTiles(out, maps[0]);
break;
case 8:
AddAveragedRegionTiles(out, maps[0], maps[1]);
break;
case 9:
AddAveragedRegionTiles(out, maps[2]);
break;
default:
AddAveragedRegionTiles(out, maps[0], maps[1], maps[2], maps[3]);
break;
}
}
}
static command_result GetRegionMaps(color_ostream &stream, const EmptyMessage *in, RegionMaps *out)
{
if (!df::global::world->world_data)
{
return CR_FAILURE;
}
df::world_data * data = df::global::world->world_data;
for (int i = 0; i < data->region_details.size(); i++)
{
df::world_region_details * region = data->region_details[i];
if (!region)
continue;
WorldMap * regionMap = out->add_world_maps();
CopyLocalMap(data, region, regionMap);
}
return CR_OK;
}

@ -1,3 +1,5 @@
# un-suspend construction jobs, on a recurring basis
class AutoUnsuspend
attr_accessor :running

@ -1,3 +1,5 @@
# convenient way to ban cooking categories of food
already_banned = {}
kitchen = df.ui.kitchen
kitchen.item_types.length.times { |i|
@ -84,5 +86,3 @@ $script_args.each do |arg|
puts "ban-cooking seeds - bans cooking of plants that have seeds (tree seeds don't count)"
end
end
# vim: et:sw=4:ts=4

@ -564,7 +564,8 @@ function export_site_maps()
end
-- main()
if dfhack.gui.getCurFocus() == "legends" then
if dfhack.gui.getCurFocus() == "legends" or dfhack.gui.getCurFocus() == "dfhack/lua/legends" then
-- either native legends mode, or using the open-legends.lua script
if args[1] == "all" then
export_legends_info()
export_site_maps()

@ -1,3 +1,5 @@
--removes unhappy thoughts due to lack of clothing
function fixnaked()
local total_fixed = 0
local total_removed = 0

@ -0,0 +1,3 @@
-- by Meph
-- http://www.bay12forums.com/smf/index.php?topic=135506.msg4925005#msg4925005
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)

@ -1,3 +1,6 @@
# un-suspend construction jobs, one time only
# same as "resume all"
joblist = df.world.job_list.next
count = 0