From 927f6f7049a348a786d268de8684eb853e58a64f Mon Sep 17 00:00:00 2001 From: Maarten Bezemer Date: Mon, 13 Nov 2023 12:33:58 +0100 Subject: [PATCH] Fix migration error when loading existing saves with TBLE being newly installed See #58 --- changelog.txt | 6 ++++++ migrations/tlbe.1.4.5.lua | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index aabc747..235af76 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +--------------------------------------------------------------------------------------------------- +Version: 1.5.1 + + Bugfixes: + - Fix migration error when loading existing saves with TBLE being newly installed. + --------------------------------------------------------------------------------------------------- Version: 1.5.0 Date: 01-08-2023 diff --git a/migrations/tlbe.1.4.5.lua b/migrations/tlbe.1.4.5.lua index 920c455..57b1e03 100644 --- a/migrations/tlbe.1.4.5.lua +++ b/migrations/tlbe.1.4.5.lua @@ -30,8 +30,8 @@ for player_index, player in pairs(game.players) do if warned == false and activeTracker ~= nil then ---@diagnostic disable-next-line: undefined-field if activeTracker.lastChange ~= nil then - -- old transition code to determine ticksLeft - ---@diagnostic disable-next-line: undefined-field + -- Check if there is a transition going on + ---@diagnostic disable-next-line: undefined-field old transition code to determine ticksLeft local ticksLeft = activeTracker.lastChange - game.tick if activeTracker.realtimeCamera then ---@diagnostic disable-next-line: undefined-field -- Renamed in v1.5.0 @@ -42,11 +42,16 @@ for player_index, player in pairs(game.players) do end if ticksLeft > 0 then + -- warn player about side effects player.print({ "migration-issue-transitiondata1" }, { r = 1, g = 0.5, b = 0 }) player.print({ "migration-issue-transitiondata2" }, { r = 1, g = 0.5, b = 0 }) warned = true end end + end + + if camera.zoomPeriod ~= nil then + -- Old camera, migrate to new format ---@diagnostic disable-next-line: undefined-field -- Renamed in v1.5.0 camera.transitionPeriod = camera.zoomPeriod