From 37bbb91201e8570dce7e9f8e0a075aee1cbda4c3 Mon Sep 17 00:00:00 2001 From: Zihao Zhang Date: Sat, 13 Jan 2024 07:32:54 -0800 Subject: [PATCH] fix nil crash when loading old save (#223) * fix nil crash * fix crash * Update biofluid.lua --- migrations/biofluid.lua | 5 ++++- scripts/turd/turd-migration.lua | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/migrations/biofluid.lua b/migrations/biofluid.lua index 34bd3bde..378f4b82 100644 --- a/migrations/biofluid.lua +++ b/migrations/biofluid.lua @@ -6,6 +6,9 @@ require 'scripts.biofluid.biofluid-gui' local broken_graphics = {} local invalid_coords = {} +global.biofluid_undergrounds = global.biofluid_undergrounds or {} +global.network_positions = global.network_positions or {} + for _, surface in pairs(game.surfaces) do local network_positions = global.network_positions[surface.index] if network_positions then @@ -42,4 +45,4 @@ end for _, entity in pairs(broken_graphics) do Biofluid.update_graphics(entity) -end \ No newline at end of file +end diff --git a/scripts/turd/turd-migration.lua b/scripts/turd/turd-migration.lua index 9f57bf83..0c70f365 100644 --- a/scripts/turd/turd-migration.lua +++ b/scripts/turd/turd-migration.lua @@ -3,6 +3,7 @@ return function(master_tech_name, sub_tech_name) local reset_time_in_ticks = reset_time_in_hours * 3600 * 60 global.turd_migrations = global.turd_migrations or {} + global.turd_bonuses = global.turd_bonuses or {} for _, force in pairs(game.forces) do global.turd_migrations[force.index] = global.turd_migrations[force.index] or {}