From 1bafd5c7f22b0f243192668e30e08ff7c7d2339b Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 18 Mar 2023 23:14:26 -0700 Subject: [PATCH] modmash --- changelog.txt | 5 +++ compatibility/modmashsplintergold.lua | 49 +++++++++++++++++++++++++ data-final-fixes.lua | 1 + info.json | 3 +- prototypes/electronic-circuit-final.lua | 1 + 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 compatibility/modmashsplintergold.lua diff --git a/changelog.txt b/changelog.txt index 0f03cc6..a01297b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.0.5 +Date: 2023-03-19 + Features: + - Compatible with ModMash Splinter Gold +--------------------------------------------------------------------------------------------------- Version: 0.0.4 Date: 2023-03-18 Fixes: diff --git a/compatibility/modmashsplintergold.lua b/compatibility/modmashsplintergold.lua new file mode 100644 index 0000000..c4d1628 --- /dev/null +++ b/compatibility/modmashsplintergold.lua @@ -0,0 +1,49 @@ +local futil = require("util"); +local util = require("data-util"); + +if mods.modmashsplintergold then + util.multiply_recipe("gold-plate", 2) + util.replace_ingredient("gold-plate", "gold-ore", "gold-ingot", 1) + util.set_enabled("gold-plate", false) + util.add_unlock("gold-processing", "gold-plate") + + + util.set_enabled("gold-ore", false) + util.set_hidden("gold-ore", true) + + for name, recipe in pairs(data.raw.recipe) do + local amt = util.get_ingredient_amount(name, "gold-plate") + if amt == 0 then + amt = util.get_ingredient_amount(name, "gold-cable") + end + if amt > 0 then + util.set_enabled(name, false) + util.remove_prior_unlocks("gold-processing", name) + util.add_unlock("gold-processing", name) + if recipe.icons then + for i, icon in pairs(recipe.icons) do + if string.match(icon.icon, "gold%-ore") then + icon.scale = (icon.scale or 1) / 2 + end + end + end + end + end + + -- alternate electronic circuit recipe that uses gold + util.remove_raw("recipe", "electronic-circuit-with-gold") + local ec = futil.table.deepcopy(data.raw.recipe["electronic-circuit"]) + ec.name = "electronic-circuit-with-gold" + data:extend({ec}) + util.replace_ingredient("electronic-circuit-with-gold", "copper-cable", "gold-cable") + util.set_icons("electronic-circuit-with-gold", { + { + icon = "__base__/graphics/icons/electronic-circuit.png", + icon_size = 64, icon_mipmaps = 4 + }, + { + icon = "__modmashsplintergold__/graphics/icons/gold-cable.png", + icon_size = 64, icon_mipmaps = 4, scale = 0.25, shift = {8,-8} + }, + }) +end diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 60847d7..6a3f1d6 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -2,6 +2,7 @@ require("stacking") require("prototypes/electronic-circuit-final") require("modules") require("prototypes/oil-updates") +require("compatibility/modmashsplintergold") -- require("tin-recipe-final-5d") -- require("tin-recipe-final-rrr") diff --git a/info.json b/info.json index 33ec486..b60375e 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzgold", - "version": "0.0.4", + "version": "0.0.5", "factorio_version": "1.1", "title": "Noble Metals", "author": "Brevven", @@ -23,6 +23,7 @@ "? Krastorio2", "? bobelectronics", "? MDbobelectronics", + "? modmashsplintergold", "? deadlock-beltboxes-loaders", "? DeadlockCrating" ], diff --git a/prototypes/electronic-circuit-final.lua b/prototypes/electronic-circuit-final.lua index 56c377e..4e3602d 100644 --- a/prototypes/electronic-circuit-final.lua +++ b/prototypes/electronic-circuit-final.lua @@ -20,3 +20,4 @@ util.set_icons("electronic-circuit-silver", { if util.check_unlock("electronics", "electronic-circuit") then util.add_unlock("electronics", "electronic-circuit-silver") end +