Code: Select all
table.insert(data.raw["technology"]["steam-power"].effects,{type = "unlock-recipe",recipe = "steam-engine"})
is there a Wizard who could point me on an adventure of coding land,and what is to be done so i can complete this quest?
Code: Select all
table.insert(data.raw["technology"]["steam-power"].effects,{type = "unlock-recipe",recipe = "steam-engine"})
dtoxic wrote: ↑Wed Oct 18, 2023 9:25 am So i wanted to change the steam engine from unlocking in one technology and unlock in another witch i managed to do like this
But now i have two recipes inside the "steam-power" and from another mod technology "electric-machinery" i would like to hide the recipe for the steam engine from "electric-machinery" technologyCode: Select all
table.insert(data.raw["technology"]["steam-power"].effects,{type = "unlock-recipe",recipe = "steam-engine"})
Code: Select all
local tech = data.raw.technology["electric-machinery"]
if tech and tech.effects then
local new_effects = {}
for e, effect in pairs(tech.effects) do
if not (effect.type == "unlock-recipe" and effect.recipe == "steam-engine") then
table.insert(new_effects, effect)
end
end
tech.effects = next(new_effects) and table.deepcopy(new_effects) or nil
end
Code: Select all
local tech = data.raw.technology["electric-machinery"]
Ah, sorry about that. I could've sworn I did some recipe moving in there too, but maybe not. It has been a while since I've needed to look at that mod's code.