Skip to content

Commit da288ea

Browse files
authored
Merge pull request #968 from Erkigmo/master
Fix crash with Pyanodons
2 parents bce5499 + b4298d3 commit da288ea

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

angelsrefining/changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
---------------------------------------------------------------------------------------------------
2+
Version: 0.12.7
3+
Date: ???
4+
Changes:
5+
- Changed library function to handle bad input data (968)
6+
---------------------------------------------------------------------------------------------------
27
Version: 0.12.6
38
Date: 04.01.2024
49
Bugfixes:

angelsrefining/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angelsrefining",
3-
"version": "0.12.6",
3+
"version": "0.12.7",
44
"factorio_version": "1.1",
55
"title": "Angel's Refining",
66
"author": "Arch666Angel",

angelsrefining/prototypes/override-functions.lua

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -969,24 +969,26 @@ local function adjust_technology(tech, k) -- check a tech for basic adjustments
969969
end
970970
for i = #tech.unit.ingredients, 1, -1 do
971971
local pack = tech.unit.ingredients[i]
972-
local nk = pack.name and "name" or 1
973-
local ak = pack.name and "amount" or 2
974-
if to_remove[pack[nk]] then
975-
table.remove(tech.unit.ingredients, i)
976-
else
977-
if substitution_table.science_packs[pack[nk]] then
978-
pack[ak] = substitution_table.science_packs[pack[nk]].amount
979-
pack[nk] = substitution_table.science_packs[pack[nk]].add
980-
end
981-
if modifications and modifications[pack[nk]] then
982-
if modifications[pack[nk]] > 0 then
983-
dup_table[pack[nk]] = true
984-
pack[ak] = modifications[pack[nk]]
972+
if pack then
973+
local nk = pack.name and "name" or 1
974+
local ak = pack.name and "amount" or 2
975+
if to_remove[pack[nk]] then
976+
table.remove(tech.unit.ingredients, i)
977+
else
978+
if substitution_table.science_packs[pack[nk]] then
979+
pack[ak] = substitution_table.science_packs[pack[nk]].amount
980+
pack[nk] = substitution_table.science_packs[pack[nk]].add
981+
end
982+
if modifications and modifications[pack[nk]] then
983+
if modifications[pack[nk]] > 0 then
984+
dup_table[pack[nk]] = true
985+
pack[ak] = modifications[pack[nk]]
986+
else
987+
table.remove(tech.unit.ingredients, i)
988+
end
985989
else
986-
table.remove(tech.unit.ingredients, i)
990+
dup_table[pack[nk]] = true
987991
end
988-
else
989-
dup_table[pack[nk]] = true
990992
end
991993
end
992994
end

0 commit comments

Comments
 (0)