From f71f7db31c70ac7cb7a6a3c535ace8b4e0b50507 Mon Sep 17 00:00:00 2001 From: Brevven Date: Fri, 1 Jul 2022 19:38:29 -0700 Subject: [PATCH] byproduct setting, tech tweaks --- aluminum-enriched.lua | 2 +- aluminum-recipe-se.lua | 12 +++++++----- aluminum-recipe.lua | 4 ++-- changelog.txt | 7 +++++++ data-util.lua | 8 ++++++++ info.json | 2 +- locale/en/aluminum.cfg | 2 ++ me.lua | 4 ++++ settings.lua | 6 ++++++ 9 files changed, 38 insertions(+), 9 deletions(-) diff --git a/aluminum-enriched.lua b/aluminum-enriched.lua index 5cfac5b..76f75a5 100644 --- a/aluminum-enriched.lua +++ b/aluminum-enriched.lua @@ -99,7 +99,7 @@ data:extend( results = { {type = "fluid", name = "water", amount = 90, catalyst_amount = 90}, - mods.bzsilicon and {type = "item", name = "silica", amount = 1} or + mods.bzsilicon and util.me.byproduct() and {type = "item", name = "silica", amount = 1} or {type = "item", name = "stone", probability = 0.40, amount = 1}, {type = "item", name = "aluminum-ore", probability = 0.10, amount = 1}, }, diff --git a/aluminum-recipe-se.lua b/aluminum-recipe-se.lua index 4e35e1d..a8921dd 100644 --- a/aluminum-recipe-se.lua +++ b/aluminum-recipe-se.lua @@ -31,8 +31,8 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then order = "a-h-z-a", } }) - data.raw.item["alumina"].subgroup = "aluminum" - data.raw.item["aluminum-plate"].subgroup = "aluminum" + util.set_item_subgroup("alumina", "aluminum") + util.set_item_subgroup("aluminum-plate", "aluminum") data:extend({ { type = "item", @@ -115,8 +115,10 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "aluminum-ingot-to-plate"}) if mods["Krastorio2"] then se_delivery_cannon_recipes["enriched-aluminum"] = {name= "enriched-aluminum"} + util.set_item_subgroup("enriched-aluminum", "aluminum") + else + if util.me.byproduct() then util.add_product("molten-aluminum", {"silica", 6}) end end - else -- Organization data.raw.item["aluminum-plate"].subgroup = "plates" @@ -186,8 +188,7 @@ else {name = "se-vulcanite-block", amount = 1}, }, results = { - {name = "alumina", amount = 10}, - {name = "silica", amount = 2}, + {name = "alumina", amount = util.me.byproduct() and 10 or 12}, }, icons = { @@ -198,6 +199,7 @@ else }, }) + if util.me.byproduct() then util.add_product("alumina-smelting-vulcanite", {"silica", 2}) end table.insert(data.raw.technology["se-processing-vulcanite"].effects, {type = "unlock-recipe", recipe= "alumina-smelting-vulcanite"}) end diff --git a/aluminum-recipe.lua b/aluminum-recipe.lua index 1baeed6..882a3b3 100644 --- a/aluminum-recipe.lua +++ b/aluminum-recipe.lua @@ -5,12 +5,12 @@ local futil = require("util"); local alumina_results = {} -if mods.bzsilicon and not mods.Krastorio2 then +if mods.bzsilicon and util.me.byproduct() and not mods.Krastorio2 then alumina_results ={ {type="item", name = "alumina", amount=1, probability=0.95}, {type="item", name = "silica", amount=1, probability=0.05}, } -elseif mods.bzsilicon and mods.Krastorio2 then +elseif mods.bzsilicon and util.me.byproduct() and mods.Krastorio2 then alumina_results ={ {type="item", name = "alumina", amount=5, probability=0.95}, {type="item", name = "silica", amount=1, probability=0.25}, diff --git a/changelog.txt b/changelog.txt index 1482415..220ef54 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ --------------------------------------------------------------------------------------------------- +Version: 0.3.1 +Date: 2022-07-01 + Changes: + - Minor SE tweaks including pyroflux tech change. + Features: + - Add option to turn off byproduct. (This setting will show up in other resource mods soon). +--------------------------------------------------------------------------------------------------- Version: 0.3.0 Date: 2022-07-01 Changes: diff --git a/data-util.lua b/data-util.lua index ffda9ed..0994028 100644 --- a/data-util.lua +++ b/data-util.lua @@ -566,6 +566,14 @@ function util.set_subgroup(recipe_name, subgroup) end end +-- Set item subgroup +function util.set_item_subgroup(item, subgroup) + if me.bypass[item] then return end + if data.raw.item[item] and data.raw["item-subgroup"][subgroup] then + data.raw.item[item].subgroup = subgroup + end +end + -- Set recipe icons function util.set_icons(recipe_name, icons) if me.bypass[recipe_name] then return end diff --git a/info.json b/info.json index 4f02f08..90afb89 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzaluminum", - "version": "0.3.0", + "version": "0.3.1", "factorio_version": "1.1", "title": "Aluminum", "author": "Brevven", diff --git a/locale/en/aluminum.cfg b/locale/en/aluminum.cfg index 3213d2c..0b60ffd 100644 --- a/locale/en/aluminum.cfg +++ b/locale/en/aluminum.cfg @@ -66,7 +66,9 @@ dirty-water-filtration-aluminum=Filter dirty water, giving __ITEM__aluminum_lowe [mod-setting-name] bzaluminum-recipe-bypass=Bypass recipes bzaluminum-list=Make a list of modified recipes +bzaluminum-byproduct=Output byproducts [mod-setting-description] bzaluminum-recipe-bypass=Skip modifying these recipes (comma-separated list). bzaluminum-list=If enabled, the text command [color=orange]BZList[/color] will dump a file to the script-output directory with a full list of recipes modified.\nRecommended to turn this off after you are done configuring your other settings. +bzaluminum-byproduct=If enabled, and if silica is used, __ITEM__aluminum_lower__ production will output silica as a byproduct. diff --git a/me.lua b/me.lua index 69db661..760e4c6 100644 --- a/me.lua +++ b/me.lua @@ -7,6 +7,10 @@ function me.mod_setting() return me.get_setting("bzmod-setting") == "yes" end +function me.byproduct() + return me.get_setting("bzaluminum-byproduct") +end + function me.get_setting(name) if settings.startup[name] == nil then return nil diff --git a/settings.lua b/settings.lua index 92ac77a..940cff4 100644 --- a/settings.lua +++ b/settings.lua @@ -6,6 +6,12 @@ data:extend({ default_value = "", allow_blank = true, }, + { + type = "bool-setting", + name = "bzaluminum-byproduct", + setting_type = "startup", + default_value = true, + }, { type = "bool-setting", name = "bzaluminum-list",