Page 1 of 1

What can be researched?

Posted: Mon Feb 05, 2018 8:47 pm
by darkfrei
techs
techs
2018-02-05 21_31_13.png (61.62 KiB) Viewed 702 times
As you see on this picture, some technologies can be researched (yellow), some not (red).
How to get this information? http://lua-api.factorio.com/latest/LuaTechnology.html

Re: What can be researched?

Posted: Mon Feb 05, 2018 8:48 pm
by Bilka

Re: What can be researched?

Posted: Tue Feb 06, 2018 1:36 am
by eradicator

Code: Select all

local function get_tech_color(tech)
  if tech.researched then
    return 'green'
    end
  for _,pre in pairs(tech.prerequisites) do
    if not tech.force.technologies[pre.name].researched then
      return 'red'
      end
    end
  return 'yellow'
  end

local force = game.player.force --enter your force here
local color = {}

for _,tech in pairs(force.technologies) do
  color[tech.name] = get_tech_color(tech)
  end
  
print(serpent.block(color))
I noticed this doesn't work for infinite technologies though. They don't show up on the list at all.