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", diff --git a/angelsrefining/prototypes/override-functions.lua b/angelsrefining/prototypes/override-functions.lua index 7fdec33e3..7241a7bb8 100644 --- a/angelsrefining/prototypes/override-functions.lua +++ b/angelsrefining/prototypes/override-functions.lua @@ -969,24 +969,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] - 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