From 11a3e17c4be3b8e313499b2f07ab98882ea10dc4 Mon Sep 17 00:00:00 2001 From: Brevven Date: Thu, 23 Mar 2023 03:12:45 -0700 Subject: [PATCH] 248k --- changelog.txt | 2 ++ compatibility/248k-final.lua | 18 ++++++++++++++++++ compatibility/248k.lua | 6 ++++++ data-final-fixes.lua | 1 + data-util.lua | 12 ++++++++---- data.lua | 2 ++ description.md | 5 ++--- info.json | 1 + migrations/bzgold.0.0.6.json | 7 +++++++ 9 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 compatibility/248k-final.lua create mode 100644 compatibility/248k.lua create mode 100644 migrations/bzgold.0.0.6.json diff --git a/changelog.txt b/changelog.txt index 4c71005..df09afa 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ --------------------------------------------------------------------------------------------------- Version: 0.0.6 Date: 2023-03-22 + Features: + - Basic compatility with 248k, unified gold ingot items and production lines. Fixes: - SE: Satellite rocket silo no longer requires palladium, due to tech deadlock --------------------------------------------------------------------------------------------------- diff --git a/compatibility/248k-final.lua b/compatibility/248k-final.lua new file mode 100644 index 0000000..e83b478 --- /dev/null +++ b/compatibility/248k-final.lua @@ -0,0 +1,18 @@ +local util = require("data-util"); + +if mods["248k"] then + local au2 = "fu_materials_gold_ingot" + + -- Swap out all 248k gold ingot for BZ gold ingot + for i, recipe in pairs(data.raw.recipe) do + util.replace_ingredient(recipe.name, au2, "gold-ingot") + util.replace_product(recipe.name, au2, "gold-ingot") + end + + if mods.LootingRemnants and data.raw.recipe.gr_white_hole_cycle_fu_materials_gold_recipe~=nil then + data.raw.recipe.gr_white_hole_cycle_fu_materials_gold_recipe.exception_mods = {"Deconstruction", "LootingRemnants"} + end + + -- Remove 248k gold ingot + util.remove_raw("item", au2) +end diff --git a/compatibility/248k.lua b/compatibility/248k.lua new file mode 100644 index 0000000..da7600e --- /dev/null +++ b/compatibility/248k.lua @@ -0,0 +1,6 @@ +local util = require("data-util"); + +-- Update 248k gold production chain to include gold ore +util.add_ingredient("fi_pure_gold_recipe", "gold-ore", 10) +util.add_to_product("fi_pure_gold_recipe", "fi_materials_pure_gold", 2) + diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 6a3f1d6..7ef871d 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -3,6 +3,7 @@ require("prototypes/electronic-circuit-final") require("modules") require("prototypes/oil-updates") require("compatibility/modmashsplintergold") +require("compatibility/248k-final") -- require("tin-recipe-final-5d") -- require("tin-recipe-final-rrr") diff --git a/data-util.lua b/data-util.lua index d64decc..6085886 100644 --- a/data-util.lua +++ b/data-util.lua @@ -1257,8 +1257,10 @@ function remove_prior_unlocks(tech, recipe) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) + if string.sub(prerequisite, 1, 3) ~= 'ei_' then + -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) + end end end end @@ -1299,8 +1301,10 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) end if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| - replace_ingredients_prior_to(prerequisite, old, new, multiplier) + log("BZZZ checking " .. prerequisite) -- Handy Debug :| + if string.sub(prerequisite, 1, 3) ~= 'ei_' then + replace_ingredients_prior_to(prerequisite, old, new, multiplier) + end end end end diff --git a/data.lua b/data.lua index 169c44b..727db4a 100644 --- a/data.lua +++ b/data.lua @@ -17,6 +17,8 @@ require("prototypes/enriched-gold") require("prototypes/pyroflux-gold") require("prototypes/pyroflux-silver") +require("compatibility/248k") + local util = require("data-util"); if util.se6() then diff --git a/description.md b/description.md index c051ca6..bcb805b 100644 --- a/description.md +++ b/description.md @@ -12,15 +12,14 @@ Supported compatible mods: - Space Exploration & AAI - Krastorio 2 -- Bob's electronics +- Bob's electronics, 248k, Mod Mash Splinter Gold - Deadlock stacking, crating Coming soon: RSO -Coming soon: FE+, 5Dim's, ModMash, ScienceCostTweaker, etc. +Coming soon: FE+, 5Dim's, ScienceCostTweaker, etc. Many other mods are compatible but not yet fully supported. Suggestions always appreciated! - ---- Special thanks to diff --git a/info.json b/info.json index 5208d75..e6469c4 100644 --- a/info.json +++ b/info.json @@ -17,6 +17,7 @@ "? bztin >= 0.1.8", "? bzgas", "? bzchlorine", + "? 248k >= 1.0.29", "? space-exploration >= 0.6.0", "? aai-industry", "(?) aai-loaders", diff --git a/migrations/bzgold.0.0.6.json b/migrations/bzgold.0.0.6.json new file mode 100644 index 0000000..cd28c21 --- /dev/null +++ b/migrations/bzgold.0.0.6.json @@ -0,0 +1,7 @@ +{ + "item": + [ + ["fu_materials_gold_ingot", "gold-ingot"] + ] +} +