I'm trying to remove the unlocking of recipes in the game's technologies and other mods.
I use a special code for this. Example:
Code: Select all
if data.raw.technology["explosive-rocketry"] then
for i = 1, #data.raw.technology["explosive-rocketry"].effects do
effect = data.raw.technology["explosive-rocketry"].effects[i]
if effect.type == "unlock-recipe" and effect.recipe == "flamethrower-ammo" then
index = i
end
end
table.remove(data.raw.technology["explosive-rocketry"].effects, index)
end
For example, in the chemical-rocket mod https://mods.factorio.com/mod/chemical-rocket/ it says:
Code: Select all
local technology = data.raw.technology["explosive-rocketry"]
table.insert(technology.effects, {type = "unlock-recipe", recipe = "chemical-rocket"})
table.insert(technology.effects, {type = "unlock-recipe", recipe = "incendiary-rocket"})
table.insert(technology.effects, {type = "unlock-recipe", recipe = "flamethrower-ammo"})
Code: Select all
if mods["chemical-rocket"] then
if data.raw.technology["explosive-rocketry"] then
for i = 1, #data.raw.technology["explosive-rocketry"].effects do
effect = data.raw.technology["explosive-rocketry"].effects[i]
if effect.type == "unlock-recipe" and effect.recipe == "chemical-rocket" then
index = i
end
end
table.remove(data.raw.technology["explosive-rocketry"].effects, index)
end
if data.raw.technology["explosive-rocketry"] then
for i = 1, #data.raw.technology["explosive-rocketry"].effects do
effect = data.raw.technology["explosive-rocketry"].effects[i]
if effect.type == "unlock-recipe" and effect.recipe == "incendiary-rocket" then
index = i
end
end
table.remove(data.raw.technology["explosive-rocketry"].effects, index)
end
if data.raw.technology["explosive-rocketry"] then
for i = 1, #data.raw.technology["explosive-rocketry"].effects do
effect = data.raw.technology["explosive-rocketry"].effects[i]
if effect.type == "unlock-recipe" and effect.recipe == "flamethrower-ammo" then
index = i
end
end
table.remove(data.raw.technology["explosive-rocketry"].effects, index)
end
end
What the hell?""""!!!!!!!