From b56f662a650a196b363ec9fb3f01c3bbb2f14080 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Sat, 13 Dec 2025 01:10:11 +0100 Subject: [PATCH] Integrate deep miner code into this mod --- lignumis/prototypes/content/deep-miner.lua | 209 +++++++++++++++++---- 1 file changed, 168 insertions(+), 41 deletions(-) diff --git a/lignumis/prototypes/content/deep-miner.lua b/lignumis/prototypes/content/deep-miner.lua index 8f8db39..a52c40e 100644 --- a/lignumis/prototypes/content/deep-miner.lua +++ b/lignumis/prototypes/content/deep-miner.lua @@ -1,44 +1,171 @@ -local DeepMinerFactory = require(MF.buildings .. "CoreExtractor") -local DeepMiner = DeepMinerFactory("deep-miner") +local hit_effects = require("__base__.prototypes.entity.hit-effects") +local item_sounds = require("__base__.prototypes.item_sounds") +local sounds = require("__base__.prototypes.entity.sounds") +local Entity = require("__cf-lib__/data/Entity") -local entity = DeepMiner.EntityBuilder:new():build({ - resource_searching_radius = 0.49, - energy_usage = "25MW", - mining_speed = 7.5, - energy_source = { - emissions_per_minute = { noise = 2000 } +local gfx = Lignumis.graphics .. "entity/deep-miner/" +local techGfx = Lignumis.graphics .. "technology/" +local name = "deep-miner" + +local function animationLayer() + return { + priority = "high", + width = 704, + height = 704, + frame_count = 120, + lines_per_file = 8, + animation_speed = 0.15, + scale = 0.5, + stripes = { + { + filename = gfx .. "core-extractor-animation-1.png", + width_in_frames = 8, + height_in_frames = 8 + }, + { + filename = gfx .. "core-extractor-animation-2.png", + width_in_frames = 8, + height_in_frames = 7 + } + } + } +end + +data:extend({ + { + type = "mining-drill", + name = name, + icon = gfx .. "core-extractor-icon.png", + flags = { "placeable-neutral", "player-creation" }, + minable = { mining_time = 0.2, result = name }, + fast_replaceable_group = name, + max_health = 500, + corpse = "big-remnants", + dying_explosion = "medium-explosion", + collision_box = Entity.collisionBox(11, 11), + selection_box = Entity.selectionBox(11, 11), + damaged_trigger_effect = hit_effects.entity(), + drawing_box_vertical_extension = 1.3, + module_slots = 4, + icon_draw_specification = { scale = 2, shift = { 0, -0.3 } }, + icons_positioning = { + { inventory_index = defines.inventory.assembling_machine_modules, shift = { 0, 1.25 } } + }, + allowed_effects = { "consumption", "speed", "pollution", "quality", "productivity" }, + mining_speed = 7.5, + resource_categories = { "deep-mining" }, + drops_full_belt_stacks = true, + resource_searching_radius = 0.49, + vector_to_place_result = { 0, -5.85 }, + resource_drain_rate_percent = 75, + energy_source = { + type = "electric", + usage_priority = "secondary-input", + emissions_per_minute = { noise = 2000 } + }, + energy_usage = "25MW", + perceived_performance = { minimum = 0.25, performance_to_activity_rate = 2.0, maximum = 20 }, + graphics_set = { + animation = { + layers = { + { + filename = gfx .. "core-extractor-shadow.png", + priority = "high", + width = 1400, + height = 1400, + frame_count = 1, + line_length = 1, + repeat_count = 120, + animation_speed = 0.15, + draw_as_shadow = true, + scale = 0.5 + }, + animationLayer() + } + }, + working_visualisations = { + { + fadeout = true, + animation = { + layers = { + animationLayer(), + { + priority = "high", + draw_as_glow = true, + blend_mode = "additive", + width = 704, + height = 704, + frame_count = 120, + lines_per_file = 8, + animation_speed = 0.15, + scale = 0.5, + stripes = { + { + filename = gfx .. "core-extractor-emission-1.png", + width_in_frames = 8, + height_in_frames = 8 + }, + { + filename = gfx .. "core-extractor-emission-2.png", + width_in_frames = 8, + height_in_frames = 7 + } + } + } + } + } + } + } + }, + open_sound = sounds.drill_open, + close_sound = sounds.drill_close }, - resource_drain_rate_percent = 75 -}) -entity.resource_categories = { "deep-mining" } -data:extend({ entity }) - -DeepMiner.ItemBuilder:new() - :itemsPerRocket(1) - :apply({ + { + type = "item", + name = name, + icon = gfx .. "core-extractor-icon.png", subgroup = "extraction-machine", - order = "a[items]-d[deep-miner]" - }) - -DeepMiner.RecipeBuilder:new() - :ingredients({ - { type = "item", name = "processing-unit", amount = 100 }, - { type = "item", name = "electric-engine-unit", amount = 100 }, - { type = "item", name = "steel-plate", amount = 200 }, - { type = "item", name = "concrete", amount = 50 } - }) - :apply({ - category = "metallurgy-or-assembling" - }) - -DeepMiner.TechnologyBuilder:new() - :prerequisites({ "space-science-pack" }) - :count(500) - :ingredients({ - { "automation-science-pack", 1 }, - { "logistic-science-pack", 1 }, - { "chemical-science-pack", 1 }, - { "space-science-pack", 1 } - }) - :time(60) - :apply() + order = "a[items]-d[deep-miner]", + inventory_move_sound = item_sounds.mechanical_large_inventory_move, + pick_sound = item_sounds.mechanical_large_inventory_pickup, + drop_sound = item_sounds.mechanical_large_inventory_move, + place_result = name, + stack_size = 20, + default_import_location = "nauvis", + weight = 1000 * kg + }, + { + type = "recipe", + name = name, + category = "metallurgy-or-assembling", + enabled = false, + ingredients = { + { type = "item", name = "processing-unit", amount = 100 }, + { type = "item", name = "electric-engine-unit", amount = 100 }, + { type = "item", name = "steel-plate", amount = 200 }, + { type = "item", name = "concrete", amount = 50 } + }, + energy_required = 60, + results = { { type = "item", name = name, amount = 1 } } + }, + { + type = "technology", + name = name, + icon = techGfx .. "core-extractor.png", + icon_size = 256, + effects = { + { type = "unlock-recipe", recipe = name } + }, + prerequisites = { "space-science-pack" }, + unit = { + count = 500, + ingredients = { + { "automation-science-pack", 1 }, + { "logistic-science-pack", 1 }, + { "chemical-science-pack", 1 }, + { "space-science-pack", 1 } + }, + time = 60 + } + } +}) \ No newline at end of file