diff --git a/lignumis/prototypes/compatibility/k2so.lua b/lignumis/prototypes/compatibility/k2so.lua index ac1affb..7dc2b2b 100644 --- a/lignumis/prototypes/compatibility/k2so.lua +++ b/lignumis/prototypes/compatibility/k2so.lua @@ -5,12 +5,23 @@ if not mods["Krastorio2-spaced-out"] then return end local data_util = require("__Krastorio2-spaced-out__/data-util") data:extend({ + { + type = "item", + name = "gold-research-data", + icon = Lignumis.graphics .. "icons/gold-research-data.png", + icon_size = 64, + subgroup = "science-pack", + order = "a09[gold-research-data]", + stack_size = 200, + weight = 1 * kg, + default_import_location = "lignumis" + }, { type = "tool", name = "gold-tech-card", localised_description = { "item-description.science-pack" }, - icon = Lignumis.graphics .. "technology/lig-gold-science-pack-tech.png", - icon_size = 128, + icon = Lignumis.graphics .. "icons/gold-tech-card.png", + icon_size = 64, subgroup = "science-pack", order = "b09[gold-tech-card]", stack_size = 200, @@ -18,13 +29,53 @@ data:extend({ durability = 1, durability_description_key = "description.science-pack-remaining-amount-key", durability_description_value = "description.science-pack-remaining-amount-value", + pictures = { + layers = { + { + filename = Lignumis.graphics .. "icons/gold-tech-card.png", + size = 64, + scale = 0.5 + }, + { + filename = Lignumis.graphics .. "icons/gold-tech-card-light.png", + size = 64, + scale = 0.5, + draw_as_light = true + } + } + }, default_import_location = "lignumis" } }) data_util.make_tech_card("gold-tech-card", { - { type = "item", name = "gold-plate", amount = 10 }, - { type = "item", name = "gold-cable", amount = 10 } + { type = "item", name = "gold-research-data", amount = 5 } +}) + +data:extend({ + { + type = "recipe", + name = "gold-research-data", + category = "crafting", + enabled = false, + energy_required = 20, + ingredients = { + { type = "item", name = "gold-plate", amount = 10 }, + { type = "item", name = "gold-cable", amount = 10 } + }, + results = { + { type = "item", name = "gold-research-data", amount = 5 } + }, + surface_conditions = { + { + property = "pollutant-type", + min = 3, + max = 3 + } + }, + allow_productivity = true, + main_product = "gold-research-data" + } }) data:extend({ @@ -37,12 +88,13 @@ data:extend({ time = 45, count = 500, ingredients = { - { "production-science-pack", 1 }, - { "utility-science-pack", 1 } + { "wood-science-pack", 1 }, + { "steam-science-pack", 1 } } }, - prerequisites = { "gold-fluid-handling", "utility-science-pack" }, + prerequisites = { "gold-fluid-handling", "kr-advanced-lab" }, effects = { + { type = "unlock-recipe", recipe = "gold-research-data" }, { type = "unlock-recipe", recipe = "gold-tech-card" } } } @@ -141,4 +193,37 @@ then table.insert(lab.inputs, "gold-tech-card") end end + + local utility_science = data.raw.technology["utility-science-pack"] + if utility_science and utility_science.unit and utility_science.unit.ingredients then + local ingredients = {} + + for _, ingredient in pairs(utility_science.unit.ingredients) do + local ingredient_name = ingredient[1] or ingredient.name + + if ingredient_name ~= "wood-science-pack" and ingredient_name ~= "steam-science-pack" then + table.insert(ingredients, ingredient) + end + end + + local has_gold_card = false + for _, ingredient in pairs(ingredients) do + local ingredient_name = ingredient[1] or ingredient.name + if ingredient_name == "gold-tech-card" then + has_gold_card = true + break + end + end + + if not has_gold_card then + table.insert(ingredients, { "gold-tech-card", 1 }) + end + + utility_science.unit.ingredients = ingredients + + utility_science.prerequisites = utility_science.prerequisites or {} + if not table.contains(utility_science.prerequisites, "gold-tech-card") then + table.insert(utility_science.prerequisites, "gold-tech-card") + end + end end