From 235bb154bc71981db5664507b9a862d317f2c582 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Mon, 2 Dec 2024 22:47:49 +0100 Subject: [PATCH] Fix research triggers https://mods.factorio.com/mod/hot-metals/discussion/674736fbab56c062e1c0dac6 --- hot-metals/data-updates.lua | 2 +- hot-metals/prototypes/{item.lua => hot.lua} | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) rename hot-metals/prototypes/{item.lua => hot.lua} (77%) diff --git a/hot-metals/data-updates.lua b/hot-metals/data-updates.lua index 976dbab..85f98ef 100644 --- a/hot-metals/data-updates.lua +++ b/hot-metals/data-updates.lua @@ -1 +1 @@ -require("prototypes.item") \ No newline at end of file +require("prototypes.hot") \ No newline at end of file diff --git a/hot-metals/prototypes/item.lua b/hot-metals/prototypes/hot.lua similarity index 77% rename from hot-metals/prototypes/item.lua rename to hot-metals/prototypes/hot.lua index 7643f24..fe066fd 100644 --- a/hot-metals/prototypes/item.lua +++ b/hot-metals/prototypes/hot.lua @@ -1,6 +1,6 @@ local spoil_ticks = settings.startup["hot-metals-time"].value * 60 -function createHotVariant(itemName) +function createHotVariant(itemName, _spoil_ticks) -- Create new item local hotItem = table.deepcopy(data.raw.item[itemName]) hotItem.name = "hot-" .. itemName @@ -8,7 +8,7 @@ function createHotVariant(itemName) hotItem.icon = "__hot-metals__/graphics/icons/hot-" .. itemName .. ".png" hotItem.order = hotItem.order .. "-hot" hotItem.spoil_result = itemName - hotItem.spoil_ticks = spoil_ticks + hotItem.spoil_ticks = _spoil_ticks or spoil_ticks data:extend({ hotItem }) -- Change recipes @@ -17,6 +17,13 @@ function createHotVariant(itemName) recipe.results[1].name = hotItem.name 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 createHotVariant("copper-cable")