fix fe+ compatibility

This commit is contained in:
Brevven 2020-12-07 03:12:35 -08:00
parent ea825853d0
commit 9a650c09fc
3 changed files with 20 additions and 9 deletions

View file

@ -10,16 +10,12 @@ end
-- Remove an element of type t and name from data.raw -- Remove an element of type t and name from data.raw
function data_util.remove_raw(t, name) function data_util.remove_raw(t, name)
local index = -1 for i, elem in pairs(data.raw[t]) do
for i, elem in pairs(data.raw) do if elem.name == name then
if elem.type == t and elem.name == name then data.raw[t][i] = nil
index = i
break break
end end
end end
if index > -1 then
table.remove(data.raw, index)
end
end end

View file

@ -25,3 +25,18 @@ for i, recipe in pairs(recipes) do
end end
end 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

View file

@ -13,7 +13,7 @@ data:extend(
{ {
{ {
type = "recipe", type = "recipe",
name = "titanium-plate", name = util.titanium_plate,
category = "smelting", category = "smelting",
order = "d[titanium-plate]", order = "d[titanium-plate]",
icons = (mods["Krastorio2"] and icons = (mods["Krastorio2"] and
@ -60,7 +60,7 @@ data:extend(
{ {
{ {
type = "unlock-recipe", type = "unlock-recipe",
recipe = "titanium-plate" recipe = util.titanium_plate
} }
}, },
unit = unit =