Integrate quality assembler code into this mod

This commit is contained in:
Simon Brodtmann 2025-12-16 01:38:57 +01:00
parent 52538eadac
commit 9a52a15772
3 changed files with 275 additions and 63 deletions

View file

@ -3,8 +3,8 @@ local item_sounds = require("__base__.prototypes.item_sounds")
local sounds = require("__base__.prototypes.entity.sounds") local sounds = require("__base__.prototypes.entity.sounds")
local Entity = require("__cf-lib__/data/Entity") local Entity = require("__cf-lib__/data/Entity")
local gfx = Lignumis.graphics .. "entity/deep-miner/"
local name = "deep-miner" local name = "deep-miner"
local gfx = Lignumis.graphics .. "entity/" .. name .. "/"
local function animationLayer() local function animationLayer()
return { return {

View file

@ -3,8 +3,8 @@ local hit_effects = require("__base__.prototypes.entity.hit-effects")
local item_sounds = require("__base__.prototypes.item_sounds") local item_sounds = require("__base__.prototypes.item_sounds")
local Entity = require("__cf-lib__/data/Entity") local Entity = require("__cf-lib__/data/Entity")
local gfx = Lignumis.graphics .. "entity/lumber-mill/"
local name = "lumber-mill" local name = "lumber-mill"
local gfx = Lignumis.graphics .. "entity/" .. name .. "/"
data:extend({ data:extend({
{ {

View file

@ -1,9 +1,54 @@
local hit_effects = require("__base__.prototypes.entity.hit-effects")
local item_sounds = require("__base__.prototypes.item_sounds") local item_sounds = require("__base__.prototypes.item_sounds")
local sounds = require("__base__.prototypes.entity.sounds")
local Entity = require("__cf-lib__/data/Entity")
local Technology = require("__cf-lib__/data/Technology")
local QualityAssemblerFactory = require(MF.buildings .. "GravityAssembler") local function assemblerpipepicturesfrozen()
local QualityAssembler = QualityAssemblerFactory("quality-assembler") return {
north = {
filename = "__space-age__/graphics/entity/frozen/assembling-machine/assembling-machine-pipe-N-frozen.png",
priority = "extra-high",
width = 71,
height = 38,
shift = util.by_pixel(2.25, 13.5),
scale = 0.5
},
east = {
filename = "__space-age__/graphics/entity/frozen/assembling-machine/assembling-machine-pipe-E-frozen.png",
priority = "extra-high",
width = 42,
height = 76,
shift = util.by_pixel(-24.5, 1),
scale = 0.5
},
south = {
filename = "__space-age__/graphics/entity/frozen/assembling-machine/assembling-machine-pipe-S-frozen.png",
priority = "extra-high",
width = 88,
height = 61,
shift = util.by_pixel(0, -31.25),
scale = 0.5
},
west = {
filename = "__space-age__/graphics/entity/frozen/assembling-machine/assembling-machine-pipe-W-frozen.png",
priority = "extra-high",
width = 39,
height = 73,
shift = util.by_pixel(25.75, 1.25),
scale = 0.5
}
}
end
local name = "quality-assembler"
local gfx = Lignumis.graphics .. "entity/" .. name .. "/"
data:extend({ data:extend({
{
type = "recipe-category",
name = "quality-assembling"
},
{ {
type = "burner-usage", type = "burner-usage",
name = "quality-catalyst", name = "quality-catalyst",
@ -60,64 +105,231 @@ data:extend({
allow_productivity = true, allow_productivity = true,
allow_quality = false, allow_quality = false,
enabled = false enabled = false
} },
}) {
type = "assembling-machine",
QualityAssembler.EntityBuilder:new() name = name,
:allowProductivity(false) icon = Lignumis.graphics .. "icons/quality-assembler.png",
:burnerEnergySource({ flags = { "placeable-neutral", "player-creation" },
burner_usage = "quality-catalyst", minable = { mining_time = 0.2, result = name },
fuel_categories = { "quality-catalyst" }, fast_replaceable_group = name,
fuel_inventory_size = 1, max_health = 500,
emissions_per_minute = { noise = 100, pollution = 6 } corpse = "big-remnants",
}) dying_explosion = "medium-explosion",
:pipes() collision_box = Entity.collisionBox(4, 4),
:apply({ selection_box = Entity.selectionBox(4, 4),
energy_usage = "1MW", damaged_trigger_effect = hit_effects.entity(),
crafting_speed = 4, drawing_box_vertical_extension = 1.3,
module_slots = 6, module_slots = 6,
allowed_effects = { "consumption", "pollution", "quality" },
effect_receiver = { base_effect = { quality = 3.5 } }, effect_receiver = { base_effect = { quality = 3.5 } },
crafting_categories = { "quality-assembling" } icon_draw_specification = { scale = 1.25, shift = { 0, -0.25 } },
}) icons_positioning = {
{ inventory_index = defines.inventory.assembling_machine_modules, shift = { 0, 1 }, max_icons_per_row = 4 }
QualityAssembler.ItemBuilder:new():apply() },
allowed_effects = { "consumption", "pollution", "quality" },
QualityAssembler.RecipeBuilder:new() crafting_categories = { "quality-assembling" },
:ingredients({ crafting_speed = 4,
{ type = "item", name = "gold-plate", amount = 60 }, energy_source = {
{ type = "item", name = "tungsten-plate", amount = 40 }, type = "burner",
{ type = "item", name = "superconductor", amount = 50 }, burner_usage = "quality-catalyst",
{ type = "item", name = "carbon-fiber", amount = 100 }, fuel_categories = { "quality-catalyst" },
{ type = "item", name = "quantum-processor", amount = 10 } effectivity = 1,
}) fuel_inventory_size = 1,
:apply({ emissions_per_minute = { noise = 100, pollution = 6 },
},
energy_usage = "1MW",
perceived_performance = { minimum = 0.25, performance_to_activity_rate = 2.0, maximum = 20 },
graphics_set = {
animation = {
layers = {
{
filename = gfx .. "quality-assembler-shadow.png",
priority = "high",
width = 500,
height = 350,
frame_count = 1,
line_length = 1,
repeat_count = 64,
animation_speed = 0.32,
draw_as_shadow = true,
scale = 0.5
},
{
priority = "high",
width = 270,
height = 310,
frame_count = 64,
lines_per_file = 8,
animation_speed = 0.32,
scale = 0.5,
stripes = {
{
filename = gfx .. "quality-assembler-animation-1.png",
width_in_frames = 8,
height_in_frames = 8
},
{
filename = gfx .. "quality-assembler-animation-2.png",
width_in_frames = 8,
height_in_frames = 5
}
}
},
}
},
working_visualisations = {
{
fadeout = true,
animation = {
layers = {
{
priority = "high",
width = 270,
height = 310,
frame_count = 64,
lines_per_file = 8,
animation_speed = 0.32,
scale = 0.5,
stripes = {
{
filename = gfx .. "quality-assembler-animation-1.png",
width_in_frames = 8,
height_in_frames = 8
},
{
filename = gfx .. "quality-assembler-animation-2.png",
width_in_frames = 8,
height_in_frames = 5
}
}
},
{
priority = "high",
draw_as_glow = true,
blend_mode = "additive",
width = 270,
height = 310,
frame_count = 64,
lines_per_file = 8,
animation_speed = 0.32,
scale = 0.5,
stripes = {
{
filename = gfx .. "quality-assembler-emission-1.png",
width_in_frames = 8,
height_in_frames = 8
},
{
filename = gfx .. "quality-assembler-emission-2.png",
width_in_frames = 8,
height_in_frames = 5
}
}
}
}
}
}
}
},
open_sound = sounds.machine_open,
close_sound = sounds.machine_close,
fluid_boxes = {
{
production_type = "input",
pipe_picture = assembler2pipepictures(),
pipe_picture_frozen = assemblerpipepicturesfrozen(),
pipe_covers = pipecoverspictures(),
volume = 200,
secondary_draw_orders = { north = -1 },
pipe_connections = {{ flow_direction="input-output", direction = defines.direction.west, position = {-1.5, 0.5} }}
},
{
production_type = "input",
pipe_picture = assembler2pipepictures(),
pipe_picture_frozen = assemblerpipepicturesfrozen(),
pipe_covers = pipecoverspictures(),
volume = 200,
secondary_draw_orders = { north = -1 },
pipe_connections = {{ flow_direction="input-output", direction = defines.direction.east, position = {1.5, -0.5} }}
},
{
production_type = "output",
pipe_picture = assembler2pipepictures(),
pipe_picture_frozen = assemblerpipepicturesfrozen(),
pipe_covers = pipecoverspictures(),
volume = 100,
secondary_draw_orders = { north = -1 },
pipe_connections = {{ flow_direction="input-output", direction = defines.direction.south, position = {0.5, 1.5} }}
},
{
production_type = "output",
pipe_picture = assembler2pipepictures(),
pipe_picture_frozen = assemblerpipepicturesfrozen(),
pipe_covers = pipecoverspictures(),
volume = 100,
secondary_draw_orders = { north = -1 },
pipe_connections = {{ flow_direction="input-output", direction = defines.direction.north, position = {-0.5, -1.5} }}
}
},
fluid_boxes_off_when_no_fluid_recipe = true,
forced_symmetry = "horizontal",
},
{
type = "item",
name = name,
icon = Lignumis.graphics .. "icons/quality-assembler.png",
subgroup = "production-machine",
order = "a[" .. name .. "]",
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 = 200 * kg
},
{
type = "recipe",
name = name,
category = "electromagnetics", category = "electromagnetics",
additional_categories = { "quality-assembling" } additional_categories = { "quality-assembling" },
}) enabled = false,
ingredients = {
QualityAssembler.TechnologyBuilder:new() { type = "item", name = "gold-plate", amount = 60 },
:prerequisites({ "legendary-quality", "quantum-processor" }) { type = "item", name = "tungsten-plate", amount = 40 },
:count(5000) { type = "item", name = "superconductor", amount = 50 },
:ingredients({ { type = "item", name = "carbon-fiber", amount = 100 },
{ "wood-science-pack", 1 }, { type = "item", name = "quantum-processor", amount = 10 }
{ "steam-science-pack", 1 }, },
{ "automation-science-pack", 1 }, energy_required = 60,
{ "logistic-science-pack", 1 }, results = { { type = "item", name = name, amount = 1 } },
{ "chemical-science-pack", 1 }, },
{ "space-science-pack", 1 }, {
{ "production-science-pack", 1 }, type = "technology",
{ "utility-science-pack", 1 }, name = name,
{ "metallurgic-science-pack", 1 }, icon = Lignumis.graphics .. "technology/quality-assembler.png",
{ "agricultural-science-pack", 1 }, icon_size = 256,
{ "electromagnetic-science-pack", 1 }, effects = {},
{ "cryogenic-science-pack", 1 } prerequisites = { "legendary-quality", "quantum-processor" },
}) unit = {
:time(60) count = 5000,
:additionalRecipes({ "gold-quality-catalyst" }) ingredients = {
:apply() { "wood-science-pack", 1 },
{ "steam-science-pack", 1 },
data:extend({ { "automation-science-pack", 1 },
{ "logistic-science-pack", 1 },
{ "chemical-science-pack", 1 },
{ "space-science-pack", 1 },
{ "production-science-pack", 1 },
{ "utility-science-pack", 1 },
{ "metallurgic-science-pack", 1 },
{ "agricultural-science-pack", 1 },
{ "electromagnetic-science-pack", 1 },
{ "cryogenic-science-pack", 1 }
},
time = 60
}
},
{ {
type = "technology", type = "technology",
name = "experienced-quality-assembling-1", name = "experienced-quality-assembling-1",
@ -149,13 +361,13 @@ data:extend({
}, },
research_trigger = { type = "craft-item", item = "gold-quality-catalyst", count = 10000 }, research_trigger = { type = "craft-item", item = "gold-quality-catalyst", count = 10000 },
prerequisites = { "experienced-quality-assembling-1" } prerequisites = { "experienced-quality-assembling-1" }
},
{
type = "recipe-category",
name = "quality-assembling"
} }
}) })
Technology:new(name)
:addRecipe(name)
:addRecipe("gold-quality-catalyst")
local function qa(recipeName) local function qa(recipeName)
local recipe = data.raw.recipe[recipeName] local recipe = data.raw.recipe[recipeName]
recipe.additional_categories = recipe.additional_categories or {} recipe.additional_categories = recipe.additional_categories or {}