diff --git a/data-util.lua b/data-util.lua index a9f699c..4de89f7 100644 --- a/data-util.lua +++ b/data-util.lua @@ -10,16 +10,12 @@ end -- Remove an element of type t and name from data.raw function data_util.remove_raw(t, name) - local index = -1 - for i, elem in pairs(data.raw) do - if elem.type == t and elem.name == name then - index = i + for i, elem in pairs(data.raw[t]) do + if elem.name == name then + data.raw[t][i] = nil break end end - if index > -1 then - table.remove(data.raw, index) - end end diff --git a/titanium-recipe-modules.lua b/titanium-recipe-modules.lua index af1438a..f239bfb 100644 --- a/titanium-recipe-modules.lua +++ b/titanium-recipe-modules.lua @@ -25,3 +25,18 @@ for i, recipe in pairs(recipes) do end end end + + +-- FE+ allows modules for Titanium ore, we can't do that. +if mods["FactorioExtended-Plus-Core"] then + for j, module in pairs(data.raw.module) do + if module.limitation and #module.limitation > 0 then + for i=1,#module.limitation,1 do + if module.limitation[i] == "titanium-ore" then + table.remove(module.limitation, i) + break + end + end + end + end +end diff --git a/titanium-recipe.lua b/titanium-recipe.lua index 33c142d..a282d0c 100644 --- a/titanium-recipe.lua +++ b/titanium-recipe.lua @@ -13,7 +13,7 @@ data:extend( { { type = "recipe", - name = "titanium-plate", + name = util.titanium_plate, category = "smelting", order = "d[titanium-plate]", icons = (mods["Krastorio2"] and @@ -60,7 +60,7 @@ data:extend( { { type = "unlock-recipe", - recipe = "titanium-plate" + recipe = util.titanium_plate } }, unit =