diff --git a/lignumis/prototypes/compatibility/aai-loaders.lua b/lignumis/prototypes/compatibility/aai-loaders.lua index da3c063..2874aef 100644 --- a/lignumis/prototypes/compatibility/aai-loaders.lua +++ b/lignumis/prototypes/compatibility/aai-loaders.lua @@ -48,6 +48,8 @@ AAILoaders.make_tier({ data.raw.recipe["aai-wood-loader"].additional_categories = { "wood-processing" } +data.raw["loader-1x1"]["aai-wood-loader"].animation_speed_coefficient = 1.01 * 32 + if not basic_circuit_board then local nauvis_recipe = Recipe:new("aai-wood-loader"):clone("wood-loader-electronic-circuit") nauvis_recipe:replaceIngredient("gold-cable", "electronic-circuit") diff --git a/lignumis/prototypes/compatibility/lane-splitters.lua b/lignumis/prototypes/compatibility/lane-splitters.lua index 075cc68..a627a27 100644 --- a/lignumis/prototypes/compatibility/lane-splitters.lua +++ b/lignumis/prototypes/compatibility/lane-splitters.lua @@ -21,6 +21,7 @@ lane_splitter.prototype.structure_patch.east.filename = data.raw.splitter["wood- lane_splitter.prototype.structure_patch.south.filename = data.raw.splitter["wood-splitter"].structure_patch.south.filename lane_splitter.prototype.structure_patch.west.filename = data.raw.splitter["wood-splitter"].structure_patch.west.filename lane_splitter.prototype.structure_patch.north.filename = data.raw.splitter["wood-splitter"].structure_patch.north.filename +lane_splitter.prototype.animation_speed_coefficient = 1.01 * 32 lane_splitter.item.icon = Lignumis.graphics .. "icons/wood-lane-splitter.png" lane_splitter.item.order = "d[lane-splitter]-0[wood-lane-splitter]" lane_splitter.recipe.additional_categories = { "wood-processing" } diff --git a/lignumis/prototypes/content/wood-logistics.lua b/lignumis/prototypes/content/wood-logistics.lua index 31f3809..4475b8f 100644 --- a/lignumis/prototypes/content/wood-logistics.lua +++ b/lignumis/prototypes/content/wood-logistics.lua @@ -1,108 +1,473 @@ -local BeltFactory = require(MF.logistics .. "Belts") -local Belt = BeltFactory("wood", "brown", "slow") - -local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value +local meld = require("meld") +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") if mods["wood-logistics"] and settings.startup["wood-logistics-belts"].value then return end -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} - } - ]] +local basic_circuit_board = settings.startup["lignumis-basic-circuit-board"].value +local speed = 7.5 / 480 +local name = "wood" +local transportBeltName = name .. "-transport-belt" +local undergroundBeltName = name .. "-underground-belt" +local splitterName = name .. "-splitter" +local gfx = Lignumis.graphics .. "entity/wood-logistics/" + +local function createAnimation() + return meld({ + animation_set = { + filename = gfx .. "wood-transport-belt.png", + priority = "extra-high", + size = 128, + scale = 0.5, + frame_count = 16, + direction_count = 20 + } + }, belt_reader_gfx) +end + +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 } }, - splitter = { - emissions_per_second = { noise = 20 / 60 } - } - }) - -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, + belt_animation_set = createAnimation(), + 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} + } + ]] }, - splitter = { - additional_categories = { "wood-processing" } + 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 + } + } + }, + belt_animation_set = createAnimation() + }, + { + 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 } - }) - -Belt.TechnologyBuilder:new() - :prerequisites({ "wood-science-pack" }) - :ingredients({ { "wood-science-pack", 1 } }) - :count(10) - :time(10) - :apply() + }, + { + 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 + } + }, + belt_animation_set = createAnimation() + }, + { + 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 + } + } +}) 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" - }) + 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() end \ No newline at end of file