local data_util = require("data-util") --- @param technology data.TechnologyPrototype --- @param target_prerequisite_name data.TechnologyID --- @return boolean found local function find_prerequisite(technology, target_prerequisite_name) for _, prerequisite_name in pairs(technology.prerequisites or {}) do if prerequisite_name == target_prerequisite_name then return true end local prerequisite = data.raw.technology[prerequisite_name] assert(prerequisite, "Prerequisite " .. prerequisite_name .. "is not a valid technology.") if find_prerequisite(prerequisite, target_prerequisite_name) then return true end end return false end for _, technology in pairs(data.raw.technology) do local unit = technology.unit if not unit then goto continue end local ingredients = unit.ingredients if not ingredients then goto continue end local highest_pack = ingredients[#ingredients] if not highest_pack then goto continue end local highest_pack_name = highest_pack[1] if not highest_pack_name then goto continue end -- This assumes that there will either be an exact matching technology or that the science pack has a recipe with its same name. local science_pack_tech = data.raw.technology[highest_pack_name] or data_util.get_technology_for_recipe(highest_pack_name) if not science_pack_tech or science_pack_tech.name == technology.name then goto continue end if not find_prerequisite(technology, science_pack_tech.name) then log(technology.name .. ": " .. science_pack_tech.name) end ::continue:: end