From 11285fb0aa2a437659436f3654650fc14cea735e Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Fri, 26 Nov 2021 09:16:42 -0800 Subject: [PATCH] Fixed root cause of science-not-invited 9.223e+18 problem. --- worlds/factorio/data/mod_template/data-final-fixes.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worlds/factorio/data/mod_template/data-final-fixes.lua b/worlds/factorio/data/mod_template/data-final-fixes.lua index c07b6970ee..837653805f 100644 --- a/worlds/factorio/data/mod_template/data-final-fixes.lua +++ b/worlds/factorio/data/mod_template/data-final-fixes.lua @@ -43,9 +43,12 @@ function prep_copy(new_copy, old_tech) weights[key] = value end SNI.setWeights(weights) + -- Just in case an ingredient is being added to an existing tech. Found the root cause of the 9.223e+18 problem. + -- Turns out science-not-invited was ultimately dividing by zero, due to it being unaware of there being added ingredients. + old_tech.unit.ingredients = add_ingredients(old_tech.unit.ingredients, ingredient_filter) SNI.sendInvite(old_tech) -- SCIENCE-not-invited could potentially make tech cost 9.223e+18. - old_tech.unit.count = math.min(10000, old_tech.unit.count) + old_tech.unit.count = math.min(100000, old_tech.unit.count) end new_copy.unit = table.deepcopy(old_tech.unit) new_copy.unit.ingredients = filter_ingredients(new_copy.unit.ingredients, ingredient_filter)