Skip to content

Commit 614d1c3

Browse files
authored
Merge branch 'master' into fix/design-stair-designation
2 parents df224ed + 0936c53 commit 614d1c3

File tree

15 files changed

+171
-13
lines changed

15 files changed

+171
-13
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.34.0
23+
rev: 0.34.1
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks

autotraining.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ end
139139

140140
function getTrainingSquads()
141141
local squads = {}
142-
for squad_id, _ in pairs(state.training_squads) do
142+
for squad_id, active in pairs(state.training_squads) do
143143
local squad = df.squad.find(squad_id)
144-
if squad then
144+
if active and squad then
145145
table.insert(squads, squad)
146146
else
147147
-- setting to nil during iteration is permitted by lua

changelog.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,35 @@ Template for new versions:
2727
# Future
2828

2929
## New Tools
30+
31+
## New Features
32+
- `item`: new ``--total-quality`` option for use in conjunction with ``--min-quality`` or ``--max-quality`` to filter items according to their total quality
33+
34+
## Fixes
35+
36+
## Misc Improvements
37+
- `quickfort`: support for reinforced walls and bolt throwers
38+
- `gui/design`: can now construct reinforced walls
39+
40+
## Removed
41+
42+
# 53.01-r1
43+
44+
## New Tools
45+
- `fix/symbol-unstick`: unstick noble symbols that cannot be re-designated.
3046
- `resize-armor`: resize armor or clothing item to any creature size.
3147

3248
## New Features
3349

3450
## Fixes
51+
- `autotraining`: squads once used for training then disabled now properly are treated as disabled.
3552
- `gui/design`: designating a single-level stair construction now properly follows the selected stair type.
3653
- `gui/design`: adjusted conflicting keybinds, diagonal line reverse becoming ``R`` and bottom stair type becoming ``g``.
3754

3855
## Misc Improvements
3956

4057
## Removed
58+
- `fix/archery-practice`: removed from the control panel's bug fixes tab.
4159

4260
# 52.05-r2
4361

docs/fix/archery-practice.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ training and split stacks of ammo items assigned for training inside the
1010
quivers to ensure each training unit can have more than one stack to allow
1111
archery practice to take place.
1212

13+
Note
14+
----
15+
16+
The bug preventing units from initiating archery practice was fixed in
17+
DF version 53.01. See below for more information about the issue and how
18+
this tool works to mitigate it. Running this tool for any other archery
19+
related issues will not yield useful results.
20+
1321
Usage
1422
-----
1523

docs/fix/symbol-unstick.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fix/symbol-unstick
2+
==================
3+
4+
.. dfhack-tool::
5+
:summary: Unstick noble symbols that cannot be re-designated.
6+
:tags: fort bugfix items
7+
8+
Remove symbol designation from artifacts that cannot be re-designated
9+
after the noble's promotion to a higher position.
10+
11+
Usage
12+
-----
13+
14+
``fix/symbol-unstick``
15+
16+
Select an artifact that was designated as a noble's symbol and run the
17+
command to remove its designation as a symbol. The operation will only
18+
be performed if the symbol is claimed by a vacated noble position.

docs/item.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Examples
4949
flood-fill to create a burrow covering an entire cavern layer).
5050

5151
``item melt -t weapon -m steel --max-quality 3``
52-
Designate all steel weapons whose quality is at most superior for melting.
52+
Designate all steel weapons whose core quality is at most superior for
53+
melting.
5354

5455
``item hide -t boulder --scattered``
5556
Hide all scattered boulders, i.e. those that are not in stockpiles.
@@ -121,6 +122,11 @@ Options
121122
Only include items whose quality level is at most ``integer``. Useful
122123
values are 0 (ordinary) to 5 (masterwork).
123124

125+
``--total-quality``
126+
Only applies to ``--min-quality`` and ``--max-quality`` options. Filter items
127+
according to their total quality (to include improvements) of instead of
128+
their core quality.
129+
124130
``--stockpiled``
125131
Only include items that are in stockpiles. Does not include empty bins,
126132
barrels, and wheelbarrows assigned as storage and transport for stockpiles.
@@ -201,8 +207,12 @@ the filter is described.
201207
see above).
202208

203209
* ``condition_quality(tab, lower, upper, negate)``
204-
Selects items with quality between ``lower`` and ``upper`` (Range 0-5, see
205-
above).
210+
Selects items with core quality between ``lower`` and ``upper`` (Range 0-5,
211+
see above).
212+
213+
* ``condition_overall_quality(tab, lower, upper, negate)``
214+
Selects items with total quality between ``lower`` and ``upper`` (Range 0-5,
215+
see above).
206216

207217
* ``condition_stockpiled(tab, negate)``
208218
Corresponds to ``--stockpiled``.

fix/symbol-unstick.lua

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
-- Unstick noble symbols that cannot be re-designated.
2+
3+
local utils = require('utils')
4+
5+
local function GetArtifact(item)
6+
local artifact
7+
for _, generalRef in ipairs(item.general_refs) do
8+
if df.general_ref_is_artifactst:is_instance(generalRef) then
9+
artifact = df.artifact_record.find(generalRef.artifact_id)
10+
break
11+
end
12+
end
13+
local civ_id = df.global.plotinfo.civ_id
14+
-- Check if selected item is claimed by current site's civ.
15+
local entClaim_idx = artifact and utils.linear_index(artifact.entity_claims, civ_id)
16+
if artifact and entClaim_idx then
17+
return artifact, entClaim_idx
18+
end
19+
return nil
20+
end
21+
22+
local function UnstickSymbol(artifact, entClaim_idx)
23+
local civEntity = df.historical_entity.find(df.global.plotinfo.civ_id)
24+
local idx = utils.linear_index(civEntity.artifact_claims, artifact.id, 'artifact_id')
25+
-- Check if selected item is a symbol.
26+
if idx and civEntity.artifact_claims[idx].claim_type == df.artifact_claim_type.Symbol then
27+
local position_idx = civEntity.artifact_claims[idx].symbol_claim_id
28+
-- Check if symbol's position has been vacated.
29+
if civEntity.positions.assignments[position_idx].histfig == -1 then
30+
-- Erase claim from the entity and its reference in the artifact's record.
31+
-- Note: it's also possible to re-assign symbol by changing symbol_claim_id
32+
-- to point to the appropriate idx in civEntity.positions.assignments
33+
civEntity.artifact_claims:erase(idx)
34+
artifact.entity_claims:erase(entClaim_idx)
35+
return true
36+
end
37+
end
38+
return false
39+
end
40+
41+
local function Main(args)
42+
if args[1] == 'help' then
43+
print(dfhack.script_help())
44+
return
45+
end
46+
local item = dfhack.gui.getSelectedItem(true)
47+
if not item then
48+
qerror('No item selected.')
49+
end
50+
local artifact, entClaim_idx = GetArtifact(item)
51+
if artifact then
52+
if UnstickSymbol(artifact, entClaim_idx) then
53+
print('Symbol designation removed from selected item.')
54+
local strItemName = item and dfhack.items.getReadableDescription(item)
55+
print(('%s can now be re-designated as a symbol of nobility.'):format(strItemName))
56+
else
57+
qerror('Selected item is not a defunct symbol of the current site\'s civilization.')
58+
end
59+
else
60+
qerror('Selected item is not an artifact claimed by the current site\'s civilization.')
61+
end
62+
end
63+
64+
if not dfhack.isSiteLoaded() and not dfhack.world.isFortressMode() then
65+
qerror('This script requires the game to be in fortress mode.')
66+
end
67+
68+
Main({...})

gui/design.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ function Design:init()
366366

367367
local build_options = {
368368
{label='Walls', value='Cw'},
369+
{label='Reinforced Walls', value='CW'},
369370
{label='Floor', value='Cf'},
370371
{label='Fortification', value='CF'},
371372
{label='Ramps', value='Cr'},

internal/control-panel/registry.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ COMMANDS_BY_IDX = {
7474
-- can be restored here once we solve issue #4292
7575
-- {command='craft-age-wear', help_command='tweak', group='bugfix', mode='tweak', default=true,
7676
-- desc='Allows items crafted from organic materials to wear out over time.'},
77-
{command='fix/archery-practice', group='bugfix', mode='repeat', default=true,
78-
desc='Fix quivers and training ammo items to allow archery practice to take place.',
79-
params={'--time', '449', '--timeUnits', 'ticks', '--command', '[', 'fix/archery-practice', '-q', ']'}},
77+
-- Issue resolved in 53.01; tool no longer required.
78+
-- {command='fix/archery-practice', group='bugfix', mode='repeat', default=true,
79+
-- desc='Fix quivers and training ammo items to allow archery practice to take place.',
80+
-- params={'--time', '449', '--timeUnits', 'ticks', '--command', '[', 'fix/archery-practice', '-q', ']'}},
8081
{command='fix/blood-del', group='bugfix', mode='run', default=true},
8182
{command='fix/dead-units', group='bugfix', mode='repeat', default=true,
8283
desc='Fix units still being assigned to burrows after death.',

internal/quickfort/build.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,13 @@ local building_db_raw = {
934934
subtype=df.siegeengine_type.Ballista},
935935
ic={label='Catapult', type=df.building_type.SiegeEngine,
936936
subtype=df.siegeengine_type.Catapult},
937+
it={label='Bolt Thrower', type=df.building_type.SiegeEngine,
938+
subtype=df.siegeengine_type.BoltThrower},
937939
-- constructions
938940
Cw={label='Wall',
939941
type=df.building_type.Construction, subtype=df.construction_type.Wall},
942+
CW={label='Reinforced Wall',
943+
type=df.building_type.Construction, subtype=df.construction_type.ReinforcedWall},
940944
Cf={label='Floor',
941945
type=df.building_type.Construction, subtype=df.construction_type.Floor},
942946
Cr={label='Ramp',

0 commit comments

Comments
 (0)