From e7366fc8095dbb9d27981d0d244a078fc7703e5c Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 3 May 2025 15:06:23 -0700 Subject: [PATCH] k2 spaced out --- carbon-matter.lua | 4 ++-- carbon-recipe-final-k2.lua | 2 +- carbon-recipe-k2.lua | 2 +- carbon-recipe-updates.lua | 10 ++++++---- carbon-recipe.lua | 22 +++++++++++----------- changelog.txt | 6 ++++++ data-final-fixes.lua | 2 +- data-updates.lua | 2 +- data-util.lua | 19 ++++++++++++++----- data.lua | 7 ++++++- info.json | 3 ++- prototypes/graphite.lua | 2 ++ 12 files changed, 53 insertions(+), 28 deletions(-) diff --git a/carbon-matter.lua b/carbon-matter.lua index 7f82a21..d62bd8d 100644 --- a/carbon-matter.lua +++ b/carbon-matter.lua @@ -1,6 +1,6 @@ -- Matter recipes for Krastorio2 -if mods["Krastorio2"] then local util = require("data-util"); +if util.k2() then data:extend( { @@ -16,7 +16,7 @@ data:extend( { icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128, - scale = 1.4, + scale = 0.7, } }, effects = {}, diff --git a/carbon-recipe-final-k2.lua b/carbon-recipe-final-k2.lua index 495b2fe..e4542ce 100644 --- a/carbon-recipe-final-k2.lua +++ b/carbon-recipe-final-k2.lua @@ -1,6 +1,6 @@ local util = require("data-util") local cutil = require("carbon-util") -if mods.Krastorio2 then +if util.k2() then if util.me.use_fullerenes() then -- Add extra nanotube recipes. -- This could be moved to data-updates in future if necessary diff --git a/carbon-recipe-k2.lua b/carbon-recipe-k2.lua index 5bc5c19..0cad48b 100644 --- a/carbon-recipe-k2.lua +++ b/carbon-recipe-k2.lua @@ -1,6 +1,6 @@ local util = require("data-util"); -if mods.Krastorio2 then +if util.k2() then -- HCL graphite processing if util.me.use_flake_graphite() then diff --git a/carbon-recipe-updates.lua b/carbon-recipe-updates.lua index 774b294..cdc7185 100644 --- a/carbon-recipe-updates.lua +++ b/carbon-recipe-updates.lua @@ -21,7 +21,7 @@ end util.add_prerequisite("electronics", "graphite-processing") -if mods.Krastorio2 then +if util.k2() then util.add_prerequisite("graphite-processing", "automation-science-pack") util.add_prerequisite("graphite-processing", "basic-fluid-handling") end @@ -71,7 +71,7 @@ if util.me.use_fullerenes() then util.add_prerequisite("graphene", "fullerenes") util.add_prerequisite("military-3", "fullerenes") util.replace_some_ingredient("poison-capsule", "coal", 9, "fullerenes", 90) - if not mods.Krastorio2 then + if not util.k2() then util.replace_some_ingredient("slowdown-capsule", "coal", 4, "fullerenes", 40) end util.add_ingredient("capture-bot-rocket", "fullerenes", 10) @@ -170,7 +170,7 @@ if util.me.reuse() then end end -if mods.Krastorio2 then +if util.k2() then util.replace_some_ingredient("steel-plate", "iron-plate", 2, "graphite", 4) util.add_ingredient("tungsten-carbide", "graphite", 4) util.replace_some_ingredient("kr-s-c-steel-beam", "iron-plate", 4, "graphite", 8) @@ -180,7 +180,9 @@ elseif mods.bzfoundry and util.me.foundry_enable() then util.replace_some_ingredient("tungsten-carbide", "tungsten-plate", 1, "graphite", 1) end -if not mods.Krastorio2 then +util.add_ingredient("kr-energy-control-unit", "activated-carbon", 3) + +if not util.k2() then util.multiply_recipe("lubricant", 2) end util.replace_some_ingredient("lubricant", "heavy-oil", 10, "graphite", 1) diff --git a/carbon-recipe.lua b/carbon-recipe.lua index ee0a554..b549e7a 100644 --- a/carbon-recipe.lua +++ b/carbon-recipe.lua @@ -8,7 +8,7 @@ end if mods["space-age"] then graphite_category = "basic-crushing" end -if mods.Krastorio2 then +if util.k2() then graphite_category = "kr-crushing" end @@ -40,12 +40,12 @@ data:extend({ name = "graphite", category = graphite_category, order = "d[graphite]", - icons = (mods["Krastorio2"] and + icons = (util.k2() and { { icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128}, { icon = "__bzcarbon__/graphics/icons/flake-graphite.png", icon_size = 128, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, } or nil), - -- normal = (mods["Krastorio2"] and + -- normal = (util.k2() and -- { -- enabled = false, -- energy_required = 5, @@ -127,7 +127,7 @@ end -if mods.Krastorio2 then +if util.k2() then util.add_prerequisite("graphite-processing", "kr-crusher") else -- util.add_prerequisite("graphite-processing", "automation") @@ -135,7 +135,7 @@ end -if mods["space-exploration"] and not mods.Krastorio2 then +if mods["space-exploration"] and not util.k2() then data:extend({ { type = "recipe", @@ -213,12 +213,12 @@ data:extend({ category = "advanced-crafting", subgroup = "raw-material", order = "d[diamond]", - icons = (mods["Krastorio2"] and + icons = (util.k2() and { { icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128}, { icon = "__bzcarbon__/graphics/icons/rough-diamond.png", icon_size = 64, scale=0.25, shift= {-8, -8}}, } or {{ icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128}}), - -- normal = (mods["Krastorio2"] and + -- normal = (util.k2() and -- { -- enabled = false, -- energy_required = 20, @@ -301,7 +301,7 @@ data:extend({ enabled = false, allow_productivity=true, energy_required = 5, - ingredients = (mods["space-age"] or mods.Krastorio2) and { + ingredients = (mods["space-age"] or util.k2()) and { {type="item", name="graphite", amount=1}, {type="fluid", name=ammonia, amount=5}, {type="fluid", name="water", amount=10}, @@ -381,7 +381,7 @@ data:extend({ enabled = false, allow_productivity=true, energy_required = 1, - ingredients = mods.Krastorio2 and + ingredients = util.k2() and { {type="item", name="graphite", amount=2}, {type="fluid", name="kr-nitrogen", amount=2}, @@ -451,7 +451,7 @@ data:extend({ {type="item", name="nanotubes", amount=1}, {type="item", name="iron-plate", amount=1, probability=0.95, ignored_by_stats=1, ignored_by_productivity=1}, {type="fluid", name="sulfuric-acid", amount=9, ignored_by_stats=9, ignored_by_productivity=9}, - mods.Krastorio3 and {type="fluid", name="dirty-water", amount=1, ignored_by_stats=1, ignored_by_productivity=1} or nil, + util.k2() and {type="fluid", name="kr-dirty-water", amount=1, ignored_by_stats=1, ignored_by_productivity=1} or nil, }, }, { @@ -470,7 +470,7 @@ data:extend({ { count = 1000, ingredients = - (mods.Krastorio2 and not mods["space-exploration"] and + (util.k2() and not mods["space-exploration"] and { {"production-science-pack", 1}, {"utility-science-pack", 1}, diff --git a/changelog.txt b/changelog.txt index e6a7cf8..e4cc727 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,10 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.18 +Date: 2025-05-04 + Changes: + - Support for K2 spaced out + - Minor k2 2 tweaks +--------------------------------------------------------------------------------------------------- Version: 2.0.17 Date: 2025-05-03 Changes: diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 9013478..8d6cca5 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -119,7 +119,7 @@ end util.remove_ingredient("electric-furnace", "cuw") -- support new tungsten -- Vanilla burner phase tweaks -- green circuits after electronics -if not mods.Krastorio2 and not mods["aai-industry"] and not mods.bzaluminum then +if not util.k2() and not mods["aai-industry"] and not mods.bzaluminum then util.replace_ingredient("electric-mining-drill", "electronic-circuit", "copper-cable", 6) -- Most of this can go post 2.0 diff --git a/data-updates.lua b/data-updates.lua index 46c02d6..da253db 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -12,7 +12,7 @@ require("compatibility/orewashing") local util = require("data-util"); if util.me.use_flake_graphite() then - if mods.Krastorio2 then + if util.k2() then require("tech-triggers") -- For K2 this has to be in data updates as K2 unsafely access the tech research unit end end diff --git a/data-util.lua b/data-util.lua index 29ebf26..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) @@ -116,7 +120,7 @@ function util.fe_plus(sub) end function util.get_stack_size(default) - if mods.Krastorio2 and kr_adjust_stack_sizes then + if util.k2() and kr_adjust_stack_sizes then return tonumber(200) end return default @@ -512,7 +516,12 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} function util.k2matter(params) - local matter = require("__Krastorio2__/prototypes/libraries/matter") + 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 @@ -579,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", @@ -617,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/data.lua b/data.lua index 6123503..25c50ce 100644 --- a/data.lua +++ b/data.lua @@ -1,10 +1,15 @@ require("prototypes.basic-crusher") require("prototypes.graphite") +log("1") require("prototypes.graphite-particle") +log("2") require("prototypes.diamond") +log("3") require("prototypes.diamond-particle") +log("4") require("carbon-recipe") +log("5") require("carbon-recipe-k2") -- must be after carbon-recipe require("carbon-recipe-se") require("prototypes.activated-carbon") @@ -21,7 +26,7 @@ end util.add_fluid_mining() if util.me.use_flake_graphite() then - if not mods.Krastorio2 then + if not util.k2() then require("tech-triggers") end else diff --git a/info.json b/info.json index a3b6448..8881915 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzcarbon", - "version": "2.0.17", + "version": "2.0.18", "factorio_version": "2.0", "title": "Graphite & Diamonds", "author": "Brevven", @@ -16,6 +16,7 @@ "? space-exploration", "? aai-industry", "? Krastorio2", + "? Krastorio2-spaced-out", "? 248k", "(?) modmashsplintersubspacelogistics", "? deadlock-beltboxes-loaders", diff --git a/prototypes/graphite.lua b/prototypes/graphite.lua index 0c63026..a4eaaa9 100644 --- a/prototypes/graphite.lua +++ b/prototypes/graphite.lua @@ -12,6 +12,7 @@ if mods.tenebris then data.raw.planet.tenebris.map_gen_settings.autoplace_settings.entity.settings["graphite"] = {} end +log("B") data:extend({ { type = "autoplace-control", @@ -89,3 +90,4 @@ data:extend({ }, }) end +log("A")