diff --git a/changelog.txt b/changelog.txt index 124b4cd6d8..95d5589fd3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -17,6 +17,10 @@ Template for new versions: ## New Features ## Fixes +- `gui/create-item`: fix items of type "VERMIN", "PET", "REMANS", "FISH", "RAW FISH", and "EGG" no longer spawn creature item "nothing." +Items will now spawn correctly, and will be of the creature type and creature caste that selected by the user. Items of these types will also stack correctly when needed. +- `modtools/create-item`: fix items of type "VERMIN", "PET", "REMANS", "FISH", "RAW FISH", and "EGG" no longer spawn creature item "nothing"s. +Items will now spawn correctly, and will be of the creature type and creature caste that selected by the user. Items of these types will also stack correctly when needed. ## Misc Improvements diff --git a/modtools/create-item.lua b/modtools/create-item.lua index b81978f7ab..d05438c1e6 100644 --- a/modtools/create-item.lua +++ b/modtools/create-item.lua @@ -37,6 +37,15 @@ local no_quality_item_types = utils.invert{ 'BRANCH', } +local typesThatUseCreaturesExceptCorpses = utils.invert { + 'REMAINS', + 'FISH', + 'FISH_RAW', + 'VERMIN', + 'PET', + 'EGG', +} + local CORPSE_PIECES = utils.invert{'BONE', 'SKIN', 'CARTILAGE', 'TOOTH', 'NERVE', 'NAIL', 'HORN', 'HOOF', 'CHITIN', 'SHELL', 'IVORY', 'SCALE'} local HAIR_PIECES = utils.invert{'HAIR', 'EYEBROW', 'EYELASH', 'MOUSTACHE', 'CHIN_WHISKERS', 'SIDEBURNS'} @@ -326,16 +335,27 @@ function hackWish(accessors, opts) until count end if not mattype or not itemtype then return end - if df.item_type.attrs[itemtype].is_stackable then + if not typesThatUseCreaturesExceptCorpses[df.item_type[itemtype]] and df.item_type.attrs[itemtype].is_stackable then return createItem({mattype, matindex}, {itemtype, itemsubtype}, quality, unit, description, count) end + if typesThatUseCreaturesExceptCorpses[df.item_type[itemtype]] and df.item_type.attrs[itemtype].is_stackable then + return createItem({matindex, casteId}, {itemtype, itemsubtype}, quality, unit, description, count) + end local items = {} for _ = 1,count do if itemtype == df.item_type.CORPSEPIECE or itemtype == df.item_type.CORPSE then table.insert(items, createCorpsePiece(unit, bodypart, partlayerID, matindex, casteId, corpsepieceGeneric)) else - for _,item in ipairs(createItem({mattype, matindex}, {itemtype, itemsubtype}, quality, unit, description, 1)) do - table.insert(items, item) + if typesThatUseCreaturesExceptCorpses[df.item_type[itemtype]] then + for + _,item in ipairs(createItem({matindex, casteId}, {itemtype, itemsubtype}, quality, unit, description, 1)) do + table.insert(items, item) + end + else + for + _,item in ipairs(createItem({mattype, matindex}, {itemtype, itemsubtype}, quality, unit, description, 1)) do + table.insert(items, item) + end end end end