This is an easy way to unlock only those technologies available for a certain stage of the game.
To use, paste the following code into the console (don't forget to prefix it with "/c ").
Code: Select all
function acceptTechnology(technology, sciencePacks)
for _, ingredient in pairs(technology.research_unit_ingredients) do
local sciencePackFound = false
for _, sciencePack in pairs(sciencePacks) do
local sciencePackName = string.format('%s-science-pack', sciencePack)
if(sciencePackName == ingredient.name) then
sciencePackFound = true
end
end
if(not sciencePackFound) then
return false
end
end
return true
end
function filterTechnologies(technologies, sciencePacks)
local results = {}
for _, technology in pairs(technologies) do
if(acceptTechnology(technology, sciencePacks)) then
table.insert(results, technology)
end
end
return results
end
function unlockTechnologies(sciencePacks)
local technologies = game.player.force.technologies
local filteredTechnologies = filterTechnologies(technologies, sciencePacks)
for _, technology in pairs(filteredTechnologies) do
technology.researched = true
end
end
function lockTechnologies()
local technologies = game.player.force.technologies
for _, technology in pairs(technologies) do
technology.researched = false
end
end
Code: Select all
/c unlockTechnologies({'automation', 'logistic', 'military', 'chemical', 'production', 'utility'})
Code: Select all
/c unlockTechnologies({'automation', 'logistic', 'chemical'})
Code: Select all
/c lockTechnologies()