From e7ca6e45cf004b0b2fd50ce71d77ebbf8495a94a Mon Sep 17 00:00:00 2001 From: Brevven Date: Mon, 4 Jul 2022 05:48:08 -0700 Subject: [PATCH] prep for tin --- changelog.txt | 8 ++++++++ data-final-fixes.lua | 1 + data-updates.lua | 1 - data-util.lua | 12 ++++++++++-- foundry-updates.lua | 2 ++ info.json | 2 +- prototypes/categories.lua | 9 +++++++++ prototypes/entity/electric-foundry.lua | 2 ++ prototypes/entity/foundry.lua | 2 ++ 9 files changed, 35 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9520da3..e480087 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,12 @@ --------------------------------------------------------------------------------------------------- +Version: 0.2.1 +Date: 2022-07-05 + Changes: + - Support for Tin + - Add basic founding recipe category. Pre-founding-tech recipes in this category can be crafted + by hand. + - Minor restructure of refractory recipes (should have no effect) +--------------------------------------------------------------------------------------------------- Version: 0.2.0 Date: 2022-07-01 Changes: diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 1ac6217..854a78a 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -1,4 +1,5 @@ local util = require("data-util") +require("refractory-updates") -- Prevent production deadlock if mods.Bio_Industries then diff --git a/data-updates.lua b/data-updates.lua index dbfe486..9540177 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -1,2 +1 @@ require("foundry-updates") -require("refractory-updates") diff --git a/data-util.lua b/data-util.lua index ffda9ed..8b49132 100644 --- a/data-util.lua +++ b/data-util.lua @@ -551,7 +551,7 @@ end -- Set recipe category function util.set_category(recipe_name, category) if me.bypass[recipe_name] then return end - if data.raw.recipe[recipe_name] then + if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then me.add_modified(recipe_name) data.raw.recipe[recipe_name].category = category end @@ -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 @@ -593,7 +601,7 @@ end -- Add crafting category to an entity function util.add_crafting_category(entity_type, entity, category) - if data.raw[entity_type][entity] then + if data.raw[entity_type][entity] and data.raw["recipe-category"][category] then for i, existing in pairs(data.raw[entity_type][entity].crafting_categories) do if existing == category then log(entity.." not adding "..category.." -- duplicate") diff --git a/foundry-updates.lua b/foundry-updates.lua index 82909a4..4c62015 100644 --- a/foundry-updates.lua +++ b/foundry-updates.lua @@ -15,6 +15,8 @@ if util.me.enable() then util.set_to_founding("cermet") -- from zirconium util.set_to_founding("crucible") -- from graphite + + util.set_category("solder", "basic-founding") else -- If we're not using Foundry buildings, add founding recipes to assemblers in vanilla, or furnaces in K2 local sought = mods.Krastorio2 and "smelting" or "crafting" diff --git a/info.json b/info.json index 3194085..54051c4 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzfoundry", - "version": "0.2.0", + "version": "0.2.1", "factorio_version": "1.1", "title": "Foundry", "author": "Brevven", diff --git a/prototypes/categories.lua b/prototypes/categories.lua index cc81889..108fcda 100644 --- a/prototypes/categories.lua +++ b/prototypes/categories.lua @@ -3,3 +3,12 @@ data:extend({ { type = "item-subgroup", name = "founding-machines", group = "production"}, { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"}, }) + +if mods.bztin or mods.bzaluminum then +data:extend({ + { type = "recipe-category", name = "basic-founding"}, +}) +for i, character in pairs(data.raw.character) do + table.insert(character.crafting_categories, "basic-founding") +end +end diff --git a/prototypes/entity/electric-foundry.lua b/prototypes/entity/electric-foundry.lua index 1b08908..e6b6570 100644 --- a/prototypes/entity/electric-foundry.lua +++ b/prototypes/entity/electric-foundry.lua @@ -158,3 +158,5 @@ data:extend({ }, }) + +futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding") diff --git a/prototypes/entity/foundry.lua b/prototypes/entity/foundry.lua index f942b5b..54ddb32 100644 --- a/prototypes/entity/foundry.lua +++ b/prototypes/entity/foundry.lua @@ -114,3 +114,5 @@ data:extend({ }, }) + +futil.add_crafting_category("assembling-machine", "foundry", "basic-founding")