Add support for wood logistics

This commit is contained in:
Simon Brodtmann 2025-12-12 18:25:42 +01:00
parent 663779901d
commit 996fd2f7c4
7 changed files with 326 additions and 183 deletions

View file

@ -12,7 +12,7 @@
"space-age >= 2.0.53", "space-age >= 2.0.53",
"astroponics >= 1.2.0", "astroponics >= 1.2.0",
"bioprocessing-tab", "bioprocessing-tab",
"cf-lib >= 0.0.13", "cf-lib >= 1.1.0",
"flib", "flib",
"gleba-water-cane", "gleba-water-cane",
"lignumis-assets >= 1.0.3", "lignumis-assets >= 1.0.3",
@ -23,29 +23,29 @@
"pollution-as-surface-property", "pollution-as-surface-property",
"Wood-Walls >= 1.2.0", "Wood-Walls >= 1.2.0",
"vulcanus-sulfuric-bacteria", "vulcanus-sulfuric-bacteria",
"?aai-industry", "? aai-industry",
"?aai-loaders", "? aai-loaders",
"?aai-loaders-sane", "? aai-loaders-sane",
"?any-planet-start", "? any-planet-start",
"?atan-nuclear-science", "? crushing-industry",
"?crushing-industry", "? fulgora-coralmium-agriculture",
"?Diversitree", "? hot-metals >= 1.1.0",
"?fulgora-coralmium-agriculture", "? lane-splitters",
"?gleba-reborn", "? wood-industry",
"?hot-metals >= 1.1.0", "? wood-military >= 2.3.3",
"?Krastorio2-spaced-out", "? canal-excavator >= 1.9.0",
"?lane-splitters", "? wood-logistics",
"?metal-and-stars", "(?) atan-nuclear-science",
"(?)secretas", "(?) Diversitree",
"(?)Wood_Gasification_updated", "(?) gleba-reborn",
"?wood-industry", "(?) Krastorio2-spaced-out",
"?wood-military >= 2.3.3", "(?) metal-and-stars",
"?canal-excavator >= 1.9.0", "(?) secretas",
"!apm_power_ldinc", "(?) Wood_Gasification_updated",
"!early-agriculture", "! apm_power_ldinc",
"!planet-picker", "! early-agriculture",
"!wood-logistics", "! planet-picker",
"!wood-universe-modpack", "! wood-universe-modpack",
"!rso-mod" "! rso-mod"
] ]
} }

View file

@ -1,3 +1,4 @@
local Recipe = require("__cf-lib__/data/Recipe")
local Technology = require("__cf-lib__/data/Technology") local Technology = require("__cf-lib__/data/Technology")
local LumberMillFactory = require(MF.buildings .. "LumberMill") local LumberMillFactory = require(MF.buildings .. "LumberMill")
local LumberMill = LumberMillFactory() local LumberMill = LumberMillFactory()
@ -13,68 +14,137 @@ data:extend({
local has_oxygen = data.raw["surface-property"]["oxygen"] ~= nil local has_oxygen = data.raw["surface-property"]["oxygen"] ~= nil
LumberMill.EntityBuilder:new() if not mods["wood-logistics"] then
:burnerEnergySource({ emissions_per_minute = { noise = 100 } }) LumberMill.EntityBuilder:new()
:baseProductivity(0.5) :burnerEnergySource({ emissions_per_minute = { noise = 100 } })
:apply({ :baseProductivity(0.5)
crafting_categories = { "wood-processing" }, :apply({
crafting_categories = { "wood-processing" },
crafting_speed = 2, crafting_speed = 2,
energy_usage = "1000kW", energy_usage = "1000kW",
surface_conditions = { surface_conditions = {
{ {
property = has_oxygen and "oxygen" or "pressure", property = has_oxygen and "oxygen" or "pressure",
min = 3 min = 3
}, },
{ {
property = "gravity", property = "gravity",
min = 1 min = 1
} }
} }
}) })
local lumber_mill_item = LumberMill.ItemBuilder:new() local lumber_mill_item = LumberMill.ItemBuilder:new()
:apply({ :apply({
default_import_location = "lignumis", default_import_location = "lignumis",
order = "2[lumber-mill]" order = "2[lumber-mill]"
}) })
LumberMill.RecipeBuilder:new() LumberMill.RecipeBuilder:new()
:ingredients(table.trim({ :ingredients(table.trim({
{ type = "item", name = "stone-brick", amount = 40 }, { type = "item", name = "stone-brick", amount = 40 },
{ type = "item", name = "lumber", amount = 50 }, { type = "item", name = "lumber", amount = 50 },
{ type = "item", name = "wooden-gear-wheel", 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, basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 20 } or nil,
{ type = "item", name = "burner-assembling-machine", amount = 2 } { type = "item", name = "burner-assembling-machine", amount = 2 }
})) }))
:apply({ :apply({
additional_categories = { "wood-processing" } additional_categories = { "wood-processing" }
}) })
LumberMill.TechnologyBuilder:new() LumberMill.TechnologyBuilder:new()
:prerequisites({ "steam-science-pack" }) :prerequisites({ "steam-science-pack" })
:count(250) :count(250)
:time(15) :time(15)
:ingredients({ { "wood-science-pack", 1 }, { "steam-science-pack", 1 } }) :ingredients({ { "wood-science-pack", 1 }, { "steam-science-pack", 1 } })
:apply() :apply()
LumberMill.RecipeBuilder:new() LumberMill.RecipeBuilder:new()
:ingredients({ :ingredients({
{ type = "item", name = "stone-brick", amount = 40 }, { type = "item", name = "stone-brick", amount = 40 },
{ type = "item", name = "lumber", amount = 50 }, { type = "item", name = "lumber", amount = 50 },
{ type = "item", name = "wooden-gear-wheel", 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 = "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 = 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", name = "lumber-mill-copper",
localised_name = { "entity-name.lumber-mill" }, localised_name = { "entity-name.lumber-mill" },
additional_categories = { "wood-processing" }, additional_categories = { "wood-processing" },
icons = { icons = {
{ icon = lumber_mill_item.icon }, { 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 } } { 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",
module_slots = 4,
max_health = 500,
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")

View file

@ -1,34 +1,39 @@
local item_sounds = require("__base__.prototypes.item_sounds") local item_sounds = require("__base__.prototypes.item_sounds")
local Recipe = require("__cf-lib__/data/Recipe")
data:extend({ if not mods["wood-logistics"] then
{ data:extend({
type = "item", {
name = "lumber", type = "item",
icon = Lignumis.graphics .. "icons/lumber.png", name = "lumber",
pictures = { icon = Lignumis.graphics .. "icons/lumber.png",
{ filename = Lignumis.graphics .. "icons/lumber.png", size = 64, scale = 0.5 }, pictures = {
{ filename = Lignumis.graphics .. "icons/lumber-1.png", size = 64, scale = 0.5 }, { filename = Lignumis.graphics .. "icons/lumber.png", size = 64, scale = 0.5 },
{ filename = Lignumis.graphics .. "icons/lumber-2.png", size = 64, scale = 0.5 }, { filename = Lignumis.graphics .. "icons/lumber-1.png", size = 64, scale = 0.5 },
{ filename = Lignumis.graphics .. "icons/lumber-2.png", size = 64, scale = 0.5 },
},
subgroup = "intermediate-product",
order = "A[basic-intermediates]-c[lumber]",
inventory_move_sound = item_sounds.wood_inventory_move,
pick_sound = item_sounds.wood_inventory_pickup,
drop_sound = item_sounds.wood_inventory_move,
stack_size = 100,
random_tint_color = { 1.0, 0.95, 0.9, 1.0 },
fuel_category = "wood",
fuel_value = "4MJ"
}, },
subgroup = "intermediate-product", {
order = "A[basic-intermediates]-c[lumber]", type = "recipe",
inventory_move_sound = item_sounds.wood_inventory_move, name = "lumber",
pick_sound = item_sounds.wood_inventory_pickup, category = "crafting",
drop_sound = item_sounds.wood_inventory_move, additional_categories = { "wood-processing" },
stack_size = 100, allow_productivity = true,
random_tint_color = { 1.0, 0.95, 0.9, 1.0 }, allow_as_intermediate = true,
fuel_category = "wood", ingredients = { { type = "item", name = "wood", amount = 2 } },
fuel_value = "4MJ" results = { { type = "item", name = "lumber", amount = 1 } },
}, energy_required = 1
{ }
type = "recipe", })
name = "lumber", else
category = "crafting", Recipe:new("lumber"):addCategory("wood-processing")
additional_categories = { "wood-processing" }, end
allow_productivity = true,
allow_as_intermediate = true,
ingredients = { { type = "item", name = "wood", amount = 2 } },
results = { { type = "item", name = "lumber", amount = 1 } },
energy_required = 1
}
})

View file

@ -100,17 +100,17 @@ emit("lab", "biolab", 20)
emit("locomotive", "locomotive", 200) emit("locomotive", "locomotive", 200)
emit_constant("locomotive", "locomotive", 10) emit_constant("locomotive", "locomotive", 10)
--emit_constant("transport-belt", "wood-transport-belt", 2) emit_constant("transport-belt", "wood-transport-belt", 2)
emit_constant("transport-belt", "transport-belt", 3) emit_constant("transport-belt", "transport-belt", 3)
emit_constant("transport-belt", "fast-transport-belt", 4) emit_constant("transport-belt", "fast-transport-belt", 4)
emit_constant("transport-belt", "express-transport-belt", 6) emit_constant("transport-belt", "express-transport-belt", 6)
emit_constant("transport-belt", "turbo-transport-belt", 8) emit_constant("transport-belt", "turbo-transport-belt", 8)
--emit_constant("underground-belt", "wood-underground-belt", 7.5) emit_constant("underground-belt", "wood-underground-belt", 7.5)
emit_constant("underground-belt", "underground-belt", 10) emit_constant("underground-belt", "underground-belt", 10)
emit_constant("underground-belt", "fast-underground-belt", 20) emit_constant("underground-belt", "fast-underground-belt", 20)
emit_constant("underground-belt", "express-underground-belt", 30) emit_constant("underground-belt", "express-underground-belt", 30)
emit_constant("underground-belt", "turbo-underground-belt", 40) emit_constant("underground-belt", "turbo-underground-belt", 40)
--emit_constant("splitter", "wood-splitter", 20) emit_constant("splitter", "wood-splitter", 20)
emit_constant("splitter", "splitter", 30) emit_constant("splitter", "splitter", 30)
emit_constant("splitter", "fast-splitter", 40) emit_constant("splitter", "fast-splitter", 40)
emit_constant("splitter", "express-splitter", 50) emit_constant("splitter", "express-splitter", 50)

View file

@ -1,104 +1,151 @@
local BeltFactory = require(MF.logistics .. "Belts") local BeltFactory = require(MF.logistics .. "Belts")
local Belt = BeltFactory("wood", "brown", "slow") local Belt = BeltFactory("wood", "brown", "slow")
local Recipe = require("__cf-lib__/data/Recipe")
local Item = require("__cf-lib__/data/Item")
local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value
Belt.EntityBuilder:new() if not mods["wood-logistics"] then
:itemsPerSecond(7.5) Belt.EntityBuilder:new()
:nextTier("") :itemsPerSecond(7.5)
:undergroundDistance(4) :nextTier("")
:animationSpeedMultiplier(1.01) :undergroundDistance(4)
:apply({ :animationSpeedMultiplier(1.01)
transportBelt = { :apply({
emissions_per_second = { noise = 2 / 60 } transportBelt = {
}, emissions_per_second = { noise = 2 / 60 }
undergroundBelt = { },
emissions_per_second = { noise = 7.5 / 60 }, undergroundBelt = {
factoriopedia_simulation = { emissions_per_second = { noise = 7.5 / 60 },
init = factoriopedia_simulation = {
[[ init =
game.simulation.camera_position = {0, 0.5} [[
game.simulation.camera_zoom = 1.8 game.simulation.camera_position = {0, 0.5}
game.surfaces[1].create_entities_from_blueprint_string game.simulation.camera_zoom = 1.8
{ game.surfaces[1].create_entities_from_blueprint_string
string = "0eNqVUNsKgzAM/Zc81+FEBfsrYwwvQQKaltpuivjvS3Wwh8HGnkKSc0tWaIaA1hF70CtMXNvEm6R31MV+Bl0oWECfNwXUGp5AXwRGPddDBHA9Imh4GNMlgTt0vTNSkwYHD5EjsznSrwqQPXnCQ2JvlhuHsUEnAPVdSoE1k7ANv2KlpyOYVLHpyGF7bHMFfrFRidiGGOLDLPvXLP9tZoLf3eRO8jjK5P1YBXd0004oyqzKq6ooqzLNinLbnvlmf6E=", {
position = {-0.5, 0} string = "0eNqVUNsKgzAM/Zc81+FEBfsrYwwvQQKaltpuivjvS3Wwh8HGnkKSc0tWaIaA1hF70CtMXNvEm6R31MV+Bl0oWECfNwXUGp5AXwRGPddDBHA9Imh4GNMlgTt0vTNSkwYHD5EjsznSrwqQPXnCQ2JvlhuHsUEnAPVdSoE1k7ANv2KlpyOYVLHpyGF7bHMFfrFRidiGGOLDLPvXLP9tZoLf3eRO8jjK5P1YBXd0004oyqzKq6ooqzLNinLbnvlmf6E=",
position = {-0.5, 0}
}
]]
} }
]] },
splitter = {
emissions_per_second = { noise = 20 / 60 }
} }
}, })
splitter = {
emissions_per_second = { noise = 20 / 60 }
}
})
local splitter_item = Belt.ItemBuilder:new() local splitter_item = Belt.ItemBuilder:new()
:itemsPerRocket("transportBelt", 200) :itemsPerRocket("transportBelt", 200)
:itemsPerRocket("undergroundBelt", 100) :itemsPerRocket("undergroundBelt", 100)
:itemsPerRocket("splitter", 100) :itemsPerRocket("splitter", 100)
:order("0") :order("0")
:apply() :apply()
.splitter .splitter
Belt.RecipeBuilder:new() Belt.RecipeBuilder:new()
:beltAmount(2) :beltAmount(2)
:ingredients("transportBelt", { :ingredients("transportBelt", {
{ type = "item", name = "lumber", amount = 1 }, { type = "item", name = "lumber", amount = 1 },
{ type = "item", name = "wooden-gear-wheel", amount = 1 } { type = "item", name = "wooden-gear-wheel", amount = 1 }
}) })
:ingredients("undergroundBelt", { :ingredients("undergroundBelt", {
{ type = "item", name = "lumber", amount = 1 }, { type = "item", name = "lumber", amount = 1 },
{ type = "item", name = "wood-transport-belt", amount = 4 }, { type = "item", name = "wood-transport-belt", amount = 4 },
}) })
:ingredients("splitter", { :ingredients("splitter", {
{ type = "item", name = "wood-transport-belt", amount = 2 }, { type = "item", name = "wood-transport-belt", amount = 2 },
{ type = "item", name = "lumber", amount = 2 }, { type = "item", name = "lumber", amount = 2 },
basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 5 } or basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 5 } or
{ type = "item", name = "gold-cable", amount = 10 } { type = "item", name = "gold-cable", amount = 10 }
}) })
:apply({ :apply({
transportBelt = { transportBelt = {
additional_categories = { "wood-processing" }
},
undergroundBelt = {
additional_categories = { "wood-processing" }
},
splitter = {
additional_categories = { "wood-processing" }
}
})
Belt.TechnologyBuilder:new()
:prerequisites({ "wood-science-pack" })
:ingredients({ { "wood-science-pack", 1 } })
:count(10)
:time(10)
:apply()
if not basic_circuit_board then
data:extend({
Belt.RecipeBuilder:new()
:ingredients("splitter", {
{ type = "item", name = "wood-transport-belt", amount = 2 },
{ type = "item", name = "lumber", amount = 2 },
{ type = "item", name = "electronic-circuit", amount = 2 }
})
:build({
splitter = {
name = "wood-splitter-electronic-circuit",
localised_name = { "entity-name.wood-splitter" },
icons = {
{ icon = splitter_item.icon },
{ icon = "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } }
},
additional_categories = { "wood-processing" }
}
})
.splitter
})
table.insert(data.raw.technology["electronics"].effects, {
type = "unlock-recipe",
recipe = "wood-splitter-electronic-circuit"
})
end
else
Recipe:new("wood-transport-belt")
:replaceIngredient("copper-cable", "wooden-gear-wheel", 1)
:assign({
additional_categories = { "wood-processing" } additional_categories = { "wood-processing" }
}, })
undergroundBelt = {
additional_categories = { "wood-processing" }
},
splitter = {
additional_categories = { "wood-processing" }
}
})
Belt.TechnologyBuilder:new() Recipe:new("wood-underground-belt")
:prerequisites({ "wood-science-pack" }) :assign({
:ingredients({ { "wood-science-pack", 1 } }) additional_categories = { "wood-processing" }
:count(10) })
:time(10)
:apply()
if not basic_circuit_board then Recipe:new("wood-splitter")
data:extend({ :replaceIngredient("copper-cable", basic_circuit_board and "basic-circuit-board" or "gold-cable", basic_circuit_board and 5 or nil)
Belt.RecipeBuilder:new() :assign({
:ingredients("splitter", { additional_categories = { "wood-processing" }
{ type = "item", name = "wood-transport-belt", amount = 2 }, })
{ type = "item", name = "lumber", amount = 2 },
{ type = "item", name = "electronic-circuit", amount = 2 } if not basic_circuit_board then
}) Recipe:new("wood-splitter")
:build({ :clone("wood-splitter-electronic-circuit")
splitter = { :replaceIngredient(basic_circuit_board and "gold-cable" or "basic-circuit-board", "electronic-circuit", 2)
name = "wood-splitter-electronic-circuit", :assign({
localised_name = { "entity-name.wood-splitter" }, localised_name = { "entity-name.wood-splitter" },
icons = { icons = {
{ icon = splitter_item.icon }, { icon = data.raw.item["wood-splitter"].icon },
{ icon = "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } } { icon = "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } }
},
additional_categories = { "wood-processing" }
} }
}) })
.splitter :unlockedByTechnology("electronics")
}) :apply()
end
table.insert(data.raw.technology["electronics"].effects, { Item:new("wood-transport-belt")
type = "unlock-recipe", :itemsPerRocket(200)
recipe = "wood-splitter-electronic-circuit" :defaultImportLocation("lignumis")
}) Item:new("wood-underground-belt")
end :itemsPerRocket(100)
:defaultImportLocation("lignumis")
Item:new("wood-splitter")
:itemsPerRocket(100)
:defaultImportLocation("lignumis")
end

View file

@ -1 +1,2 @@
require("wood-logistics")
require("wood-military") require("wood-military")

View file

@ -0,0 +1,20 @@
if not mods["wood-logistics"] then
return
end
local Settings = require("__cf-lib__/settings/Settings")
local force = Settings.force
local default = Settings.default
force("wood-logistics-lumber", true)
force("wood-logistics-lumber-mill", true)
force("wood-logistics-woodtronics", false)
force("wood-logistics-belts", true)
force("wood-logistics-belts-modify", false)
default("wood-logistics-belts-circuits", true)
force("wood-logistics-inserter", false)
default("wood-logistics-rail-cost", 0)
default("wood-logistics-cargo-wagon", false)
force("wood-logistics-assembling-machine", false)
default("wood-logistics-nerf-small-electric-pole", false)
force("wood-logistics-repair-pack-cost", 0)