Unlocking shortcuts by research
Posted: Sun Jun 19, 2022 10:54 pm
GCKI used to work with a "car key" item. The recipe for this item would be unlocked when "automobilism" or "cargo-ships" was researched. Now I've changed the prototype of the keys from Prototype/Item to Prototype/Shortcut, and I've got a problem: technology.effects["unlock-recipe"] won't apply anymore, and technology_to_unlock is supposed to be a string value, so the shortcut can be unlocked by one technology only.
I've tried to work around this:
However, only "automobilism" (the tech specified in LuaShortcut.technology_to_unlock) will get the effect in the game. Is there really no way to unlock a shortcut by researching any of several techs?
I've tried to work around this:
Code: Select all
GCKI.unlock_tech_map = {
-- Required mod Technology
["base"] = "automobilism",
["cargo-ships"] = "water_transport",
}
local tech
local unlock = {
type = "nothing",
icon = icon,
icon_size = 64,
icon_mipmaps = 1,
effect_description = {"techeffect-description.technology-effect"},
}
for mod_name, tech_name in pairs(GCKI.unlock_tech_map) do
tech = data.raw.technology[tech_name]
if mods[mod_name] and tech then
tech.effects = tech.effects or {}
table.insert(tech.effects, unlock)
end
end