Skip to content

Commit 3b18ce7

Browse files
zonkmachinesturnclaw
authored andcommitted
Save and recover Comms log
1 parent 082128d commit 3b18ce7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

data/libs/Game.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Game.AddCommsLogLine = function(text, sender, priority)
99
table.insert(Game.comms_log_lines, { text=text, time=Game.time, sender=sender, priority = priority or 'normal'})
1010
if type(priority) == "number" and priority > 0 then
1111
Game.SetTimeAcceleration("1x")
12-
end
12+
end
1313
end
1414

1515
Game.GetCommsLines = function()
@@ -28,20 +28,22 @@ function Game.GetStartTime()
2828
end
2929

3030
Event.Register('onGameStart', function()
31-
Game.comms_log_lines = {}
3231
gameStartTime = Game.time
3332
end)
3433

3534
Event.Register('onGameEnd', function()
3635
gameStartTime = 0
36+
Game.comms_log_lines = {}
3737
end)
3838

3939
local function _serialize()
40-
return { startTime = gameStartTime }
40+
return { startTime = gameStartTime,
41+
comms_log_lines = Game.comms_log_lines }
4142
end
4243

4344
local function _deserialize(data)
4445
gameStartTime = data.startTime or 0
46+
Game.comms_log_lines = data.comms_log_lines or {}
4547
end
4648

4749
require 'Serializer':Register('Game', _serialize, _deserialize)

0 commit comments

Comments
 (0)