Skip to content

Commit

Permalink
Fix migration error when loading existing saves with TBLE being newly…
Browse files Browse the repository at this point in the history
… installed

See #58
  • Loading branch information
veger committed Nov 13, 2023
1 parent 551ef67 commit 927f6f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 7 additions & 2 deletions migrations/tlbe.1.4.5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 927f6f7

Please sign in to comment.