I thought it would be data.raw.technology["hidden-technology"].hidden = false (similar for enabled), but that's not working.
Can this be done?
Code: Select all
data:extend(
{
{
type = "technology",
name = "available-technology",
icon_size = 256, icon_mipmaps = 4,
icons = "__myMod__/graphics/technology/available-technology.png"
unit =
{
count = 1,
ingredients = {{"automation-science-pack", 1}},
time = 1
},
order = "a"
},
{
type = "technology",
name = "hidden-technology",
icon_size = 256, icon_mipmaps = 4,
icons = "__myMod__/graphics/technology/hidden-technology.png"
prerequisites = {"available-technology"},
unit =
{
count = 1,
ingredients = {{"automation-science-pack", 1}},
time = 1
},
order = "a"
}
})
Code: Select all
script.on_event(defines.events.on_research_finished, function(event)
local researchFinished = {
["available-technology"] = function()
otherFunctionThatTakesTime()
data.raw.technology["hidden-technology"].hidden = false
data.raw.technology["hidden-technology"].enabled = true
end
}
if researchFinished[event.research.name] then
researchFinished[event.research.name]()
end
end)