From 08fb6c4b3660a337e0ee348e5a55251b264b1256 Mon Sep 17 00:00:00 2001 From: Erkigmo <122825731+Erkigmo@users.noreply.github.com> Date: Tue, 9 Jan 2024 21:59:00 -0500 Subject: [PATCH 1/4] Fix crash with Pyanodons --- angelsrefining/prototypes/override-functions.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/angelsrefining/prototypes/override-functions.lua b/angelsrefining/prototypes/override-functions.lua index 7fdec33e3..9ed3226c1 100644 --- a/angelsrefining/prototypes/override-functions.lua +++ b/angelsrefining/prototypes/override-functions.lua @@ -969,6 +969,7 @@ local function adjust_technology(tech, k) -- check a tech for basic adjustments end for i = #tech.unit.ingredients, 1, -1 do local pack = tech.unit.ingredients[i] + if not pack then return end local nk = pack.name and "name" or 1 local ak = pack.name and "amount" or 2 if to_remove[pack[nk]] then From 4413742c66f8ebc5aaf0e07157574b9cd5e98110 Mon Sep 17 00:00:00 2001 From: Erkigmo <122825731+Erkigmo@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:04:53 -0500 Subject: [PATCH 2/4] Better crash fix --- .../prototypes/override-functions.lua | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/angelsrefining/prototypes/override-functions.lua b/angelsrefining/prototypes/override-functions.lua index 9ed3226c1..e1f1f4e52 100644 --- a/angelsrefining/prototypes/override-functions.lua +++ b/angelsrefining/prototypes/override-functions.lua @@ -1,6 +1,8 @@ local RB = require("prototypes.recipe-builder") require("prototypes.angels-functions") +local Test = {} + local ov_functions = {} -- OVERRIDE DATA TABLES local substitution_table, disable_table, modify_table, override_table, patch_table @@ -969,25 +971,26 @@ local function adjust_technology(tech, k) -- check a tech for basic adjustments end for i = #tech.unit.ingredients, 1, -1 do local pack = tech.unit.ingredients[i] - if not pack then return end - local nk = pack.name and "name" or 1 - local ak = pack.name and "amount" or 2 - if to_remove[pack[nk]] then - table.remove(tech.unit.ingredients, i) - else - if substitution_table.science_packs[pack[nk]] then - pack[ak] = substitution_table.science_packs[pack[nk]].amount - pack[nk] = substitution_table.science_packs[pack[nk]].add - end - if modifications and modifications[pack[nk]] then - if modifications[pack[nk]] > 0 then - dup_table[pack[nk]] = true - pack[ak] = modifications[pack[nk]] + if pack then + local nk = pack.name and "name" or 1 + local ak = pack.name and "amount" or 2 + if to_remove[pack[nk]] then + table.remove(tech.unit.ingredients, i) + else + if substitution_table.science_packs[pack[nk]] then + pack[ak] = substitution_table.science_packs[pack[nk]].amount + pack[nk] = substitution_table.science_packs[pack[nk]].add + end + if modifications and modifications[pack[nk]] then + if modifications[pack[nk]] > 0 then + dup_table[pack[nk]] = true + pack[ak] = modifications[pack[nk]] + else + table.remove(tech.unit.ingredients, i) + end else - table.remove(tech.unit.ingredients, i) + dup_table[pack[nk]] = true end - else - dup_table[pack[nk]] = true end end end From d4b2ef8187318fe4fd22957c99b86c9e59006ada Mon Sep 17 00:00:00 2001 From: Erkigmo <122825731+Erkigmo@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:08:19 -0500 Subject: [PATCH 3/4] Remove table I used for testing --- angelsrefining/prototypes/override-functions.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/angelsrefining/prototypes/override-functions.lua b/angelsrefining/prototypes/override-functions.lua index e1f1f4e52..7241a7bb8 100644 --- a/angelsrefining/prototypes/override-functions.lua +++ b/angelsrefining/prototypes/override-functions.lua @@ -1,8 +1,6 @@ local RB = require("prototypes.recipe-builder") require("prototypes.angels-functions") -local Test = {} - local ov_functions = {} -- OVERRIDE DATA TABLES local substitution_table, disable_table, modify_table, override_table, patch_table From b4298d306f9983e05da14bc2b24f1a9fe2e6c72b Mon Sep 17 00:00:00 2001 From: KiwiHawk <59639+KiwiHawk@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:15:02 +1300 Subject: [PATCH 4/4] Updating changelog #968 --- angelsrefining/changelog.txt | 5 +++++ angelsrefining/info.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/angelsrefining/changelog.txt b/angelsrefining/changelog.txt index 5830d184c..0c32ab687 100644 --- a/angelsrefining/changelog.txt +++ b/angelsrefining/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.12.7 +Date: ??? + Changes: + - Changed library function to handle bad input data (968) +--------------------------------------------------------------------------------------------------- Version: 0.12.6 Date: 04.01.2024 Bugfixes: diff --git a/angelsrefining/info.json b/angelsrefining/info.json index cdd492475..b11e9e510 100644 --- a/angelsrefining/info.json +++ b/angelsrefining/info.json @@ -1,6 +1,6 @@ { "name": "angelsrefining", - "version": "0.12.6", + "version": "0.12.7", "factorio_version": "1.1", "title": "Angel's Refining", "author": "Arch666Angel",