local LOG = log local function log(x) LOG(serpent.block(x)) end local ko_items = {} local no_recipe_items = {} local ko_recipes = {} local function mark_accessible(name) ko_items[name] = nil no_recipe_items[name] = nil end for name in pairs(data.raw.item) do ko_items[name] = true no_recipe_items[name] = true end for name in pairs(data.raw.fluid) do ko_items[name] = true end for name in pairs(data.raw["autoplace-control"]) do mark_accessible(name) end local ignore_from_base = { "belt-immunity-equipment", "coin", "computer", "infinity-chest", "raw-wood", "simple-entity", "simple-entity-with-force", "simple-entity-with-owner", "used-up-uranium-fuel-cell", } for _, name in ipairs(ignore_from_base) do mark_accessible(name) end local changed = true while changed do log("starting pass") changed = false for name, recipe in pairs(data.raw.recipe) do if recipe.normal then recipe = recipe.normal end local missing = {} for _, ing in ipairs(recipe.ingredients) do local ingredient_name = ing.name or ing[1] if ko_items[ingredient_name] then if name == "battery" then log(ingredient_name) end missing[#missing+1] = ingredient_name end end if next(missing) then ko_recipes[name] = missing else ko_recipes[name] = nil end local results = recipe.results or {{recipe.result, 1}} for _, result in ipairs(results) do local result_name = result.name or result[1] no_recipe_items[result_name] = nil if not next(missing) and ko_items[result_name] then log("marking "..result_name.." as accessible via recipe "..name) mark_accessible(result_name) changed = true end end end end local function count(t) local i = 0 for _ in pairs(t) do i = i + 1 end return i end --log(ok_items) log("Found "..count(no_recipe_items).. " items without recipes or autoplace-controls:") log(no_recipe_items) log("Found "..count(ko_items).." inaccessible items:") log(ko_items) log("Found "..count(ko_recipes).." inaccessible recipes:") log(ko_recipes)