diff --git a/changelog.txt b/changelog.txt index 49fb97e..cfaf22a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ --------------------------------------------------------------------------------------------------- +Version: 2.1.1 +Date: 2025-01-25 + Fixes: + - Improve compatibility with mods that change armor recipes in certain ways + Changes: + - When byproducts are turned off, don't add extra furnace output +--------------------------------------------------------------------------------------------------- Version: 2.1.0 Date: 2025-01-19 Changes: diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 57ec283..d2064d8 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -9,12 +9,11 @@ if mods["space-exploration"] then end if mods.bztitanium then -for i, entity in pairs(data.raw.furnace) do - if entity.result_inventory_size ~= nil and entity.result_inventory_size < 2 and util.contains(entity.crafting_categories, "smelting") then - entity.result_inventory_size = 2 + if util.me.byproduct() then + -- If furnaces are treated as furnaces, we need 2 outputs + util.set_minimum_furnace_outputs("smelting", 2) end end -end -- Make sure these don't exist, just in case util.remove_raw("recipe", "stone-recycling") diff --git a/data-util.lua b/data-util.lua index 7f9e8ea..5879fb7 100644 --- a/data-util.lua +++ b/data-util.lua @@ -804,11 +804,19 @@ function add_or_add_to_ingredient(recipe, ingredient, quantity) end end +function util.get_item(name) + if data.raw.item[name] then return data.raw.item[name] end + if data.raw.armor[name] then return data.raw.armor[name] end + if data.raw["space-platform-starter-pack"] and data.raw["space-platform-starter-pack"][name] then return data.raw["space-platform-starter-pack"][name] end + -- TODO add more subtypes of item here + return nil +end + -- Add a given quantity of ingredient to a given recipe function util.add_ingredient(recipe_name, ingredient, quantity, options) if not should_force(options) and bypass(recipe_name) then return end local is_fluid = not not data.raw.fluid[ingredient] - if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then + if data.raw.recipe[recipe_name] and (util.get_item(ingredient) or is_fluid) then me.add_modified(recipe_name) prepare_redo_recycling(recipe_name) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) @@ -1769,6 +1777,21 @@ function util.redo_recycling() recycling.generate_recycling_recipe(recipe) end end + -- Find all recycling recipes that result in armor and make sure not to output more than 1 + for _, recipe in pairs(data.raw.recipe) do + if recipe.name:find("recycling") then + for _, product in pairs(recipe.results) do + if data.raw.armor[product.name] then + if product.amount then + if product.amount > .99 then + product.amount = 1 + product.extra_count_fraction = nil + end + end + end + end + end + end end end @@ -1777,6 +1800,15 @@ function prepare_redo_recycling(recipe_name) data.raw.recipe[recipe_name].redo_recycling = true end +-- Change furnace output count +function util.set_minimum_furnace_outputs(category, count) + for i, entity in pairs(data.raw.furnace) do + if entity.result_inventory_size ~= nil and entity.result_inventory_size < count and util.contains(entity.crafting_categories, category) then + entity.result_inventory_size = count + end + end +end + -- According to https://mods.factorio.com/mod/Asteroid_Mining, the -- following function is under this MIT license (similar license, different author): diff --git a/info.json b/info.json index 91866df..8baca9b 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzzirconium", - "version": "2.1.0", + "version": "2.1.1", "factorio_version": "2.0", "title": "Zirconium", "author": "Brevven",