Skip to content

Commit 5f3874b

Browse files
authored
Merge branch 'develop' into adv_cursor
2 parents 19b613f + 82c6551 commit 5f3874b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+763
-401
lines changed

depends/dfhooks

docs/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ Template for new versions:
6666

6767
## Misc Improvements
6868
- `spectate`: player-set configuration is now stored globally instead of per-fort
69+
- `autobutcher`: treat animals on restraints as unavailable for slaughter
6970

7071
## Documentation
7172
- `stonesense-art-guide`: new guide for making sprite art for Stonesense
7273

7374
## API
75+
- ``Military::removeFromSquad``: removes unit from any squad assignments
7476

7577
## Lua
7678
- ``dfhack.units.setAutomaticProfessions``: sets unit labors according to current work detail settings
79+
- ``dfhack.military.removeFromSquad``: Lua API for ``Military::removeFromSquad``
7780

7881
## Removed
7982

docs/dev/Lua API.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,14 @@ Military module
19861986

19871987
Returns the name of a squad as a string.
19881988

1989+
* ``dfhack.military.removeFromSquad(unit_id)``
1990+
1991+
Removes a unit from its squad. Unsets the unit's
1992+
military information (i.e., ``unit.military.squad_id`` and
1993+
``unit.military.squad_pos``), the squad's position information (i.e.,
1994+
``squad.positions[squad_pos].occupant``), and modifies the unit's entity links
1995+
to indicate former squad membership or command.
1996+
19891997
Items module
19901998
------------
19911999

docs/plugins/autobutcher.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Units are protected from being automatically butchered if they are:
1515
* Untamed
1616
* Named or nicknamed
1717
* Caged, if and only if the cage is in a zone (to protect zoos)
18+
* On a restraint
1819
* Trained for war or hunting
1920
* Females who are pregnant or brooding a clutch of fertile eggs
2021

docs/plugins/spectate.rst

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ to following a different dwarf. It can also switch to following animals,
1313
hostiles, or visiting units. You can switch to the next target (or a previous
1414
target) immediately with the left/right arrow keys.
1515

16-
`spectate` will disengage and turn itself off when you move the map, just like
17-
the vanilla follow mechanic. It will also disengage immediately if you open the
18-
squads menu for military action.
16+
By default, `spectate` will disengage and turn itself off when you move the
17+
map, just like the vanilla follow mechanic. It will also disengage immediately
18+
if you open the squads menu for military action.
1919

2020
It can also annotate your dwarves on the map with their name, job, and other
2121
information, either as floating tooltips or in a panel that comes up when you
@@ -37,7 +37,7 @@ Usage
3737
spectate [status]
3838
spectate toggle
3939
spectate set <setting> <value>
40-
spectate overlay <name> enable|disable
40+
spectate overlay enable|disable
4141

4242
Examples
4343
--------
@@ -59,16 +59,18 @@ Examples
5959
``spectate set follow-seconds 30``
6060
Configure `spectate` to switch targets every 30 seconds when in follow mode.
6161

62-
``spectate overlay follow enable``
63-
Show informative tooltips that follow each unit on the map.
62+
``spectate overlay enable``
63+
Show informative tooltips that follow each unit on the map. Note that this
64+
can be enabled independently of `spectate` itself.
6465

6566
Settings
6667
--------
6768

6869
``auto-disengage`` (default: enabled)
6970
Toggle automatically disabling the plugin when the player moves the map or
7071
opens the squad panel. If this is disabled, you will need to manually
71-
disable the plugin to turn off follow mode.
72+
disable the plugin to turn off follow mode. You can still interact normally
73+
with the DF UI.
7274

7375
``auto-unpause`` (default: disabled)
7476
Toggle auto-dismissal of announcements that pause the game, like sieges,
@@ -82,7 +84,7 @@ Settings
8284
include time that the game is paused.
8385

8486
``include-animals`` (default: disabled)
85-
Toggle whether to sometimes follow fort animals.
87+
Toggle whether to sometimes follow fort animals and wildlife.
8688

8789
``include-hostiles`` (default: disabled)
8890
Toggle whether to sometimes follow hostiles (eg. undead, titans, invaders,
@@ -102,47 +104,36 @@ Settings
102104
arrived on the map.
103105

104106
``tooltip-follow-job`` (default: enabled)
105-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
107+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
106108
job of the dwarf in the tooltip.
107109

108110
``tooltip-follow-name`` (default: enabled)
109-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
111+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
110112
name of the dwarf in the tooltip.
111113

112114
``tooltip-follow-stress`` (default: enabled)
113-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
115+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
114116
happiness level (stress) of the dwarf in the tooltip.
115117

116118
``tooltip-hover-job`` (default: enabled)
117-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
119+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
118120
job of the dwarf in the hover panel.
119121

120122
``tooltip-hover-name`` (default: enabled)
121-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
123+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
122124
name of the dwarf in the hover panel.
123125

124126
``tooltip-hover-stress`` (default: enabled)
125-
If the ``spectate.follow`` overlay is enabled, toggle whether to show the
127+
If the ``spectate.tooltip`` overlay is enabled, toggle whether to show the
126128
happiness level (stress) of the dwarf in the hover panel.
127129

128130
Overlays
129131
--------
130132

131-
``spectate`` provides two overlays via the `overlay` framework to add
132-
information and functionality to the main map. These overlays can be controlled
133-
via the ``spectate overlay`` command or the ``Overlays`` tab in
134-
`gui/control-panel`.
133+
``spectate.tooltip``
135134

136-
The information displayed by these overlays can be configured via the
137-
``spectate set`` command or the `gui/spectate` interface.
135+
``spectate`` can show informative tooltips that follow each unit on the map
136+
and/or a popup panel with information when your mouse cursor hovers over a unit.
138137

139-
``spectate.follow``
140-
Show informative tooltips that follow each unit on the map. You can enable
141-
this overlay by running ``spectate overlay follow enable`` or,
142-
equivalently, ``overlay enable spectate.follow``.
143-
144-
``spectate.hover``
145-
Show a popup panel with selected information when your mouse cursor hovers
146-
over a unit. You can enable this overlay by running
147-
``spectate overlay hover enable`` or, equivalently,
148-
``overlay enable spectate.hover``.
138+
This overlay is managed via the `overlay` framework. It can be controlled via
139+
the ``spectate overlay`` command or the ``Overlays`` tab in `gui/control-panel`.

library/LuaApi.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ distribution.
9999
#include "df/report_zoom_type.h"
100100
#include "df/specific_ref.h"
101101
#include "df/specific_ref_type.h"
102+
#include "df/squad_use_flags.h"
102103
#include "df/squad.h"
103104
#include "df/unit.h"
104105
#include "df/unit_misc_trait.h"
@@ -2341,6 +2342,7 @@ static const LuaWrapper::FunctionReg dfhack_military_module[] = {
23412342
WRAPM(Military, makeSquad),
23422343
WRAPM(Military, updateRoomAssignments),
23432344
WRAPM(Military, getSquadName),
2345+
WRAPM(Military, removeFromSquad),
23442346
{ NULL, NULL }
23452347
};
23462348

@@ -2442,7 +2444,7 @@ static int items_moveToBuilding(lua_State *state)
24422444
static int items_moveToInventory(lua_State *state) {
24432445
auto item = Lua::CheckDFObject<df::item>(state, 1);
24442446
auto unit = Lua::CheckDFObject<df::unit>(state, 2);
2445-
auto use_mode = (df::unit_inventory_item::T_mode)luaL_optint(state, 3, 0);
2447+
auto use_mode = (df::inv_item_role_type)luaL_optint(state, 3, 0);
24462448
int body_part = luaL_optint(state, 4, -1);
24472449
lua_pushboolean(state, Items::moveToInventory(item, unit, use_mode, body_part));
24482450
return 1;
@@ -2815,7 +2817,7 @@ int buildings_setSize(lua_State *state)
28152817
lua_pushinteger(state, size.x);
28162818
lua_pushinteger(state, size.y);
28172819
lua_pushinteger(state, area);
2818-
lua_pushinteger(state, Buildings::countExtentTiles(&bld->room, area));
2820+
lua_pushinteger(state, Buildings::countExtentTiles(bld, area));
28192821
return 5;
28202822
}
28212823
else

library/RemoteTools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static command_result ListEnums(color_ostream &stream,
458458
BITFIELD(cie_add_tag_mask1);
459459
BITFIELD(cie_add_tag_mask2);
460460

461-
describe_bitfield<df::incident::T_flags>(out->mutable_death_info_flags());
461+
describe_bitfield<df::incident_flag>(out->mutable_death_info_flags());
462462

463463
ENUM(profession);
464464

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
friend struct world_raws;
1+
friend struct world;

library/include/modules/Buildings.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ namespace df {
4444
struct building;
4545
struct building_cagest;
4646
struct building_civzonest;
47-
struct building_extents;
4847
struct building_stockpilest;
4948
struct item;
5049
struct job_item;
@@ -112,7 +111,7 @@ DFHACK_EXPORT bool getCorrectSize(df::coord2d &size, df::coord2d &center,
112111
* Checks if the tiles are free to be built upon.
113112
*/
114113
DFHACK_EXPORT bool checkFreeTiles(df::coord pos, df::coord2d size,
115-
df::building_extents *ext = NULL,
114+
df::building *bld,
116115
bool create_ext = false,
117116
bool allow_occupied = false,
118117
bool allow_wall = false,
@@ -121,7 +120,7 @@ DFHACK_EXPORT bool checkFreeTiles(df::coord pos, df::coord2d size,
121120
/**
122121
* Returns the number of tiles included by the extent, or defval.
123122
*/
124-
DFHACK_EXPORT int countExtentTiles(df::building_extents *ext, int defval = -1);
123+
DFHACK_EXPORT int countExtentTiles(df::building *bld, int defval = -1);
125124

126125
/**
127126
* Checks if the building contains the specified tile. If the building has

library/include/modules/Items.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ DFHACK_EXPORT bool moveToContainer(df::item *item, df::item *container);
157157
DFHACK_EXPORT bool moveToBuilding(df::item *item, df::building_actual *building,
158158
df::building_item_role_type use_mode = df::building_item_role_type::TEMP, bool force_in_building = false);
159159
DFHACK_EXPORT bool moveToInventory(df::item *item, df::unit *unit,
160-
df::unit_inventory_item::T_mode mode = df::unit_inventory_item::Hauled, int body_part = -1);
160+
df::inv_item_role_type mode = df::inv_item_role_type::Hauled, int body_part = -1);
161161

162162
/// Remove item from jobs and inventories, hide and forbid.
163163
/// Unless no_uncat, item is marked for garbage collection.

library/include/modules/Job.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ namespace DFHack
105105
DFHACK_EXPORT bool listNewlyCreated(std::vector<df::job*> *pvec, int *id_var);
106106

107107
DFHACK_EXPORT bool attachJobItem(df::job *job, df::item *item,
108-
df::job_item_ref::T_role role,
108+
df::job_role_type role,
109109
int filter_idx = -1, int insert_idx = -1);
110110

111111
DFHACK_EXPORT bool isSuitableItem(const df::job_item *item, df::item_type itype, int isubtype);

library/include/modules/MapCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class BlockInfo
8484
};
8585
static GroundType getGroundType(int material);
8686

87-
typedef df::block_square_event_mineralst::T_flags DFVeinFlags;
87+
typedef df::mineral_event_flag DFVeinFlags;
8888

8989
t_veintype veintype;
9090
t_blockmaterials veinmats;

library/include/modules/Military.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Military
1717
DFHACK_EXPORT std::string getSquadName(int32_t squad_id);
1818
DFHACK_EXPORT df::squad* makeSquad(int32_t assignment_id);
1919
DFHACK_EXPORT void updateRoomAssignments(int32_t squad_id, int32_t civzone_id, df::squad_use_flags flags);
20+
DFHACK_EXPORT bool removeFromSquad(int32_t unit_id);
2021

2122
}
2223
}

library/lua/custom-raw-tokens.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ local function getTokenArg1Else(userdata, token)
300300
elseif df.is_instance(df.building_workshopst, userdata) or df.is_instance(df.building_furnacest, userdata) then
301301
rawStruct = df.building_def.find(userdata.custom_type)
302302
elseif df.is_instance(df.interaction_instance, userdata) then
303-
rawStruct = df.global.world.raws.interactions[userdata.interaction_id]
303+
rawStruct = df.global.world.raws.interactions.all[userdata.interaction_id]
304304
else
305305
-- Assume raw struct *is* argument 1
306306
rawStruct = userdata

library/lua/dfhack/workshops.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ local function addReactionJobs(ret,bid,wid,cid)
509509
end
510510
local function scanRawsOres()
511511
local ret={}
512-
for idx,ore in ipairs(df.global.world.raws.inorganics) do
512+
for idx,ore in ipairs(df.global.world.raws.inorganics.all) do
513513
if #ore.metal_ore.mat_index~=0 then
514514
ret[idx]=ore
515515
end

library/lua/gui/dwarfmode.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ end
268268

269269
function get_hotkey_target(key)
270270
local hk = HOTKEY_KEYS[key]
271-
if hk and hk.cmd == df.ui_hotkey.T_cmd.Zoom then
271+
if hk and hk.cmd == df.hotkey_type.Zoom then
272272
return xyz2pos(hk.x, hk.y, hk.z)
273273
end
274274
end

library/lua/gui/materials.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ end
116116
function MaterialDialog:initInorganicMode()
117117
local choices = {}
118118

119-
for i,mat in ipairs(df.global.world.raws.inorganics) do
119+
for i,mat in ipairs(df.global.world.raws.inorganics.all) do
120120
self:addMaterial(choices, mat.material, 0, i, false, mat)
121121
end
122122

@@ -378,14 +378,14 @@ function ItemTraitsDialog(args)
378378
end
379379
--------------------------------------
380380
local set_ore_ix = {}
381-
for i, raw in ipairs(df.global.world.raws.inorganics) do
381+
for i, raw in ipairs(df.global.world.raws.inorganics.all) do
382382
for _, ix in ipairs(raw.metal_ore.mat_index) do
383383
set_ore_ix[ix] = true
384384
end
385385
end
386386
local ores = {}
387387
for ix in pairs(set_ore_ix) do
388-
local raw = df.global.world.raws.inorganics[ix]
388+
local raw = df.global.world.raws.inorganics.all[ix]
389389
ores[#ores+1] = {mat_index = ix, name = raw.material.state_name.Solid}
390390
end
391391
table.sort(ores, function(a,b) return a.name < b.name end)

library/lua/syndrome-util.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function infectWithSyndrome(target,syndrome,resetPolicy)
9898
unitSyndrome.ticks = 0
9999
unitSyndrome.wound_id = -1
100100
for k,v in ipairs(syndrome.ce) do
101-
local symptom = df.unit_syndrome.T_symptoms:new()
101+
local symptom = df.active_creature_interaction_effectst:new()
102102
symptom.quantity = 0
103103
symptom.delay = 0
104104
symptom.ticks = 0

0 commit comments

Comments
 (0)