From dc284a4e5ea125f51c6554d4eb8a76a667f66270 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Wed, 11 Mar 2026 23:32:15 +0100 Subject: [PATCH 1/8] K2: Fix bug in matter recipe generation --- bzlib/data-util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bzlib/data-util.lua b/bzlib/data-util.lua index c279b07..c082fd6 100644 --- a/bzlib/data-util.lua +++ b/bzlib/data-util.lua @@ -600,7 +600,7 @@ function util.k2matter(params) time = 45, }, effects = {}, - localised_name = { "technology-name.k2-conversion", { "item-name." .. params.k2matter.item_name } }, + localised_name = { "technology-name.k2-conversion", { "item-name." .. params.k2matter.material.name } }, }, }) end From 0f8cf2c93d2a05461852ac87d7adcf37791951ae Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Wed, 11 Mar 2026 23:39:15 +0100 Subject: [PATCH 2/8] Fix bug in add_icon when icons table is nil --- bzlib/data-util.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/bzlib/data-util.lua b/bzlib/data-util.lua index c082fd6..7a91f89 100644 --- a/bzlib/data-util.lua +++ b/bzlib/data-util.lua @@ -1591,6 +1591,7 @@ function util.add_icon(recipe_name, icon, options) data.raw.recipe[recipe_name].icon = nil data.raw.recipe[recipe_name].icon_size = nil end + data.raw.recipe[recipe_name].icons = data.raw.recipe[recipe_name].icons or {} table.insert(data.raw.recipe[recipe_name].icons, icon) end end From ae38826a2e06138c60ec5746a5038983dbd3e0cb Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Wed, 11 Mar 2026 23:39:46 +0100 Subject: [PATCH 3/8] 1.0.1 --- bzlib/changelog.txt | 6 ++++++ bzlib/info.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 bzlib/changelog.txt diff --git a/bzlib/changelog.txt b/bzlib/changelog.txt new file mode 100644 index 0000000..7767941 --- /dev/null +++ b/bzlib/changelog.txt @@ -0,0 +1,6 @@ +--------------------------------------------------------------------------------------------------- +Version: 1.0.1 +Date: 11.03.2026 + Bug Fixes: + - K2: Fix bug in matter recipe generation + - Fix bug in add_icon when icons table is nil \ No newline at end of file diff --git a/bzlib/info.json b/bzlib/info.json index b06128d..82b6b2f 100644 --- a/bzlib/info.json +++ b/bzlib/info.json @@ -1,6 +1,6 @@ { "name": "bzlib", - "version": "1.0.0", + "version": "1.0.1", "factorio_version": "2.0", "title": "BZ Lib", "description": "Library code for BZ mods", From fe85b07625dc16f40767d2bb511c1338cc0d24fa Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Fri, 13 Mar 2026 12:36:35 +0100 Subject: [PATCH 4/8] Add get_setting --- bzlib/data-util.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bzlib/data-util.lua b/bzlib/data-util.lua index 7a91f89..8cf4d73 100644 --- a/bzlib/data-util.lua +++ b/bzlib/data-util.lua @@ -80,6 +80,13 @@ function util.initialize(them) util.me = me end +function util.get_setting(name) + if settings.startup[name] == nil then + return nil + end + return settings.startup[name].value +end + function util.item(item, quantity, probability) if not quantity then quantity = 1 From 0945cb977376dc633326e365db970ae2dd5b59a5 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Fri, 13 Mar 2026 12:36:50 +0100 Subject: [PATCH 5/8] Make me optional --- bzlib/data-util.lua | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bzlib/data-util.lua b/bzlib/data-util.lua index 8cf4d73..a59c209 100644 --- a/bzlib/data-util.lua +++ b/bzlib/data-util.lua @@ -124,13 +124,13 @@ end allbypass = {} if get_setting("bz-recipe-bypass") then - for recipe in string.gmatch(me.get_setting("bz-recipe-bypass"), '[^",%s]+') do + for recipe in string.gmatch(util.get_setting("bz-recipe-bypass"), '[^",%s]+') do allbypass[recipe] = true end end function util.is_foundry() - return util.bz.foundry and not me.get_setting("bzfoundry-minimal") + return util.bz.foundry and not util.get_setting("bzfoundry-minimal") end function should_force(options) @@ -138,7 +138,7 @@ function should_force(options) end function bypass(recipe_name) - if me.bypass[recipe_name] then + if me and me.bypass[recipe_name] then return true end if allbypass[recipe_name] then @@ -423,7 +423,7 @@ function util.add_gleba_rock(resource, amount_min, amount_max) }) local probability = data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression -- A lot more common near starting point when aps gleba - local factor = (mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 20) or 1 + local factor = (mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 20) or 1 data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression = probability .. [[* if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 200, ]] .. factor .. [[, if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 700, @@ -432,8 +432,8 @@ function util.add_gleba_rock(resource, amount_min, amount_max) end if data.raw.item[resource] then - amount_min = (amount_min or 10) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1) - amount_max = (amount_max or 20) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1) + amount_min = (amount_min or 10) * ((mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 4) or 1) + amount_max = (amount_max or 20) * ((mods["any-planet-start"] and util.get_setting("aps-planet") == "gleba" and 4) or 1) util.add_minable_result( "simple-entity", "gleba-rock", { type = "item", name = resource, amount_min = amount_min, amount_max = amount_max }) @@ -536,7 +536,7 @@ function util.se_landfill(params) type = "recipe", icons = { { icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 }, - { icon = "__" .. me.name .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size }, + { icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size }, }, energy_required = 1, enabled = false, @@ -644,7 +644,7 @@ function util.se_matter(params) icon_size = 64, scale = 0.5 }, { icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png", icon_size = 64, scale = 0.33, shift = { 8, -8 } }, - { icon = "__" .. util.me.name .. "__/graphics/icons/" .. params.ore .. ".png", + { icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { -8, 8 } }, { icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png", icon_size = 64, scale = 0.5 }, @@ -683,7 +683,7 @@ function util.se_matter(params) icon_size = 64, scale = 0.5 }, { icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png", icon_size = 64, scale = 0.33, shift = { -8, 8 } }, - { icon = "__" .. util.me.name .. "__/graphics/icons/" .. params.ore .. ".png", + { icon = "__" .. (me and me.name or params.ore) .. "__/graphics/icons/" .. params.ore .. ".png", icon_size = params.icon_size, scale = 0.33 * 64 / params.icon_size, shift = { 8, -8 } }, { icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png", icon_size = 64, scale = 0.5 }, @@ -967,7 +967,7 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options) end local is_fluid = not not data.raw.fluid[ingredient] if data.raw.recipe[recipe_name] and (util.get_item(ingredient) or is_fluid) then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) end @@ -1130,7 +1130,7 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option return end if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) and (data.raw.item[old] or data.raw.fluid[old]) then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) end @@ -1164,7 +1164,7 @@ function util.remove_ingredient(recipe_name, old, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) remove_ingredient(data.raw.recipe[recipe_name], old) end @@ -1967,6 +1967,10 @@ function util.sum_products(recipe_name) return 0 end +function util.add_productivity(recipe) + data.raw.recipe[recipe].allow_productivity = true +end + function util.set_vtk_dcm_ingredients() if mods["vtk-deep-core-mining"] then local sum = util.sum_products("vtk-deepcore-mining-ore-chunk-refining") From 9a934f35445f989f2da53d1699deb672efc8b916 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Fri, 13 Mar 2026 13:09:45 +0100 Subject: [PATCH 6/8] 1.1.0 --- bzlib/changelog.txt | 6 ++++++ bzlib/info.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bzlib/changelog.txt b/bzlib/changelog.txt index 7767941..7251655 100644 --- a/bzlib/changelog.txt +++ b/bzlib/changelog.txt @@ -1,4 +1,10 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.0 +Date: 13.03.2026 + Changes: + - Add get_setting + - Make `me` optional +--------------------------------------------------------------------------------------------------- Version: 1.0.1 Date: 11.03.2026 Bug Fixes: diff --git a/bzlib/info.json b/bzlib/info.json index 82b6b2f..9f28f85 100644 --- a/bzlib/info.json +++ b/bzlib/info.json @@ -1,6 +1,6 @@ { "name": "bzlib", - "version": "1.0.1", + "version": "1.1.0", "factorio_version": "2.0", "title": "BZ Lib", "description": "Library code for BZ mods", From 48fb18d37a1cdd072a461b15e0ce823b5458f1fb Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Fri, 13 Mar 2026 21:45:29 +0100 Subject: [PATCH 7/8] Make me optional (more fixes) --- bzlib/data-util.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bzlib/data-util.lua b/bzlib/data-util.lua index a59c209..78ac0c0 100644 --- a/bzlib/data-util.lua +++ b/bzlib/data-util.lua @@ -1018,7 +1018,7 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options) end if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then local is_fluid = not not data.raw.fluid[ingredient] - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) end @@ -1192,7 +1192,7 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount end local is_fluid = not not data.raw.fluid[new] -- NOTE CURRENTLY UNUSUED if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) end @@ -1226,7 +1226,7 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo end local is_fluid = not not data.raw.fluid[new] if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) end @@ -1254,7 +1254,7 @@ function util.set_product_probability(recipe_name, product, probability, options return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) set_product_probability(data.raw.recipe[recipe_name], product, probability) end @@ -1278,7 +1278,7 @@ function util.set_product_amount(recipe_name, product, amount, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) set_product_amount(data.raw.recipe[recipe_name], product, amount) end @@ -1309,7 +1309,7 @@ function util.multiply_recipe(recipe_name, multiple, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) multiply_recipe(data.raw.recipe[recipe_name], multiple) end @@ -1351,7 +1351,7 @@ function util.multiply_ingredients(recipe_name, multiple, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) multiply_ingredients(data.raw.recipe[recipe_name], multiple) end @@ -1392,7 +1392,7 @@ function util.remove_product(recipe_name, old, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) remove_product(data.raw.recipe[recipe_name], old) end @@ -1475,7 +1475,7 @@ function util.set_recipe_time(recipe_name, time, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) set_recipe_time(data.raw.recipe[recipe_name], time) end @@ -1495,7 +1495,7 @@ function util.multiply_time(recipe_name, factor, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) multiply_time(data.raw.recipe[recipe_name], factor) end @@ -1515,7 +1515,7 @@ function util.add_time(recipe_name, amount, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) add_time(data.raw.recipe[recipe_name], amount) end @@ -1542,7 +1542,7 @@ function util.set_category(recipe_name, category, options) return end if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end prepare_redo_recycling(recipe_name) data.raw.recipe[recipe_name].category = category end @@ -1554,7 +1554,7 @@ function util.set_subgroup(recipe_name, subgroup, options) return end if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end data.raw.recipe[recipe_name].subgroup = subgroup end end @@ -1574,7 +1574,7 @@ function util.add_icon(recipe_name, icon, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then if data.raw.recipe[recipe_name].icon then data.raw.recipe[recipe_name].icons = { { @@ -1609,7 +1609,7 @@ function util.set_icons(recipe_name, icons, options) return end if data.raw.recipe[recipe_name] then - me.add_modified(recipe_name) + if me then me.add_modified(recipe_name) end data.raw.recipe[recipe_name].icons = icons data.raw.recipe[recipe_name].icon = nil data.raw.recipe[recipe_name].icon_size = nil @@ -1622,7 +1622,7 @@ function util.set_tech_icons(technology, icons, options) return end if data.raw.technology[technology] then - me.add_modified(technology) + if me then me.add_modified(technology) end data.raw.technology[technology].icons = icons data.raw.technology[technology].icon = nil data.raw.technology[technology].icon_size = nil From eb5719da47272198a30fd0c00e815a6cf7942ea5 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Mon, 16 Mar 2026 21:23:08 +0100 Subject: [PATCH 8/8] 1.1.1 --- bzlib/changelog.txt | 5 +++++ bzlib/info.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bzlib/changelog.txt b/bzlib/changelog.txt index 7251655..a97be30 100644 --- a/bzlib/changelog.txt +++ b/bzlib/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.1 +Date: 16.03.2026 + Bug fixes: + - Make `me` optional (more fixes) +--------------------------------------------------------------------------------------------------- Version: 1.1.0 Date: 13.03.2026 Changes: diff --git a/bzlib/info.json b/bzlib/info.json index 9f28f85..a9d3a92 100644 --- a/bzlib/info.json +++ b/bzlib/info.json @@ -1,6 +1,6 @@ { "name": "bzlib", - "version": "1.1.0", + "version": "1.1.1", "factorio_version": "2.0", "title": "BZ Lib", "description": "Library code for BZ mods",