Skip to content

Commit cb30aff

Browse files
authored
Merge branch 'master' into caravan-work
2 parents c28c7c3 + 7549711 commit cb30aff

57 files changed

Lines changed: 2745 additions & 201 deletions

Some content is hidden

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

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ repos:
2020
args: ['--fix=lf']
2121
- id: trailing-whitespace
2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.34.1
23+
rev: 0.37.4
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks
27-
rev: v1.5.5
27+
rev: v1.5.6
2828
hooks:
2929
- id: forbid-tabs
3030
exclude_types:

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
44
PATTERN "*.json"
55
PATTERN "scripts/docs" EXCLUDE
66
PATTERN "scripts/test" EXCLUDE
7+
PATTERN ".github" EXCLUDE
8+
PATTERN ".vscode" EXCLUDE
79
)
810

911
if(BUILD_TESTS)

add-recipe.lua

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function addItems(category, exotic)
6363
--category: the category of items we're adding
6464
--exotic: whether to add exotic items
6565
--returns: list of item objects that were added
66-
local known = category[1]
66+
local known_category = category[1]
6767
local native = category[2]
6868
local all = category[3]
6969
local added = {} --as:df.itemdef[]
@@ -72,27 +72,33 @@ function addItems(category, exotic)
7272
local item = item --as:df.itemdef_weaponst
7373
local subtype = item.subtype
7474
local itemOk = false
75+
local known = known_category
76+
-- digging implements are seperate from weapons in entity resources.
77+
if (df.itemdef_weaponst:is_instance(item) and item.skill_melee == df.job_skill.MINING) then
78+
known = diggers
79+
end
7580

7681
--check if it's a training weapon
7782
local t1, t2 = pcall(function () return item.flags.TRAINING == false end)
7883
local training = not(not t1 or t2)
7984

80-
--we don't want procedural items with adjectives such as "wavy spears"
81-
--(because they don't seem to be craftable even if added)
85+
--excludes procedural items, eg: "wavy spears" for divine origins
8286
--nor do we want known items or training items (because adding training
8387
--items seems to allow them to be made out of metals)
84-
if (item.adjective == "" and not training and not checkKnown(known, subtype)) then
88+
if (not item.base_flags.GENERATED and not training and not checkKnown(known, subtype)) then
8589
itemOk = true
8690
end
8791

8892
if (not exotic and not checkNative(native, subtype)) then
8993
itemOk = false
9094
end
9195

92-
--check that the weapon we're adding is not already known to the civ as
93-
--a digging implement so picks don't get duplicated
94-
if (checkKnown(diggers, subtype)) then
95-
itemOk = false
96+
--if the weapon we're adding is a digging implement, add to diggers instead of weapons
97+
--prevents picks from being duplicated, and puts great picks in correct category
98+
if (df.itemdef_weaponst:is_instance(item) and item.skill_melee == df.job_skill.MINING) then
99+
if (checkKnown(diggers, subtype)) then
100+
itemOk = false
101+
end
96102
end
97103

98104
if (itemOk) then

armoks-blessing.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function brainwash_unit(unit)
2323
unit.status.current_soul.personality.traits.GREED = 25
2424
unit.status.current_soul.personality.traits.IMMODERATION = 25
2525
unit.status.current_soul.personality.traits.VIOLENT = 50
26-
unit.status.current_soul.personality.traits.PERSEVERENCE = 75
26+
unit.status.current_soul.personality.traits.PERSEVERANCE = 75
2727
unit.status.current_soul.personality.traits.WASTEFULNESS = 50
2828
unit.status.current_soul.personality.traits.DISCORD = 25
2929
unit.status.current_soul.personality.traits.FRIENDLINESS = 75
@@ -80,7 +80,7 @@ function brainwash_unit(unit)
8080
[df.value_type.HARD_WORK]=41,
8181
[df.value_type.SACRIFICE]=41,
8282
[df.value_type.COMPETITION]=-41,
83-
[df.value_type.PERSEVERENCE]=41,
83+
[df.value_type.PERSEVERANCE]=41,
8484
[df.value_type.LEISURE_TIME]=-11,
8585
[df.value_type.COMMERCE]=41,
8686
[df.value_type.ROMANCE]=41,

assign-beliefs.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ function assign(beliefs, unit, reset)
134134
for belief, level in pairs(beliefs) do
135135
assert(type(level) == "number")
136136
belief = belief:upper()
137-
-- there's a typo in the game data
138-
if belief == "PERSEVERANCE" then
139-
belief = "PERSEVERENCE"
140-
end
141137
if df.value_type[belief] then
142138
if level >= -3 and level <= 3 then
143139
local belief_value = calculate_random_belief_value(level)

assign-facets.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ function assign(facets, unit, reset)
134134
for facet, level in pairs(facets) do
135135
assert(type(level) == "number")
136136
facet = facet:upper()
137-
-- there's a typo in the game data
138-
if facet == "PERSEVERANCE" then
139-
facet = "PERSEVERENCE"
140-
end
141137
if df.personality_facet_type[facet] then
142138
if level >= -3 and level <= 3 then
143139
local facet_strength = calculate_random_facet_strength(level)

assign-profile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ local scripts = {
9292
FACETS = reqscript("assign-facets"),
9393
}
9494

95-
local default_filename = "/hack/scripts/dwarf_profiles.json"
95+
local default_filename = dfhack.getHackPath().."/scripts/dwarf_profiles.json"
9696

9797
-- ------------------------------------------------- APPLY PROFILE -------------------------------------------------- --
9898
--- Apply the given profile to a unit, erasing or resetting the unit characteristics as requested.

changelog.txt

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,158 @@ Template for new versions:
3838

3939
## Removed
4040

41+
# 53.15-r2
42+
43+
## New Tools
44+
45+
## New Features
46+
47+
## Fixes
48+
- `combine`: stopgap fix for incorrectly combining dyes, no longer affects dyes
49+
- `gui/rename`: fix script error that sometimes caused the script to malfunction when started from the Launcher.
50+
51+
## Misc Improvements
52+
53+
## Removed
54+
55+
# 53.15-r1
56+
57+
## New Tools
58+
- `machine-toggle`: interface for toggling gear assemblies, as well as pressure plates (previously in `trackstop`) (available only if ``armok`` tools are shown)
59+
60+
## New Features
61+
62+
## Fixes
63+
- `add-recipe`: fix to include incorrectly excluded recipes
64+
- `gui/control-panel`: fixed incorrect description of deteriorate commands
65+
- `gui/petitions`: fix deity display
66+
67+
## Misc Improvements
68+
- `trackstop`: ``pressureplate`` overlay moved to `machine-toggle` as an ``armok`` tool
69+
70+
## Removed
71+
72+
# 53.14-r2
73+
74+
## New Tools
75+
76+
## New Features
77+
78+
## Fixes
79+
80+
## Misc Improvements
81+
82+
## Removed
83+
- ``gui/logcleaner``: Removed
84+
85+
# 53.14-r1
86+
87+
## New Tools
88+
89+
## New Features
90+
91+
## Fixes
92+
- `caravan`: fix ethics warning for wooden weapons
93+
- `gui/control-panel`: fixed inconsistent space in command help ("tweak" -> "tweak ", like with other commands)
94+
- `gui/siegemanager`: consistently set the initial filter to "All"
95+
- `immortal-cravings`: also take care of immortal units with alcohol dependence
96+
97+
## Misc Improvements
98+
99+
## Removed
100+
101+
# 53.11-r2
102+
103+
## New Tools
104+
105+
## New Features
106+
107+
## Fixes
108+
- `gui/rename`: skip ``NONE`` when iterating through language name options
109+
- `quickfort`: work orders will no longer be created with a repetition frequency of ``NONE``
110+
111+
## Misc Improvements
112+
113+
## Removed
114+
115+
# 53.10-r2
116+
117+
## New Tools
118+
- `gui/logcleaner`: graphical overlay for configuring the logcleaner plugin with enable and filter toggles.
119+
120+
## New Features
121+
- `trackstop`: can now modify pressure plates; permits minecart and creature triggers to be set beyond normal sensitivity
122+
123+
## Fixes
124+
- `gui/rename`: added check for entity_id input in get_target function
125+
- `prioritize`: Fix the overlay appearing where it should not when following a unit
126+
127+
## Misc Improvements
128+
- `gui/notify`: reduced severity of the missing nemesis records warning if no units on the map are affected. clarified wording.
129+
130+
## Removed
131+
132+
# 53.10-r1
133+
134+
## New Tools
135+
136+
## New Features
137+
- `gui/quickcmd`: added custom command names and option to display command output
138+
- `gui/notify`: new notification type: missing nemesis records; displays a warning message about game corruption.
139+
140+
## Fixes
141+
142+
## Misc Improvements
143+
144+
## Removed
145+
146+
# 53.07-r1
147+
148+
## New Tools
149+
- `fix/codex-pages`: add pages to written content that have unspecified page counts.
150+
- `gui/keybinds`: gui for managing and saving custom keybindings
151+
152+
## New Features
153+
154+
## Fixes
155+
- `empty-bin`: renamed ``--liquids`` parameter to ``--force`` and made emptying of containers (bags) with powders contingent on that parameter. Previously powders would just always get disposed.
156+
157+
## Misc Improvements
158+
- `combine`: try harder to find the currently-selected stockpile
159+
160+
## Removed
161+
162+
# 53.06-r1
163+
164+
## New Tools
165+
166+
## New Features
167+
168+
## Fixes
169+
- `gui/design`: designating a single-level stair construction now properly follows the selected stair type.
170+
- `gui/design`: adjusted conflicting keybinds, diagonal line reverse becoming ``R`` and bottom stair type becoming ``g``.
171+
- `modtools/set-personality`: use correct caste trait ranges; fixes `gui/gm-unit` being unable to correctly randomize traits or set traits to caste average
172+
173+
## Misc Improvements
174+
175+
## Removed
176+
177+
# 53.04-r1
178+
179+
## New Tools
180+
- `gui/siegemanager`: manage your siege engines at a glance.
181+
182+
## New Features
183+
- `item`: new ``--total-quality`` option for use in conjunction with ``--min-quality`` or ``--max-quality`` to filter items according to their total quality
184+
185+
## Fixes
186+
187+
## Misc Improvements
188+
- `gui/design`: can now construct reinforced walls
189+
- `quickfort`: support for reinforced walls and bolt throwers
190+
191+
## Removed
192+
41193
# 53.01-r1
42194

43195
## New Tools

combine.lua

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ local function stack_type_new(type_vals)
182182
return stack_type
183183
end
184184

185+
local function isDye(item)
186+
-- Dyes should not be combined as this will cause bugs when mixing them together
187+
if item:getType() ~= df.item_type.POWDER_MISC then return false end
188+
-- pcall guards items/materials that can't be decoded or lack the flag
189+
local ok, is_dye = pcall(function()
190+
local mat = dfhack.matinfo.decode(item.mat_type, item.mat_index)
191+
return mat and mat.material.flags.IS_DYE or false
192+
end)
193+
return ok and is_dye or false
194+
end
195+
185196
local function stacks_add_item(stockpile, stacks, stack_type, item, container)
186197
-- add an item to the matching comp_items table; based on comp_key.
187198
local comp_key = ''
@@ -436,7 +447,7 @@ local function stacks_add_items(stockpile, stacks, items, container, ind)
436447
local stack_type = stacks.stack_types[type_id]
437448

438449
-- item type in list of included types?
439-
if stack_type and not item:isSand() and not item:isPlaster() and isValidPart(item) then
450+
if stack_type and not item:isSand() and not item:isPlaster() and not isDye(item) and isValidPart(item) then
440451
if not isRestrictedItem(item) and item.stack_size <= stack_type.max_stack_qty then
441452

442453
stacks_add_item(stockpile, stacks, stack_type, item, container)
@@ -736,6 +747,26 @@ local function get_stockpile_here()
736747
-- return the stockpile as a table
737748
local stockpiles = {}
738749
local building = dfhack.gui.getSelectedStockpile(true)
750+
751+
-- try finding the stockpile by viewed item or first item in itemlist viewsheet.
752+
if building == nil then
753+
local item = nil
754+
if dfhack.gui.getSelectedItem(true) ~= nil then
755+
item = dfhack.gui.getSelectedItem(true)
756+
elseif tonumber(dfhack.DF_VERSION:match("^0*%.*(%d+%.%d+)")) >= 50.07 -- matchFocusString() in Commit a770a4c
757+
and dfhack.gui.matchFocusString("dwarfmode/ViewSheets/ITEM_LIST", dfhack.gui.getDFViewscreen())
758+
and df.global.game.main_interface.view_sheets.open == true
759+
and df.global.game.main_interface.view_sheets.active_sheet == df.view_sheet_type.ITEM_LIST
760+
and #df.global.game.main_interface.view_sheets.viewing_itid > 0
761+
then
762+
local itemid = df.global.game.main_interface.view_sheets.viewing_itid[0]
763+
item = df.item.find(itemid)
764+
end
765+
local pos = (item) and xyz2pos(dfhack.items.getPosition(item)) or nil
766+
building = (pos) and dfhack.buildings.findAtTile(pos) or nil
767+
building = (df.building_stockpilest:is_instance(building)) and building or nil
768+
end
769+
739770
if not building then qerror('Please select a stockpile.') end
740771
table.insert(stockpiles, building)
741772
if opts.verbose > 0 then

devel/print-event.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434
local function print_event(event)
3535
local str = df.new("string")
3636
local ctx = df.history_event_context:new()
37-
event:getSentence(str, ctx)
37+
event:getSentence(str, ctx, true, false)
3838
ctx:delete()
3939
print(str.value)
4040
str:delete()

0 commit comments

Comments
 (0)