Merge pull request #79 from aur9ra/feat-save-replay-once-per-game-only

Ensure replays are only saved once per game
This commit is contained in:
Ishaan Bhardwaj 2023-08-25 19:28:34 -04:00 committed by GitHub
commit 7c3cf0b1bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,6 +179,9 @@ function GameMode:update(inputs, ruleset)
if self.game_over or self.completed then if self.game_over or self.completed then
if self.save_replay and self.game_over_frames == 0 then if self.save_replay and self.game_over_frames == 0 then
self:saveReplay() self:saveReplay()
-- ensure replays are only saved once per game, incase self.game_over_frames == 0 for longer than one frame
self.save_replay = false
end end
self.game_over_frames = self.game_over_frames + 1 self.game_over_frames = self.game_over_frames + 1
return return