From fcfc3e7b1573c7d2f98e8249cfc30ca0e757d063 Mon Sep 17 00:00:00 2001 From: Brevven Date: Wed, 5 Jan 2022 00:18:11 -0800 Subject: [PATCH] optional ammo recipes --- changelog.txt | 5 ++++ info.json | 2 +- lead-recipe-updates.lua | 6 +++++ lead-recipe.lua | 55 +++++++++++++++++++++++++++++++++++++++++ locale/en/lead.cfg | 2 ++ me.lua | 3 +++ settings.lua | 7 ++++++ 7 files changed, 79 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 7c47797..108c3eb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.6.2 +Date: 2022-01-03 + Changes: + - Add an option for more ammunition recipes. +--------------------------------------------------------------------------------------------------- Version: 0.6.1 Date: 2022-01-01 Changes: diff --git a/info.json b/info.json index e790060..08fab72 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzlead", - "version": "0.6.1", + "version": "0.6.2", "factorio_version": "1.1", "title": "Lead", "author": "Brevven", diff --git a/lead-recipe-updates.lua b/lead-recipe-updates.lua index cfb3742..34ab166 100644 --- a/lead-recipe-updates.lua +++ b/lead-recipe-updates.lua @@ -28,6 +28,12 @@ if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting util.replace_ingredient("shotgun-shell", "iron-plate", "lead-plate") end +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"}) +end + -- Krastorio 2 changes util.add_ingredient("kr-laser-artillery-turret", "lead-plate", 10) util.add_ingredient("kr-railgun-turret", "lead-plate", 10) diff --git a/lead-recipe.lua b/lead-recipe.lua index f6fab57..d7feb82 100644 --- a/lead-recipe.lua +++ b/lead-recipe.lua @@ -135,3 +135,58 @@ data:extend({ }, }) end + +if util.me.more_ammo() then +data:extend({ +{ + type = "recipe", + name = "firearm-magazine-iron-lead", + category = "crafting", + order = "a[basic-clips]-a[firearm-magazine]-i", + energy_required = data.raw.recipe["firearm-magazine"].energy_required * 2, + ingredients = {{"lead-plate", 4}, {"iron-plate", 5}}, + result = "firearm-magazine", + result_count = 2, + enabled = false, + icons = { + { icon = "__base__/graphics/icons/firearm-magazine.png", icon_size = 64}, + { icon = "__base__/graphics/icons/iron-plate.png", icon_size = 64, + scale=0.25, shift= {8, -8}}, + { icon = "__bzlead__/graphics/icons/lead-plate.png", + icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, + }, +}, +{ + type = "recipe", + name = "firearm-magazine-iron-only", + category = "crafting", + order = "a[basic-clips]-a[firearm-magazine]-io", + energy_required = data.raw.recipe["firearm-magazine"].energy_required, + ingredients = {{"iron-plate", 5}}, + result = "firearm-magazine", + enabled = false, + icons = { + { icon = "__base__/graphics/icons/firearm-magazine.png", icon_size = 64}, + { icon = "__base__/graphics/icons/iron-plate.png", icon_size = 64, + scale=0.25, shift= {8, -8}}, + }, +}, +{ + type = "recipe", + name = "firearm-magazine-copper-lead", + category = "crafting", + order = "a[basic-clips]-a[firearm-magazine]-c", + energy_required = data.raw.recipe["firearm-magazine"].energy_required, + ingredients = {{"lead-plate", 3}, {"copper-plate", 1}}, + result = "firearm-magazine", + enabled = false, + icons = { + { icon = "__base__/graphics/icons/firearm-magazine.png", icon_size = 64}, + { icon = "__base__/graphics/icons/copper-plate.png", icon_size = 64, + scale=0.25, shift= {8, -8}}, + { icon = "__bzlead__/graphics/icons/lead-plate.png", + icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, + }, +}, +}) +end diff --git a/locale/en/lead.cfg b/locale/en/lead.cfg index 42dd160..e301f30 100644 --- a/locale/en/lead.cfg +++ b/locale/en/lead.cfg @@ -43,7 +43,9 @@ dirty-water-filtration-lead=Filter dirty water, giving lead ore [item=lead-ore], [mod-setting-name] bzlead-recipe-bypass=Bypass recipes bzlead-more-entities=Lead entities +bzlead-more-ammo=More recipes for ammunition. [mod-setting-description] bzlead-recipe-bypass=Skip modifying these recipes (comma-separated list). bzlead-more-entities=Adds lead entities (currently just a lead chest). +bzlead-more-ammo=Default is lead-only. This adds other options. diff --git a/me.lua b/me.lua index e4d1d8c..587d76c 100644 --- a/me.lua +++ b/me.lua @@ -9,6 +9,9 @@ function me.more_entities() return me.get_setting("bzlead-more-entities") == "yes" end +function me.more_ammo() + return me.get_setting("bzlead-more-ammo") == "yes" +end function me.get_setting(name) if settings.startup[name] == nil then diff --git a/settings.lua b/settings.lua index df11756..768c9b4 100644 --- a/settings.lua +++ b/settings.lua @@ -13,4 +13,11 @@ data:extend({ default_value = "no", allowed_values = {"yes", "no"}, }, + { + type = "string-setting", + name = "bzlead-more-ammo", + setting_type = "startup", + default_value = "no", + allowed_values = {"yes", "no"}, + }, })