From f1d7b0250f998faaf0513c26a0d3eb94b0200d02 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Fri, 12 Dec 2025 18:35:27 +0100 Subject: [PATCH] lumber mill --- lignumis/prototypes/content/lumber-mill.lua | 138 +++++++++++++++----- 1 file changed, 103 insertions(+), 35 deletions(-) diff --git a/lignumis/prototypes/content/lumber-mill.lua b/lignumis/prototypes/content/lumber-mill.lua index 8419fbd..dc44d2a 100644 --- a/lignumis/prototypes/content/lumber-mill.lua +++ b/lignumis/prototypes/content/lumber-mill.lua @@ -1,3 +1,4 @@ +local Recipe = require("__cf-lib__/data/Recipe") local Technology = require("__cf-lib__/data/Technology") local LumberMillFactory = require(MF.buildings .. "LumberMill") local LumberMill = LumberMillFactory() @@ -13,68 +14,135 @@ data:extend({ local has_oxygen = data.raw["surface-property"]["oxygen"] ~= nil -LumberMill.EntityBuilder:new() - :burnerEnergySource({ emissions_per_minute = { noise = 100 } }) - :baseProductivity(0.5) - :apply({ - crafting_categories = { "wood-processing" }, +if not mods["wood-logistics"] then + LumberMill.EntityBuilder:new() + :burnerEnergySource({ emissions_per_minute = { noise = 100 } }) + :baseProductivity(0.5) + :apply({ + crafting_categories = { "wood-processing" }, crafting_speed = 2, energy_usage = "1000kW", surface_conditions = { { - property = has_oxygen and "oxygen" or "pressure", - min = 3 + property = has_oxygen and "oxygen" or "pressure", + min = 3 }, { - property = "gravity", - min = 1 + property = "gravity", + min = 1 } - } + } }) -local lumber_mill_item = LumberMill.ItemBuilder:new() - :apply({ + local lumber_mill_item = LumberMill.ItemBuilder:new() + :apply({ default_import_location = "lignumis", order = "2[lumber-mill]" }) -LumberMill.RecipeBuilder:new() - :ingredients(table.trim({ - { type = "item", name = "stone-brick", amount = 40 }, - { type = "item", name = "lumber", amount = 50 }, + LumberMill.RecipeBuilder:new() + :ingredients(table.trim({ + { type = "item", name = "stone-brick", amount = 40 }, + { type = "item", name = "lumber", amount = 50 }, { type = "item", name = "wooden-gear-wheel", amount = 50 }, - { type = "item", name = "gold-plate", amount = basic_circuit_board and 20 or 40 }, + { type = "item", name = "gold-plate", amount = basic_circuit_board and 20 or 40 }, basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 20 } or nil, { type = "item", name = "burner-assembling-machine", amount = 2 } })) - :apply({ - additional_categories = { "wood-processing" } + :apply({ + additional_categories = { "wood-processing" } }) -LumberMill.TechnologyBuilder:new() - :prerequisites({ "steam-science-pack" }) - :count(250) - :time(15) - :ingredients({ { "wood-science-pack", 1 }, { "steam-science-pack", 1 } }) - :apply() + LumberMill.TechnologyBuilder:new() + :prerequisites({ "steam-science-pack" }) + :count(250) + :time(15) + :ingredients({ { "wood-science-pack", 1 }, { "steam-science-pack", 1 } }) + :apply() -LumberMill.RecipeBuilder:new() - :ingredients({ - { type = "item", name = "stone-brick", amount = 40 }, - { type = "item", name = "lumber", amount = 50 }, - { type = "item", name = "wooden-gear-wheel", amount = 50 }, - { type = "item", name = "copper-plate", amount = basic_circuit_board and 20 or 40 }, + LumberMill.RecipeBuilder:new() + :ingredients({ + { type = "item", name = "stone-brick", amount = 40 }, + { type = "item", name = "lumber", amount = 50 }, + { type = "item", name = "wooden-gear-wheel", amount = 50 }, + { type = "item", name = "copper-plate", amount = basic_circuit_board and 20 or 40 }, { type = "item", name = basic_circuit_board and "basic-circuit-board" or "electronic-circuit", amount = 20 }, - { type = "item", name = "assembling-machine-1", amount = 2 } + { type = "item", name = "assembling-machine-1", amount = 2 } }) - :apply({ + :apply({ name = "lumber-mill-copper", localised_name = { "entity-name.lumber-mill" }, - additional_categories = { "wood-processing" }, + additional_categories = { "wood-processing" }, icons = { { icon = lumber_mill_item.icon }, { icon = basic_circuit_board and "__base__/graphics/icons/copper-plate.png" or "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } } } }) -Technology:new(basic_circuit_board and "copper-processing" or "electronics"):addRecipe("lumber-mill-copper") + Technology:new(basic_circuit_board and "copper-processing" or "electronics"):addRecipe("lumber-mill-copper") +else + table.assign(data.raw["assembling-machine"]["lumber-mill"], { + energy_source = { + type = "burner", + fuel_categories = { "chemical" }, + effectivity = 1, + fuel_inventory_size = 3, + emissions_per_minute = { pollution = 10, noise = 100 }, + }, + crafting_categories = { "wood-processing" }, + energy_usage = "1000kW", + surface_conditions = { + { + property = has_oxygen and "oxygen" or "pressure", + min = 3 + }, + { + property = "gravity", + min = 1 + } + } + }) + + data.raw.item["lumber-mill"].default_import_location = "lignumis" + + table.assign(data.raw.recipe["lumber-mill"], { + additional_categories = { "wood-processing" }, + ingredients = table.trim({ + { type = "item", name = "stone-brick", amount = 40 }, + { type = "item", name = "lumber", amount = 50 }, + { type = "item", name = "wooden-gear-wheel", amount = 50 }, + { type = "item", name = "gold-plate", amount = basic_circuit_board and 20 or 40 }, + basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 20 } or nil, + { type = "item", name = "burner-assembling-machine", amount = 2 } + }) + }) + + table.assign(data.raw.technology["advanced-carpentry"], { + prerequisites = { "steam-science-pack" }, + unit = { + count = 250, + time = 15, + ingredients = { + { "wood-science-pack", 1 }, + { "steam-science-pack", 1 } + } + } + }) + + Recipe:new("lumber-mill") + :clone("lumber-mill-copper") + :assign({ + localised_name = { "entity-name.lumber-mill" }, + icons = { + { icon = data.raw.item["lumber-mill"].icon }, + { icon = basic_circuit_board and "__base__/graphics/icons/copper-plate.png" or "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } } + } + }) + :replaceIngredient("gold-plate", "copper-plate") + :apply() + + Technology:new(basic_circuit_board and "copper-processing" or "electronics"):addRecipe("lumber-mill-copper") +end + +Recipe:new("wooden-chest"):addCategory("wood-processing") +Recipe:new("small-electric-pole"):addCategory("wood-processing") \ No newline at end of file