From 36759ba14283897b7136c729ea6b2743b171d2b2 Mon Sep 17 00:00:00 2001 From: pla Date: Mon, 27 Oct 2025 16:48:16 +0100 Subject: [PATCH] Fix K2 matter recipe generation and tech icon --- bztungsten2/data-util.lua | 90 ++++++++++++++++----------------- bztungsten2/tungsten-matter.lua | 32 ++++++++---- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/bztungsten2/data-util.lua b/bztungsten2/data-util.lua index ff8bd2f..b4a1738 100644 --- a/bztungsten2/data-util.lua +++ b/bztungsten2/data-util.lua @@ -109,65 +109,65 @@ function util.se_landfill(params) end end - --- k2 matter +-- k2 matter -- params: {k2matter}, k2baseicon , {icon} function util.k2matter(params) local matter = require("__Krastorio2__/prototypes/libraries/matter") - if mods["space-exploration"] then - params.k2matter.need_stabilizer = true + if mods["space-exploration"] then + params.k2matter.needs_stabilizer = true end if not params.k2matter.minimum_conversion_quantity then params.k2matter.minimum_conversion_quantity = 10 end - if not data.raw.technology[params.k2matter.unlocked_by_technology] then + if not data.raw.technology[params.k2matter.unlocked_by] then local icon = "" if params.k2baseicon then - icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png" + icon = util.k2assets() .. "/technologies/matter-" .. params.k2baseicon .. ".png" else - icon = util.k2assets().."/technologies/backgrounds/matter.png" + icon = util.k2assets() .. "/technologies/backgrounds/matter.png" end - - data:extend( - { + + data:extend({ + { + type = "technology", + name = params.k2matter.unlocked_by, + icons = { { - type = "technology", - name = params.k2matter.unlocked_by_technology, - icons = - { - { - icon = icon, - icon_size = 256, - }, - params.icon, - }, - prerequisites = {"kr-matter-processing"}, - unit = - { - count = 350, - ingredients = mods["space-exploration"] and - { - {"automation-science-pack", 1}, - {"logistic-science-pack", 1}, - {"chemical-science-pack", 1}, - {"se-astronomic-science-pack-4", 1}, - {"se-energy-science-pack-4", 1}, - {"se-material-science-pack-4", 1}, - {"se-deep-space-science-pack-2", 1}, - {"se-kr-matter-science-pack-2", 1}, - } or - { - {"production-science-pack", 1}, - {"utility-science-pack", 1}, - {"kr-matter-tech-card", 1} - }, - time = 45, - }, - localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, + icon = icon, + icon_size = 256, }, - }) + params.icon, + }, + prerequisites = { "kr-matter-processing" }, + unit = { + count = 350, + ingredients = mods["space-exploration"] and { + { "automation-science-pack", 1 }, + { "logistic-science-pack", 1 }, + { "chemical-science-pack", 1 }, + { "se-astronomic-science-pack-4", 1 }, + { "se-energy-science-pack-4", 1 }, + { "se-material-science-pack-4", 1 }, + { "se-deep-space-science-pack-2", 1 }, + { "se-kr-matter-science-pack-2", 1 }, + } or { + { "production-science-pack", 1 }, + { "utility-science-pack", 1 }, + { "kr-matter-tech-card", 1 }, + }, + time = 45, + }, + effects = {}, + -- localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, + }, + }) end - matter.make_recipes(params.k2matter) + if params.k2matter.only_deconversion then + matter.make_deconversion_recipe(params.k2matter) + else + matter.make_recipes(params.k2matter) + end + end diff --git a/bztungsten2/tungsten-matter.lua b/bztungsten2/tungsten-matter.lua index 01c5974..d38b879 100644 --- a/bztungsten2/tungsten-matter.lua +++ b/bztungsten2/tungsten-matter.lua @@ -1,22 +1,32 @@ -- Matter recipes for Krastorio2 if mods["Krastorio2"] then - local util = require("data-util"); - local matter = require("__Krastorio2__/prototypes/libraries/matter") + local util = require("data-util") - matter.make_recipes({ - material = { type = "item", name = "tungsten-ore", amount = 1 }, + util.k2matter({ + k2matter = { + material = { type = "item", name = "tungsten-ore", amount = 30 }, + item_name = "tungsten-ore", matter_count = 6, energy_required = 1, - need_stabilizer = false, - unlocked_by_technology = "tungsten-matter-processing", - icon = {icon = "__bztungsten2__/graphics/icons/tungsten-ore.png", icon_size = 64, scale = 1.25} + needs_stabilizer = false, + unlocked_by = "tungsten-matter-processing", + }, + icon = { + icon = "__bztungsten2__/graphics/icons/tungsten-ore.png", + icon_size = 64, + scale = 1 + }, }) - matter.make_recipes({ - material = { type = "item", name = "tungsten-plate", amount = 1 }, + util.k2matter({ + k2matter = { + material = { type = "item", name = "tungsten-plate", amount = 10 }, + item_name = "tungsten-plate", matter_count = 10, energy_required = 2, - need_stabilizer = false, - unlocked_by_technology = "tungsten-matter-processing", + only_deconversion = true, + needs_stabilizer = true, + unlocked_by = "tungsten-matter-processing", + }, }) end