Skip to content

Commit 48759c3

Browse files
authored
Merge pull request #1591 from huesatlight/scripts/add-recipe-bugfixes
scripts/add-recipe bugfixes
2 parents 4ffbea2 + 48eabfa commit 48759c3

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

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

changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Template for new versions:
3232
## New Features
3333

3434
## Fixes
35+
- `add-recipe`: fix to include incorrectly excluded recipes
3536
- `gui/control-panel`: fixed incorrect description of deteriorate commands
36-
3737
- `gui/petitions`: fix deity display
3838

3939
## Misc Improvements

0 commit comments

Comments
 (0)