What can be researched?

Place to get help with not working mods / modding interface.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

What can be researched?

Post by darkfrei »

techs
techs
2018-02-05 21_31_13.png (61.62 KiB) Viewed 701 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
Bilka
Factorio Staff
Factorio Staff
Posts: 3470
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: What can be researched?

Post by Bilka »

I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: What can be researched?

Post 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.
Post Reply

Return to “Modding help”