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 Entity = require("__cf-lib__/data/Entity")
local gfx = Lignumis.graphics .. "entity/deep-miner/"
local name = "deep-miner"
local gfx = Lignumis.graphics .. "entity/" .. name .. "/"
local function animationLayer()
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 Entity = require("__cf-lib__/data/Entity")
local gfx = Lignumis.graphics .. "entity/lumber-mill/"
local name = "lumber-mill"
local gfx = Lignumis.graphics .. "entity/" .. name .. "/"
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 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 QualityAssembler = QualityAssemblerFactory("quality-assembler")
local function assemblerpipepicturesfrozen()
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({
{
type = "recipe-category",
name = "quality-assembling"
},
{
type = "burner-usage",
name = "quality-catalyst",
@ -60,64 +105,231 @@ data:extend({
allow_productivity = true,
allow_quality = false,
enabled = false
}
})
QualityAssembler.EntityBuilder:new()
:allowProductivity(false)
:burnerEnergySource({
burner_usage = "quality-catalyst",
fuel_categories = { "quality-catalyst" },
fuel_inventory_size = 1,
emissions_per_minute = { noise = 100, pollution = 6 }
})
:pipes()
:apply({
energy_usage = "1MW",
crafting_speed = 4,
},
{
type = "assembling-machine",
name = name,
icon = Lignumis.graphics .. "icons/quality-assembler.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(4, 4),
selection_box = Entity.selectionBox(4, 4),
damaged_trigger_effect = hit_effects.entity(),
drawing_box_vertical_extension = 1.3,
module_slots = 6,
allowed_effects = { "consumption", "pollution", "quality" },
effect_receiver = { base_effect = { quality = 3.5 } },
crafting_categories = { "quality-assembling" }
})
QualityAssembler.ItemBuilder:new():apply()
QualityAssembler.RecipeBuilder:new()
:ingredients({
{ type = "item", name = "gold-plate", amount = 60 },
{ type = "item", name = "tungsten-plate", amount = 40 },
{ type = "item", name = "superconductor", amount = 50 },
{ type = "item", name = "carbon-fiber", amount = 100 },
{ type = "item", name = "quantum-processor", amount = 10 }
})
:apply({
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 }
},
allowed_effects = { "consumption", "pollution", "quality" },
crafting_categories = { "quality-assembling" },
crafting_speed = 4,
energy_source = {
type = "burner",
burner_usage = "quality-catalyst",
fuel_categories = { "quality-catalyst" },
effectivity = 1,
fuel_inventory_size = 1,
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",
additional_categories = { "quality-assembling" }
})
QualityAssembler.TechnologyBuilder:new()
:prerequisites({ "legendary-quality", "quantum-processor" })
:count(5000)
:ingredients({
{ "wood-science-pack", 1 },
{ "steam-science-pack", 1 },
{ "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)
:additionalRecipes({ "gold-quality-catalyst" })
:apply()
data:extend({
additional_categories = { "quality-assembling" },
enabled = false,
ingredients = {
{ type = "item", name = "gold-plate", amount = 60 },
{ type = "item", name = "tungsten-plate", amount = 40 },
{ type = "item", name = "superconductor", amount = 50 },
{ type = "item", name = "carbon-fiber", amount = 100 },
{ type = "item", name = "quantum-processor", amount = 10 }
},
energy_required = 60,
results = { { type = "item", name = name, amount = 1 } },
},
{
type = "technology",
name = name,
icon = Lignumis.graphics .. "technology/quality-assembler.png",
icon_size = 256,
effects = {},
prerequisites = { "legendary-quality", "quantum-processor" },
unit = {
count = 5000,
ingredients = {
{ "wood-science-pack", 1 },
{ "steam-science-pack", 1 },
{ "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",
name = "experienced-quality-assembling-1",
@ -149,13 +361,13 @@ data:extend({
},
research_trigger = { type = "craft-item", item = "gold-quality-catalyst", count = 10000 },
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 recipe = data.raw.recipe[recipeName]
recipe.additional_categories = recipe.additional_categories or {}