From c2f8c0af9feb5111719bc3adcb09082e3d142a6f Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 4 May 2025 03:34:53 -0700 Subject: [PATCH] k2 spaced out etc --- changelog.txt | 8 ++++++++ compatibility/248k.lua | 2 ++ data-final-fixes.lua | 11 ++++++----- data-util.lua | 36 +++++++++++++++++++--------------- info.json | 3 ++- lead-enriched.lua | 10 +++++----- lead-matter.lua | 8 ++++---- lead-recipe-final-stacking.lua | 4 ++-- lead-recipe-se.lua | 8 ++++---- lead-recipe-updates.lua | 8 ++++---- lead-recipe.lua | 10 +++++----- 11 files changed, 62 insertions(+), 46 deletions(-) diff --git a/changelog.txt b/changelog.txt index d6e27cc..84da406 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,16 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.25 +Date: 2025-05-04 + Changes: + - Support for Krastorio2 spaced out + - Tweaks for k2 2 integration +--------------------------------------------------------------------------------------------------- Version: 2.0.24 Date: 2025-05-03 Fixes: - Fix load issue with Bob's + Changes: + - K2 compatibility updates, thanks to autechr3 and pla --------------------------------------------------------------------------------------------------- Version: 2.0.23 Date: 2025-04-08 diff --git a/compatibility/248k.lua b/compatibility/248k.lua index b7efd6a..5e69008 100644 --- a/compatibility/248k.lua +++ b/compatibility/248k.lua @@ -3,6 +3,7 @@ local util = require("data-util"); local pb2 = "fu_lead_item" +if mods["248k"] then -- Swap out all 248k titanium for BZ titanium_plate for i, recipe in pairs(data.raw.recipe) do util.replace_ingredient(recipe.name, pb2, "lead-plate") @@ -16,3 +17,4 @@ util.remove_raw("item", pb2) util.add_ingredient("fu_pure_ore_recipe", "lead-ore", 5) util.add_to_product("fu_pure_ore_recipe", "fi_materials_pure_lead", 5) +end diff --git a/data-final-fixes.lua b/data-final-fixes.lua index c42e558..bd14c45 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -14,19 +14,20 @@ if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting end end -if mods["Krastorio2"] then +if util.k2() then + local lead_bolt = util.me.more_entities() and "lead-expansion-bolt" or "lead-plate" util.replace_ingredient("rifle-magazine", "iron-plate", "lead-plate") util.replace_ingredient("anti-material-rifle-magazine", "iron-plate", "lead-plate") - util.replace_some_ingredient("kr-crusher", "iron-beam", 5, "lead-plate", 5) - util.replace_ingredient("kr-shelter", "iron-plate", "lead-plate") - util.add_ingredient("kr-advanced-furnace", "lead-plate", 20) + util.replace_some_ingredient("kr-crusher", "iron-beam", 5, lead_bolt, 5) + util.replace_ingredient("kr-shelter", "iron-plate", lead_bolt) + util.add_ingredient("kr-advanced-furnace", lead_bolt, 20) util.replace_ingredient("uranium-fuel-cell", "steel-plate", "lead-plate") util.replace_some_ingredient("kr-fluid-storage-1", "steel-plate", 10, "lead-plate", 10) util.replace_some_ingredient("kr-fluid-storage-2", "steel-plate", 30, "lead-plate", 30) end if mods["modmashsplintergold"] then - if mods["Krastorio2"] then + if util.k2() then util.replace_ingredient("rifle-magazine-with-gold", "iron-plate", "lead-plate") util.replace_ingredient("anti-material-rifle-magazine-with-gold", "iron-plate", "lead-plate") end diff --git a/data-util.lua b/data-util.lua index fb70b99..c4144a0 100644 --- a/data-util.lua +++ b/data-util.lua @@ -78,6 +78,10 @@ function util.se6() return mods["space-exploration"] and mods["space-exploration"] >= "0.6" end +function util.k2() + return mods.Krastorio2 or mods["Krastorio2-spaced-out"] +end + util.cablesg = util.se6() and "electronic" or "cable" function get_setting(name) @@ -115,12 +119,9 @@ function util.fe_plus(sub) end end -function util.get_stack_size(default) - if mods.Krastorio2 then - local size = get_setting("kr-stack-size") - if size and tonumber(size) then - return tonumber(size) - end +function util.get_stack_size(default) + if util.k2() and kr_adjust_stack_sizes then + return tonumber(200) end return default end @@ -514,14 +515,16 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} -function util.k2matter(params, only_deconversion) - local matter = require("__Krastorio2__/prototypes/libraries/matter") +function util.k2matter(params) + local matter + if mods.Krastorio2 then + matter = require("__Krastorio2__/prototypes/libraries/matter") + else + matter = require("__Krastorio2-spaced-out__/prototypes/libraries/matter") + end if mods["space-exploration"] then params.k2matter.needs_stabilizer = true end - if not params.k2matter.material.amount then - params.k2matter.material.amount = 10 - end if not data.raw.technology[params.k2matter.unlocked_by] then local icon = "" if params.k2baseicon then @@ -561,15 +564,16 @@ function util.k2matter(params, only_deconversion) { {"production-science-pack", 1}, {"utility-science-pack", 1}, - {"matter-tech-card", 1} + {"kr-matter-tech-card", 1} }, time = 45, }, + effects = {} -- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, }, }) end - if only_deconversion then + if params.k2matter.only_deconversion then matter.make_deconversion_recipe(params.k2matter) else matter.make_recipes(params.k2matter) @@ -584,8 +588,8 @@ function util.se_matter(params) if not params.quant_in then params.quant_in = params.quant_out end if not params.icon_size then params.icon_size = 64 end local fname = "matter-fusion-"..params.ore - local sedata = mods.Krastorio2 and "se-kr-matter-synthesis-data" or "se-fusion-test-data" - local sejunk = mods.Krastorio2 and "se-broken-data" or "se-junk-data" + local sedata = util.k2() and "se-kr-matter-synthesis-data" or "se-fusion-test-data" + local sejunk = util.k2() and "se-broken-data" or "se-junk-data" data:extend({ { type = "recipe", @@ -622,7 +626,7 @@ function util.se_matter(params) }) util.add_unlock("se-space-matter-fusion", fname) - if mods.Krastorio2 then + if util.k2() then local lname = params.ore.."-to-particle-stream" data:extend({ enabled = false, diff --git a/info.json b/info.json index 6859c69..667b33b 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzlead", - "version": "2.0.24", + "version": "2.0.25", "factorio_version": "2.0", "title": "Lead", "author": "Brevven", @@ -13,6 +13,7 @@ "? hot-metals", "? space-exploration", "? Krastorio2", + "? Krastorio2-spaced-out", "? Rich-Rocks-Requiem", "? 248k", "? tenebris", diff --git a/lead-enriched.lua b/lead-enriched.lua index 0002690..7597222 100644 --- a/lead-enriched.lua +++ b/lead-enriched.lua @@ -1,7 +1,7 @@ -- Enriched Lead for Krastorio2 local util = require("data-util"); -if mods["Krastorio2"] then +if util.k2() then data:extend( { { @@ -37,13 +37,13 @@ data:extend( ingredients = { {type = "fluid", name = "sulfuric-acid", amount = 3}, - {type = "fluid", name = "water", amount = 25, catalyst_amount = 25}, + {type = "fluid", name = "water", amount = 25, ignored_by_stats=25, ignored_by_productivity=25}, {type = "item", name = "lead-ore", amount = 9} }, results = { {type = "item", name = "enriched-lead", amount = util.me.byproduct() and 5 or 6}, - {type = "fluid", name = "kr-dirty-water", amount = 25, catalyst_amount = 25}, + {type = "fluid", name = "kr-dirty-water", amount = 25, ignored_by_stats=25, ignored_by_productivity=25}, util.me.byproduct() and {type = "item", name = "copper-ore", amount = 2} or nil, }, crafting_machine_tint = @@ -101,11 +101,11 @@ data:extend( always_show_products = true, ingredients = { - {type = "fluid", name = "kr-dirty-water", amount = 100, catalyst_amount = 100}, + {type = "fluid", name = "kr-dirty-water", amount = 100, ignored_by_stats=100, ignored_by_productivity=100}, }, results = { - {type = "fluid", name = "water", amount = 90, catalyst_amount = 90}, + {type = "fluid", name = "water", amount = 90, ignored_by_stats=90, ignored_by_productivity=90}, {type = "item", name = "stone", probability = 0.30, amount = 1}, {type = "item", name = "lead-ore", probability = 0.50, amount = 1}, util.me.byproduct() and {type = "item", name = "copper-ore", probability = 0.05, amount = 1} or nil, diff --git a/lead-matter.lua b/lead-matter.lua index 8e4a2df..9d8f239 100644 --- a/lead-matter.lua +++ b/lead-matter.lua @@ -1,7 +1,6 @@ -- Matter recipes for Krastorio2 -if mods["Krastorio2"] then local util = require("data-util"); -local matter = require("__Krastorio2__/prototypes/libraries/matter") +if util.k2() then data:extend( { @@ -49,7 +48,7 @@ util.k2matter({ allow_productivity = true, unlocked_by = "lead-matter-processing" } -}, false) +}) util.k2matter({ k2matter = { @@ -62,8 +61,9 @@ util.k2matter({ energy_required = 2, needs_stabilizer = true, allow_productivity = true, + only_deconversion = true, unlocked_by = "lead-matter-processing" } -}, true) +}) end diff --git a/lead-recipe-final-stacking.lua b/lead-recipe-final-stacking.lua index 8d40e2d..5f73599 100644 --- a/lead-recipe-final-stacking.lua +++ b/lead-recipe-final-stacking.lua @@ -2,7 +2,7 @@ if deadlock and deadlock["add_stack"] then deadlock.add_stack("lead-ore", "__bzlead__/graphics/icons/stacked/lead-ore-stacked.png", "deadlock-stacking-1", 64) deadlock.add_stack("lead-plate", "__bzlead__/graphics/icons/stacked/lead-plate-stacked.png" , "deadlock-stacking-1", 64) - if mods["Krastorio2"] then + if util.k2() then deadlock.add_stack("enriched-lead", "__bzlead__/graphics/icons/stacked/enriched-lead-stacked.png" , "deadlock-stacking-1", 64) end if data.raw.item["lead-ingot"] then @@ -14,7 +14,7 @@ end if deadlock_crating then deadlock_crating.add_crate("lead-ore", "deadlock-crating-1") deadlock_crating.add_crate("lead-plate", "deadlock-crating-1") - if mods["Krastorio2"] then + if util.k2() then deadlock_crating.add_crate("enriched-lead", "deadlock-crating-1") end if data.raw.item["lead-ingot"] then diff --git a/lead-recipe-se.lua b/lead-recipe-se.lua index 4fb8d17..4751f96 100644 --- a/lead-recipe-se.lua +++ b/lead-recipe-se.lua @@ -47,11 +47,11 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then main_product = "molten-lead", subgroup = "lead", results = { - {type = "fluid", name = "molten-lead", amount = mods.Krastorio2 and 750 or 900}, + {type = "fluid", name = "molten-lead", amount = util.k2() and 750 or 900}, }, energy_required = 60, ingredients = { - {name = mods.Krastorio2 and "enriched-lead" or "lead-ore", amount = 24}, + {name = util.k2() and "enriched-lead" or "lead-ore", amount = 24}, {type = "fluid", name = "se-pyroflux", amount = 10}, }, enabled = false, @@ -100,7 +100,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "molten-lead"}) util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "lead-ingot"}) util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "lead-ingot-to-plate"}) - if mods["Krastorio2"] then + if util.k2() then util.set_item_subgroup("enriched-lead", "lead") data.raw.recipe["enriched-lead-plate"].order= "d[lead-plate]" se_delivery_cannon_recipes["enriched-lead"] = {name= "enriched-lead"} @@ -110,7 +110,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then se_delivery_cannon_recipes["lead-ingot"] = {name="lead-ingot"} else data.raw.item["lead-plate"].subgroup = "plates" - if mods["Krastorio2"] then + if util.k2() then data:extend({ { type = "recipe", diff --git a/lead-recipe-updates.lua b/lead-recipe-updates.lua index 2dca79d..ba48b26 100644 --- a/lead-recipe-updates.lua +++ b/lead-recipe-updates.lua @@ -60,7 +60,7 @@ if util.me.more_ammo() then util.add_effect("military", {type = "unlock-recipe", recipe = "firearm-magazine-iron-lead"}) util.add_effect("military", {type = "unlock-recipe", recipe = "firearm-magazine-iron-only"}) util.add_effect("military", {type = "unlock-recipe", recipe = "firearm-magazine-copper-lead"}) - if mods.Krastorio2 and util.me.get_setting("kr-more-realistic-weapon") then + if util.k2() and util.me.get_setting("kr-more-realistic-weapon") then util.add_effect("military", {type = "unlock-recipe", recipe = "rifle-magazine-iron-lead"}) util.add_effect("military", {type = "unlock-recipe", recipe = "rifle-magazine-iron"}) util.add_effect("military", {type = "unlock-recipe", recipe = "rifle-magazine-copper-lead"}) @@ -68,9 +68,9 @@ if util.me.more_ammo() then end -- Krastorio 2 changes -util.add_ingredient("kr-laser-artillery-turret", "lead-plate", 10) -util.add_ingredient("kr-railgun-turret", "lead-plate", 10) -util.add_ingredient("kr-rocket-turret", "lead-plate", 10) +util.add_ingredient("kr-laser-artillery-turret", leb, 10) +util.add_ingredient("kr-railgun-turret", leb, 10) +util.add_ingredient("kr-rocket-turret", leb, 10) -- Space Exploration if mods["space-exploration"] then diff --git a/lead-recipe.lua b/lead-recipe.lua index 5785d6d..8388a3c 100644 --- a/lead-recipe.lua +++ b/lead-recipe.lua @@ -10,7 +10,7 @@ data:extend({ name = util.me.lead_plate, category = "smelting", order = "d[lead-plate]", - icons = (mods["Krastorio2"] and + icons = (util.k2() and { { icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64, icon_mipmaps = 3, }, { icon = "__bzlead__/graphics/icons/lead-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, @@ -20,7 +20,7 @@ data:extend({ ), main_product = util.me.lead_plate, --- (mods["Krastorio2"] and +-- (util.k2() and -- { -- enabled = true, -- energy_required = 16, @@ -363,14 +363,14 @@ data:extend({ category = "smelting", subgroup = "raw-material", order = "d[lead-plate]", - icons = (mods["Krastorio2"] and + icons = (util.k2() and { { icon = "__IndustrialRevolution__/graphics/icons/64/lead-ingot.png", icon_size = 64, icon_mipmaps = 4, }, { icon = "__bzlead__/graphics/icons/lead-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, } or { { icon = "__IndustrialRevolution__/graphics/icons/64/lead-ingot.png", icon_size = 64, icon_mipmaps = 4, }, }), - normal = (mods["Krastorio2"] and + normal = (util.k2() and { enabled = true, energy_required = 16, @@ -404,7 +404,7 @@ data:extend({ end if util.me.more_ammo() then -if mods.Krastorio2 and util.me.get_setting("kr-more-realistic-weapon") then +if util.k2() and util.me.get_setting("kr-more-realistic-weapon") then data:extend({ { type = "recipe",