Use non-hot icon variants for the recipes

This commit is contained in:
Simon Brodtmann 2025-02-03 10:34:31 +01:00
parent 104312531b
commit 935ee5268e

View file

@ -1,22 +1,23 @@
local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60 local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60
function createHotVariant(item) function createHotVariant(config)
local itemName = item local itemName = config
local spoilTicks = defaultSpoilTicks local spoilTicks = defaultSpoilTicks
local iconFolder = "__hot-metals__/graphics/icons/" local iconFolder = "__hot-metals__/graphics/icons/"
if type(item) == "table" then if type(config) == "table" then
itemName = item.name itemName = config.name
spoilTicks = item.spoilTicks or spoilTicks spoilTicks = config.spoilTicks or spoilTicks
iconFolder = item.iconFolder or iconFolder iconFolder = config.iconFolder or iconFolder
end end
local item = data.raw.item[itemName]
-- Create new item -- Create new item
local hotItem = table.deepcopy(data.raw.item[itemName]) local hotItem = table.deepcopy(data.raw.item[itemName])
hotItem.name = "hot-" .. itemName hotItem.name = "hot-" .. itemName
hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } } hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } }
if (item.icons) then if (config.icons) then
hotItem.icons = item.icons hotItem.icons = config.icons
else else
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png" hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
end end
@ -37,9 +38,13 @@ function createHotVariant(item)
result.name = hotItem.name result.name = hotItem.name
end end
recipe.localised_name = { "item-name." .. itemName } recipe.localised_name = { "item-name." .. itemName }
recipe.icon = recipe.icon or item.icon
recipe.icon_size = recipe.icon_size or item.icon_size
recipe.icons = recipe.icons or item.icons
if recipe.main_product == itemName then if recipe.main_product == itemName then
recipe.main_product = hotItem.name recipe.main_product = hotItem.name
end end
recipe.preserve_products_in_machine_output = true recipe.preserve_products_in_machine_output = true
recipe.result_is_always_fresh = true recipe.result_is_always_fresh = true
end end