diff --git a/lignumis/info.json b/lignumis/info.json index 998fce9..c35c5f6 100644 --- a/lignumis/info.json +++ b/lignumis/info.json @@ -16,6 +16,9 @@ "flib", "gleba-water-cane", "lignumis-assets >= 1.0.3", + "mf-buildings >= 1.0.7", + "mf-core >= 1.0.3", + "mf-logistics >= 1.0.1", "PlanetsLib >= 1.14.7", "pollution-as-surface-property", "Wood-Walls >= 1.2.0", @@ -43,11 +46,6 @@ "! early-agriculture", "! planet-picker", "! wood-universe-modpack", - "! rso-mod", - "! mf-core", - "! mf-buildings", - "! mf-buildings-graphics-1", - "! mf-logistics", - "! mf-logistics-graphics-1" + "! rso-mod" ] } \ No newline at end of file diff --git a/lignumis/prototypes/content/wood-logistics.lua b/lignumis/prototypes/content/wood-logistics.lua index fe0d8d9..31f3809 100644 --- a/lignumis/prototypes/content/wood-logistics.lua +++ b/lignumis/prototypes/content/wood-logistics.lua @@ -1,456 +1,108 @@ -local hit_effects = require("__base__.prototypes.entity.hit-effects") -local sounds = require("__base__.prototypes.entity.sounds") -local item_sounds = require("__base__.prototypes.item_sounds") -local Recipe = require("__cf-lib__/data/Recipe") +local BeltFactory = require(MF.logistics .. "Belts") +local Belt = BeltFactory("wood", "brown", "slow") + +local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value if mods["wood-logistics"] and settings.startup["wood-logistics-belts"].value then return end -local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value -local speed = 7.5 -local name = "wood" -local transportBeltName = name .. "-transport-belt" -local undergroundBeltName = name .. "-underground-belt" -local splitterName = name .. "-splitter" -local gfx = Lignumis.graphics .. "entity/wood-logistics/" +Belt.EntityBuilder:new() + :itemsPerSecond(7.5) + :nextTier("") + :undergroundDistance(4) + :animationSpeedMultiplier(1.01) + :apply({ + transportBelt = { + emissions_per_second = { noise = 2 / 60 } + }, + undergroundBelt = { + emissions_per_second = { noise = 7.5 / 60 }, + factoriopedia_simulation = { + init = + [[ + game.simulation.camera_position = {0, 0.5} + game.simulation.camera_zoom = 1.8 + game.surfaces[1].create_entities_from_blueprint_string + { + string = "0eNqVUNsKgzAM/Zc81+FEBfsrYwwvQQKaltpuivjvS3Wwh8HGnkKSc0tWaIaA1hF70CtMXNvEm6R31MV+Bl0oWECfNwXUGp5AXwRGPddDBHA9Imh4GNMlgTt0vTNSkwYHD5EjsznSrwqQPXnCQ2JvlhuHsUEnAPVdSoE1k7ANv2KlpyOYVLHpyGF7bHMFfrFRidiGGOLDLPvXLP9tZoLf3eRO8jjK5P1YBXd0004oyqzKq6ooqzLNinLbnvlmf6E=", + position = {-0.5, 0} + } + ]] + } + }, + splitter = { + emissions_per_second = { noise = 20 / 60 } + } + }) -data:extend({ - { - type = "transport-belt", - name = transportBeltName, - icon = Lignumis.graphics .. "icons/wood-transport-belt.png", - flags = { "placeable-neutral", "player-creation" }, - minable = { mining_time = 0.1, result = transportBeltName }, - max_health = 150, - next_upgrade = "transport-belt", - corpse = transportBeltName .. "-remnants", - dying_explosion = "transport-belt-explosion", - resistances = { - { - type = "fire", - percent = 90 - } +local splitter_item = Belt.ItemBuilder:new() + :itemsPerRocket("transportBelt", 200) + :itemsPerRocket("undergroundBelt", 100) + :itemsPerRocket("splitter", 100) + :order("0") + :apply() + .splitter + +Belt.RecipeBuilder:new() + :beltAmount(2) + :ingredients("transportBelt", { + { type = "item", name = "lumber", amount = 1 }, + { type = "item", name = "wooden-gear-wheel", amount = 1 } + }) + :ingredients("undergroundBelt", { + { type = "item", name = "lumber", amount = 1 }, + { type = "item", name = "wood-transport-belt", amount = 4 }, + }) + :ingredients("splitter", { + { type = "item", name = "wood-transport-belt", amount = 2 }, + { type = "item", name = "lumber", amount = 2 }, + basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 5 } or + { type = "item", name = "gold-cable", amount = 10 } + }) + :apply({ + transportBelt = { + additional_categories = { "wood-processing" } }, - emissions_per_second = { noise = 2 / 60 }, - collision_box = { { -0.4, -0.4 }, { 0.4, 0.4 } }, - selection_box = { { -0.5, -0.5 }, { 0.5, 0.5 } }, - damaged_trigger_effect = hit_effects.entity(), - open_sound = sounds.transport_belt_open, - close_sound = sounds.transport_belt_close, - working_sound = { - sound = { filename = "__base__/sound/transport-belt.ogg", volume = 0.17 }, - persistent = true + undergroundBelt = { + additional_categories = { "wood-processing" } }, - animation_speed_coefficient = 1.01 * 32, - fast_replaceable_group = "transport-belt", - related_underground_belt = undergroundBeltName, - speed = speed, - connector_frame_sprites = transport_belt_connector_frame_sprites, - circuit_connector = circuit_connector_definitions["belt"], - circuit_wire_max_distance = transport_belt_circuit_wire_max_distance - }, - { - type = "corpse", - name = transportBeltName .. "-remnants", - icon = Lignumis.graphics .. "icons/wood-transport-belt.png", - hidden_in_factoriopedia = true, - flags = { "placeable-neutral", "not-on-map" }, - subgroup = "belt-remnants", - order = "a-a-a", - selection_box = { { -0.5, -0.5 }, { 0.5, 0.5 } }, - tile_width = 1, - tile_height = 1, - selectable_in_game = false, - time_before_removed = 60 * 60 * 15, -- 15 minutes - expires = false, - final_render_layer = "remnants", - animation = make_rotated_animation_variations_from_sheet(2, { - filename = gfx .. "wood-transport-belt-remnants.png", - line_length = 1, - width = 106, - height = 102, - direction_count = 4, - shift = util.by_pixel(1, -0.5), - scale = 0.5 - }) - }, - { - type = "underground-belt", - name = undergroundBeltName, - icon = Lignumis.graphics .. "icons/wood-underground-belt.png", - flags = { "placeable-neutral", "player-creation" }, - minable = { mining_time = 0.1, result = undergroundBeltName }, - max_health = 150, - next_upgrade = "underground-belt", - corpse = undergroundBeltName .. "-remnants", - dying_explosion = "underground-belt-explosion", - factoriopedia_simulation = { - init = - [[ - game.simulation.camera_position = {0, 0.5} - game.simulation.camera_zoom = 1.8 - game.surfaces[1].create_entities_from_blueprint_string - { - string = "0eNqVUNsKgzAM/Zc81+FEBfsrYwwvQQKaltpuivjvS3Wwh8HGnkKSc0tWaIaA1hF70CtMXNvEm6R31MV+Bl0oWECfNwXUGp5AXwRGPddDBHA9Imh4GNMlgTt0vTNSkwYHD5EjsznSrwqQPXnCQ2JvlhuHsUEnAPVdSoE1k7ANv2KlpyOYVLHpyGF7bHMFfrFRidiGGOLDLPvXLP9tZoLf3eRO8jjK5P1YBXd0004oyqzKq6ooqzLNinLbnvlmf6E=", - position = {-0.5, 0} - } - ]] - }, - max_distance = 4, - open_sound = sounds.machine_open, - close_sound = sounds.machine_close, - working_sound = table.deepcopy(data.raw["underground-belt"]["underground-belt"].working_sound), - underground_sprite = table.deepcopy(data.raw["underground-belt"]["underground-belt"].underground_sprite), - resistances = { - { - type = "fire", - percent = 60 - }, - { - type = "impact", - percent = 30 - } - }, - emissions_per_second = { noise = 7.5 / 60 }, - collision_box = { { -0.4, -0.4 }, { 0.4, 0.4 } }, - selection_box = { { -0.5, -0.5 }, { 0.5, 0.5 } }, - damaged_trigger_effect = hit_effects.entity(), - animation_speed_coefficient = 1.01 * 32, - fast_replaceable_group = "transport-belt", - speed = speed, - structure = { - direction_in = { - sheet = { - filename = gfx .. "wood-underground-belt-structure.png", - priority = "extra-high", - width = 192, - height = 192, - y = 192, - scale = 0.5 - } - }, - direction_out = { - sheet = { - filename = gfx .. "wood-underground-belt-structure.png", - priority = "extra-high", - width = 192, - height = 192, - scale = 0.5 - } - }, - direction_in_side_loading = { - sheet = { - filename = gfx .. "wood-underground-belt-structure.png", - priority = "extra-high", - width = 192, - height = 192, - y = 192 * 3, - scale = 0.5 - } - }, - direction_out_side_loading = { - sheet = { - filename = gfx .. "wood-underground-belt-structure.png", - priority = "extra-high", - width = 192, - height = 192, - y = 192 * 2, - scale = 0.5 - } - }, - back_patch = { - sheet = { - filename = - "__base__/graphics/entity/underground-belt/underground-belt-structure-back-patch.png", - priority = "extra-high", - width = 192, - height = 192, - scale = 0.5 - } - }, - front_patch = { - sheet = { - filename = - "__base__/graphics/entity/underground-belt/underground-belt-structure-front-patch.png", - priority = "extra-high", - width = 192, - height = 192, - scale = 0.5 - } - } + splitter = { + additional_categories = { "wood-processing" } } - }, - { - type = "corpse", - name = undergroundBeltName .. "-remnants", - icon = Lignumis.graphics .. "icons/wood-underground-belt.png", - hidden_in_factoriopedia = true, - flags = { "placeable-neutral", "not-on-map", "building-direction-8-way" }, - subgroup = "belt-remnants", - order = "a-d-a", - selection_box = { { -0.5, -0.5 }, { 0.5, 0.5 } }, - tile_width = 1, - tile_height = 1, - selectable_in_game = false, - time_before_removed = 60 * 60 * 15, -- 15 minutes - expires = false, - final_render_layer = "remnants", - remove_on_tile_placement = false, - animation = { - filename = gfx .. "wood-underground-belt-remnants.png", - line_length = 1, - width = 156, - height = 144, - direction_count = 8, - shift = util.by_pixel(10.5, 3), - scale = 0.5 - } - }, - { - type = "splitter", - name = splitterName, - icon = Lignumis.graphics .. "icons/wood-splitter.png", - flags = { "placeable-neutral", "player-creation" }, - minable = { mining_time = 0.1, result = splitterName }, - max_health = 170, - next_upgrade = "splitter", - corpse = splitterName .. "-remnants", - dying_explosion = "splitter-explosion", - resistances = { - { - type = "fire", - percent = 60 - } - }, - emissions_per_second = { noise = 20 / 60 }, - collision_box = { { -0.9, -0.4 }, { 0.9, 0.4 } }, - selection_box = { { -0.9, -0.5 }, { 0.9, 0.5 } }, - damaged_trigger_effect = hit_effects.entity(), - animation_speed_coefficient = 1.01 * 32, - structure_animation_speed_coefficient = 0.7, - structure_animation_movement_cooldown = 10, - icon_draw_specification = { scale = 0.5 }, - fast_replaceable_group = "transport-belt", - speed = speed, - open_sound = sounds.machine_open, - close_sound = sounds.machine_close, - working_sound = sounds.splitter, - related_transport_belt = transportBeltName, - structure = { - north = { - filename = gfx .. "wood-splitter-north.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 160, - height = 70, - shift = util.by_pixel(7, 0), - scale = 0.5 - }, - east = { - filename = gfx .. "wood-splitter-east.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 90, - height = 84, - shift = util.by_pixel(4, 13), - scale = 0.5 - }, - south = { - filename = gfx .. "wood-splitter-south.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 164, - height = 64, - shift = util.by_pixel(4, 0), - scale = 0.5 - }, - west = { - filename = gfx .. "wood-splitter-west.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 90, - height = 86, - shift = util.by_pixel(6, 12), - scale = 0.5 - } - }, - structure_patch = { - north = util.empty_sprite(), - east = { - filename = gfx .. "wood-splitter-east-top_patch.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 90, - height = 104, - shift = util.by_pixel(4, -20), - scale = 0.5 - }, - south = util.empty_sprite(), - west = { - filename = gfx .. "wood-splitter-west-top_patch.png", - frame_count = 32, - line_length = 8, - priority = "extra-high", - width = 90, - height = 96, - shift = util.by_pixel(6, -18), - scale = 0.5 - } - } - }, - { - type = "corpse", - name = splitterName .. "-remnants", - icon = Lignumis.graphics .. "icons/wood-splitter.png", - hidden_in_factoriopedia = true, - flags = { "placeable-neutral", "not-on-map" }, - subgroup = "belt-remnants", - order = "a-g-a", - selection_box = { { -0.9, -0.5 }, { 0.9, 0.5 } }, - tile_width = 2, - tile_height = 1, - selectable_in_game = false, - time_before_removed = 60 * 60 * 15, -- 15 minutes - expires = false, - final_render_layer = "remnants", - remove_on_tile_placement = false, - animation = { - filename = gfx .. "wood-splitter-remnants.png", - line_length = 1, - width = 190, - height = 190, - direction_count = 4, - shift = util.by_pixel(3.5, 1.5), - scale = 0.5 - } - }, - { - type = "item", - name = transportBeltName, - icon = Lignumis.graphics .. "icons/wood-transport-belt.png", - subgroup = "belt", - color_hint = { text = "1" }, - order = "a[transport-belt]-0[" .. transportBeltName .. "]", - inventory_move_sound = item_sounds.transport_belt_inventory_move, - pick_sound = item_sounds.transport_belt_inventory_pickup, - drop_sound = item_sounds.transport_belt_inventory_move, - place_result = transportBeltName, - stack_size = 100, - weight = 5 * kg - }, - { - type = "item", - name = undergroundBeltName, - icon = Lignumis.graphics .. "icons/wood-underground-belt.png", - subgroup = "belt", - color_hint = { text = "1" }, - order = "b[underground-belt]-0[" .. undergroundBeltName .. "]", - inventory_move_sound = item_sounds.mechanical_inventory_move, - pick_sound = item_sounds.mechanical_inventory_pickup, - drop_sound = item_sounds.mechanical_inventory_move, - place_result = undergroundBeltName, - stack_size = 50, - weight = 10 * kg - }, - { - type = "item", - name = splitterName, - icon = Lignumis.graphics .. "icons/wood-splitter.png", - subgroup = "belt", - color_hint = { text = "1" }, - order = "c[splitter]-0[" .. splitterName .. "]", - inventory_move_sound = item_sounds.mechanical_inventory_move, - pick_sound = item_sounds.mechanical_inventory_pickup, - drop_sound = item_sounds.mechanical_inventory_move, - place_result = splitterName, - stack_size = 50, - weight = 10 * kg - }, - { - type = "recipe", - name = transportBeltName, - enabled = false, - energy_required = 0.5, - results = { { type = "item", name = transportBeltName, amount = 2 } }, - ingredients = { - { type = "item", name = "lumber", amount = 1 }, - { type = "item", name = "wooden-gear-wheel", amount = 1 } - } - }, - { - type = "recipe", - name = undergroundBeltName, - category = "crafting", - additional_categories = { "wood-processing" }, - enabled = false, - energy_required = 1, - ingredients = { - { type = "item", name = "lumber", amount = 1 }, - { type = "item", name = "wood-transport-belt", amount = 4 }, - }, - results = { { type = "item", name = undergroundBeltName, amount = 2 } } - }, - { - type = "recipe", - name = splitterName, - category = "crafting", - additional_categories = { "wood-processing" }, - enabled = false, - energy_required = 1, - ingredients = { - { type = "item", name = "wood-transport-belt", amount = 2 }, - { type = "item", name = "lumber", amount = 2 }, - basic_circuit_board and { type = "item", name = "basic-circuit-board", amount = 5 } or - { type = "item", name = "gold-cable", amount = 10 } - }, - results = { { type = "item", name = splitterName, amount = 1 } } - }, - { - type = "technology", - name = name .. "-logistics", - category = "crafting", - additional_categories = { "wood-processing" }, - icon = Lignumis.graphics .. "technology/wood-logistics.png", - icon_size = 256, - effects = { - { - type = "unlock-recipe", - recipe = "wood-transport-belt" - }, - { - type = "unlock-recipe", - recipe = "wood-underground-belt" - }, - { - type = "unlock-recipe", - recipe = "wood-splitter" - } - }, - prerequisites = { "wood-science-pack" }, - unit = { - count = 10, - ingredients = { { "wood-science-pack", 1 } }, - time = 10 - } - } -}) + }) + +Belt.TechnologyBuilder:new() + :prerequisites({ "wood-science-pack" }) + :ingredients({ { "wood-science-pack", 1 } }) + :count(10) + :time(10) + :apply() if not basic_circuit_board then - Recipe:new("wood-splitter"):clone("wood-splitter-electronic-circuit") - :replaceIngredient("gold-cable", "electronic-circuit", 2) - :assign({ - localised_name = { "entity-name.wood-splitter" }, - icons = { - { icon = gfx .. "wood-splitter-icon.png" }, - { icon = "__base__/graphics/icons/electronic-circuit.png", scale = 0.25, shift = { 8, 8 } } - } - }) - :unlockedByTechnology("electronics") - :apply() + 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 \ No newline at end of file