Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions add-recipe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function addItems(category, exotic)
--category: the category of items we're adding
--exotic: whether to add exotic items
--returns: list of item objects that were added
local known = category[1]
local known_category = category[1]
local native = category[2]
local all = category[3]
local added = {} --as:df.itemdef[]
Expand All @@ -72,27 +72,33 @@ function addItems(category, exotic)
local item = item --as:df.itemdef_weaponst
local subtype = item.subtype
local itemOk = false
local known = known_category
-- digging implements are seperate from weapons in entity resources.
if (df.itemdef_weaponst:is_instance(item) and item.skill_melee == df.job_skill.MINING) then
known = diggers
end

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

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

if (not exotic and not checkNative(native, subtype)) then
itemOk = false
end

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

if (itemOk) then
Expand Down
13 changes: 13 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ Template for new versions:

## Removed

# 53.14-alpha3

## New Tools

## New Features

## Fixes
- `add-recipe`: fix to include incorrectly excluded recipes

## Misc Improvements

## Removed

# 53.14-r2

## New Tools
Expand Down
Loading