Skip to content

Commit 2fd6373

Browse files
committed
Merge branch 'develop' into HEAD
2 parents 8eede51 + 7e779f1 commit 2fd6373

29 files changed

+1012
-104
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44
repos:
55
# shared across repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-case-conflict
@@ -20,7 +20,7 @@ repos:
2020
args: ['--fix=lf']
2121
- id: trailing-whitespace
2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.29.2
23+
rev: 0.29.3
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks

docs/about/Removed.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ max-wave
283283
========
284284
Set population cap based on parameters. Merged into `pop-control`.
285285

286+
.. _modtools/force:
287+
288+
modtools/force
289+
==============
290+
Merged into `force`.
291+
286292
.. _mousequery:
287293

288294
mousequery

docs/changelog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Template for new versions:
5858

5959
## Fixes
6060
- Fix mouse clicks bleeding through DFHack windows when clicking in the space between the frame and the window content in resizable windows
61+
- `autobutcher`: don't run a scanning and marking cycle on the first tick of a fortress to allow for all custom configuration to be set first
62+
- `nestboxes`: don't consider eggs to be infertile just because the mother has left the nest; eggs can still hatch in this situation
63+
- `timestream`: adjust the incubation counter on fertile eggs so they hatch at the expected time
64+
- `logistics`: don't ignore rotten items when applying stockpile logistics operations (e.g. autodump, autoclaim, etc.)
6165

6266
## Misc Improvements
6367
- DFHack text edit fields now delete the character at the cursor when you hit the Delete key
@@ -66,6 +70,8 @@ Template for new versions:
6670
- Quickfort blueprint library: ``aquifer_tap`` blueprint walkthough rewritten for clarity
6771
- Quickfort blueprint library: ``aquifer_tap`` blueprint now designated at priority 3 and marks the stairway tile below the tap in "blueprint" mode to prevent drips while the drainage pipe is being prepared
6872
- `preserve-rooms`: automatically release room reservations for captured squad members. we were kidding ourselves with our optimistic kept reservations. they're unlikely to come back : ((
73+
- `buildingplan`: add value info to item selection dialog (effectively ungrouping items with different values) and add sorting by value
74+
- `timestream`: reduce CPU utilization
6975

7076
## Documentation
7177
- Dreamfort: add link to Dreamfort tutorial youtube series: https://www.youtube.com/playlist?list=PLzXx9JcB9oXxmrtkO1y8ZXzBCFEZrKxve
@@ -74,12 +80,14 @@ Template for new versions:
7480
## API
7581

7682
- ``DFHack::Units``: new function ``setPathGoal``
83+
- ``Units::setAutomaticProfessions``: bay12-provided entry point to assign labors based on work details
7784

7885
## Lua
7986

8087
- ``dfhack.units``: new function ``setPathGoal``
8188

8289
## Removed
90+
- UI focus strings for squad panel flows combined into a single tree: ``dwarfmode/SquadEquipment`` -> ``dwarfmode/Squads/Equipment``, ``dwarfmode/SquadSchedule`` -> ``dwarfmode/Squads/Schedule``
8391

8492
# 50.14-r1
8593

docs/dev/Lua API.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ All types and the global object have the following features:
315315

316316
All compound types (structs, classes, unions, and the global object) support:
317317

318+
* ``type._union``
319+
320+
``true`` if the type represents a union, otherwise ``nil``.
321+
318322
* ``type._fields``
319323

320324
Contains a table mapping field names to descriptions of the type's fields,
@@ -947,7 +951,7 @@ can be omitted.
947951

948952
* ``dfhack.TranslateName(name[,in_english[,only_last_name]])``
949953

950-
Convert a language_name or only the last name part to string.
954+
Convert a ``df.language_name`` (or only the last name part) to string.
951955

952956
* ``dfhack.df2utf(string)``
953957

docs/plugins/autobutcher.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ autobutcher
77

88
This plugin monitors how many pets you have of each gender and age and assigns
99
excess livestock for slaughter. See `gui/autobutcher` for an in-game interface.
10+
Common configuration tweaks can be enabled in `gui/control-panel` in the
11+
Automation -> Autostart tab.
12+
1013
Units are protected from being automatically butchered if they are:
1114

1215
* Untamed
@@ -34,10 +37,7 @@ Usage
3437
-----
3538

3639
``enable autobutcher``
37-
Start processing livestock according to the configuration. Note that
38-
no races are watched by default. You have to add the ones you want to
39-
monitor with ``autobutcher watch``, ``autobutcher target`` or
40-
``autobutcher autowatch``.
40+
Start processing livestock according to the per-race targets.
4141
``autobutcher [list]``
4242
Print status and current settings, including the watchlist. This is the
4343
default command if autobutcher is run without parameters.
@@ -91,8 +91,8 @@ Though not all the races listed there are tameable/butcherable.
9191
savegame, you can export the commands required to recreate your settings.
9292

9393
To export, open an external terminal in the DF directory, and run
94-
``dfhack-run autobutcher list_export > filename.txt``. To import, load your
95-
new save and run ``script filename.txt`` in the DFHack terminal.
94+
``dfhack-run autobutcher list_export > autobutcher.txt``. To import, load
95+
your new save and run ``script autobutcher.txt`` in `gui/launcher`.
9696

9797
Examples
9898
--------

docs/plugins/timestream.rst

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
timestream
2+
==========
3+
4+
.. dfhack-tool::
5+
:summary: Fix FPS death.
6+
:tags: fort gameplay fps
7+
8+
Do you remember when you first start a new fort, your initial 7 dwarves zip
9+
around the screen and get things done so quickly? As a player, you never had
10+
to wait for your initial dwarves to move across the map. Do you wish that your
11+
fort of 200 dwarves and 800 animals could be as zippy? This tool can help.
12+
13+
``timestream`` keeps the game running quickly by tweaking the game simulation
14+
according to the frames per second that your computer can support. This means
15+
that your dwarves spend the same amount of time relative to the in-game
16+
calendar to do their tasks, but the time that you, the player, have to wait for
17+
the dwarves to do get things done is reduced. The result is that the dwarves in
18+
your fully developed fort appear as energetic as the dwarves in a newly created
19+
fort, and mature forts are much more fun to play.
20+
21+
Note that whereas your dwarves zip around like you're running at 100 FPS, the
22+
vanilla onscreen FPS counter, if enabled, will still show a lower number. See
23+
the `Technical details`_ section below if you're interested in what's going on
24+
under the hood.
25+
26+
Usage
27+
-----
28+
29+
::
30+
31+
enable timestream
32+
timestream [status]
33+
timestream set <key> <value>
34+
timestream reset
35+
36+
Examples
37+
--------
38+
39+
``enable timestream``
40+
Start adjusting the simulation to run at the currently configured apparent
41+
FPS (default is whatever you have the FPS cap set to in the DF settings,
42+
which is usually 100).
43+
44+
``timestream set fps 50``
45+
Tweak the simulation so it runs at an apparent 50 frames per second.
46+
47+
``timestream reset``
48+
Reset settings to defaults: the vanilla FPS cap with no calendar speed
49+
advantage or disadvantage.
50+
51+
Settings
52+
--------
53+
54+
:fps: Set the target simulated FPS. The default target FPS is whatever you have
55+
the FPS cap set to in the DF settings, and the minimum is 10. Setting the
56+
target FPS *below* your current actual FPS will have no effect. You have
57+
to set the vanilla FPS cap for that. Set a target FPS of -1 to make no
58+
adjustment at all to the apparent FPS of the game.
59+
60+
Technical details
61+
-----------------
62+
63+
So what is this magic? How does this tool make it look like the game is
64+
suddenly running so much faster?
65+
66+
Maybe an analogy would help. Pretend you're standing at the bottom of a
67+
staircase and you want to walk up the stairs. You can walk up one stair every
68+
second, and there are 100 stairs, so it will take you 100 seconds to walk up
69+
all the stairs.
70+
71+
Now let's use the Hand of Armok and fiddle with reality a bit. Let's say that
72+
instead of walking up one step, you walk up 5 steps at once. At the same time
73+
we move the wall clock 5 seconds ahead. If you look at the clock after reaching
74+
the top of the stairs, it will still look like it took 100 seconds, but you did
75+
it all in fewer "steps".
76+
77+
That's essentially what ``timestream`` is doing to the game. All "actions" in
78+
DF have counters associated with them. For example, when a dwarf wants to walk
79+
to the next tile, a counter is initialized to 8. Every "tick" of the game (the
80+
"frame" in FPS) decrements that counter by 1. When the counter gets to zero,
81+
the dwarf appears on the next tile.
82+
83+
When ``timestream`` is active, it monitors all those counters and makes them
84+
decrement more per tick. It then balances things out by proportionally
85+
advancing the in-game calendar. Therefore, more "happens" per step, and DF has
86+
to simulate fewer "steps" for the same amount of work to get done.
87+
88+
The cost of this simplification is that the world becomes less "smooth". As the
89+
discrepancy between the actual and simulated FPS grows, more and more dwarves
90+
will move to their next tiles at *exactly* the same time. Moreover, the rate of
91+
action completion per unit is effectively capped at the granularity of the
92+
simulation, so very fast units (say, those in a martial trance) will lose some
93+
of their advantage.
94+
95+
Limitations
96+
-----------
97+
98+
DF does critial game tasks every 10 calendar ticks that must not be skipped, so
99+
`timestream` cannot advance more than 9 ticks at a time. This puts an upper
100+
limit on how much `timestream` can help. With the default target of 100 FPS,
101+
the game will start showing signs of slowdown if the real FPS drops below about
102+
15. The interface will also become less responsive to mouse gestures as the
103+
real FPS drops.
104+
105+
Finally, not all aspects of the game are perfectly adjusted. For example,
106+
armies on world map will move at the same (real-time) rate regardless of
107+
changes that ``timestream`` is making to the calendar.
108+
109+
Here is a (possibly incomplete) list of game elements that are not adjusted by
110+
``timestream`` and will appear "slow" in-game:
111+
112+
- Army movement across the world map (including raids sent out from the fort)
113+
- Liquid movement and evaporation

library/LuaWrapper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,8 +1638,11 @@ static void RenderType(lua_State *state, const compound_identity *node)
16381638

16391639
switch (node->type())
16401640
{
1641-
case IDTYPE_STRUCT:
16421641
case IDTYPE_UNION: // TODO: change this to union-type? what relies on this?
1642+
lua_pushboolean(state, true);
1643+
lua_setfield(state, ftable, "_union");
1644+
// fall through
1645+
case IDTYPE_STRUCT:
16431646
lua_pushstring(state, "struct-type");
16441647
lua_setfield(state, ftable, "_kind");
16451648
IndexStatics(state, ix_meta, ftable, (struct_identity*)node);

library/include/modules/Translation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ DFHACK_EXPORT void setNickname(df::language_name *name, std::string nick);
5656
DFHACK_EXPORT std::string capitalize(const std::string &str, bool all_words = false);
5757

5858
// translate a name using the loaded dictionaries
59-
DFHACK_EXPORT std::string TranslateName (const df::language_name * name, bool inEnglish = true,
59+
DFHACK_EXPORT std::string TranslateName (const df::language_name * name, bool inEnglish = false,
6060
bool onlyLastPart = false);
6161
}
6262
}

library/include/modules/Units.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ DFHACK_EXPORT bool unassignTrainer(df::unit *unit);
239239
/// to determine if the makeown operation was successful.
240240
DFHACK_EXPORT void makeown(df::unit *unit);
241241

242+
/// set appropriate labors on a unit based on current work detail settings
243+
/// (uses Bay12-provided algorithm)
244+
DFHACK_EXPORT void setAutomaticProfessions(df::unit* unit);
245+
242246
// Set the units target location and goal, clearing any existing goal or path
243247
DFHACK_EXPORT void setPathGoal(df::unit *unit, df::coord pos, df::unit_path_goal goal);
244248

0 commit comments

Comments
 (0)