From 9c58871c5bdd725701d879f4c2d8fd4594e8fec5 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Mon, 10 Feb 2025 15:51:59 +0100 Subject: [PATCH] Locomotives can burn wood again --- .../content/fuel-category-updates.lua | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/lignumis/prototypes/content/fuel-category-updates.lua b/lignumis/prototypes/content/fuel-category-updates.lua index 964f5bd..50c23d5 100644 --- a/lignumis/prototypes/content/fuel-category-updates.lua +++ b/lignumis/prototypes/content/fuel-category-updates.lua @@ -1,36 +1,37 @@ -data.raw.item["wood"].fuel_category = "wood" -data.raw.item["lumber"].fuel_category = "wood" -data.raw.item["tree-seed"].fuel_category = "wood" -data.raw.item["wooden-wall"].fuel_category = "wood" - --- Update burner inserters initial fuel -for _, inserter in pairs(data.raw["inserter"]) do - if inserter.energy_source and inserter.energy_source.initial_fuel == "wood" then - inserter.energy_source.initial_fuel = "coal" - end -end - --- Update energy source fuel categories for buildings that should still use wood as fuel - -local blacklist = {} - -function update_fuel_categories(t) - for _, entity in pairs(t) do - for _, energy_source in pairs({ "energy_source", "burner" }) do - if entity[energy_source] - and entity[energy_source].type == "burner" - and not table.contains(blacklist, entity.name) - and entity[energy_source].fuel_categories - and table.contains(entity[energy_source].fuel_categories, "chemical") - then - table.insert(entity[energy_source].fuel_categories, "wood") - end - end - end -end - --- Add more if incompatibilities arise -update_fuel_categories(data.raw["boiler"]) -update_fuel_categories(data.raw["reactor"]) -update_fuel_categories(data.raw["car"]) -update_fuel_categories(data.raw["generator-equipment"]) +data.raw.item["wood"].fuel_category = "wood" +data.raw.item["lumber"].fuel_category = "wood" +data.raw.item["tree-seed"].fuel_category = "wood" +data.raw.item["wooden-wall"].fuel_category = "wood" + +-- Update burner inserters initial fuel +for _, inserter in pairs(data.raw["inserter"]) do + if inserter.energy_source and inserter.energy_source.initial_fuel == "wood" then + inserter.energy_source.initial_fuel = "coal" + end +end + +-- Update energy source fuel categories for buildings that should still use wood as fuel + +local blacklist = {} + +function update_fuel_categories(t) + for _, entity in pairs(t) do + for _, energy_source in pairs({ "energy_source", "burner" }) do + if entity[energy_source] + and entity[energy_source].type == "burner" + and not table.contains(blacklist, entity.name) + and entity[energy_source].fuel_categories + and table.contains(entity[energy_source].fuel_categories, "chemical") + then + table.insert(entity[energy_source].fuel_categories, "wood") + end + end + end +end + +-- Add more if incompatibilities arise +update_fuel_categories(data.raw["boiler"]) +update_fuel_categories(data.raw["reactor"]) +update_fuel_categories(data.raw["car"]) +update_fuel_categories(data.raw["locomotive"]) +update_fuel_categories(data.raw["generator-equipment"])