Fix research triggers
https://mods.factorio.com/mod/hot-metals/discussion/674736fbab56c062e1c0dac6
This commit is contained in:
parent
e3fc03ca35
commit
235bb154bc
2 changed files with 10 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
require("prototypes.item")
|
require("prototypes.hot")
|
|
@ -1,6 +1,6 @@
|
||||||
local spoil_ticks = settings.startup["hot-metals-time"].value * 60
|
local spoil_ticks = settings.startup["hot-metals-time"].value * 60
|
||||||
|
|
||||||
function createHotVariant(itemName)
|
function createHotVariant(itemName, _spoil_ticks)
|
||||||
-- 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
|
||||||
|
@ -8,7 +8,7 @@ function createHotVariant(itemName)
|
||||||
hotItem.icon = "__hot-metals__/graphics/icons/hot-" .. itemName .. ".png"
|
hotItem.icon = "__hot-metals__/graphics/icons/hot-" .. itemName .. ".png"
|
||||||
hotItem.order = hotItem.order .. "-hot"
|
hotItem.order = hotItem.order .. "-hot"
|
||||||
hotItem.spoil_result = itemName
|
hotItem.spoil_result = itemName
|
||||||
hotItem.spoil_ticks = spoil_ticks
|
hotItem.spoil_ticks = _spoil_ticks or spoil_ticks
|
||||||
data:extend({ hotItem })
|
data:extend({ hotItem })
|
||||||
|
|
||||||
-- Change recipes
|
-- Change recipes
|
||||||
|
@ -17,6 +17,13 @@ function createHotVariant(itemName)
|
||||||
recipe.results[1].name = hotItem.name
|
recipe.results[1].name = hotItem.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Change technology triggers
|
||||||
|
for _, tech in pairs(data.raw.technology) do
|
||||||
|
if tech.research_trigger and tech.research_trigger.item == itemName then
|
||||||
|
tech.research_trigger.item = hotItem.name
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
createHotVariant("copper-cable")
|
createHotVariant("copper-cable")
|
Loading…
Add table
Reference in a new issue