[Genhis] [1.1.38] game.finished only lasts for a single tick
Posted: Mon Aug 30, 2021 1:17 am
I could be misunderstanding how this is supposed to work, but so far as I can tell, game.finished is supposed to tell you if the game was finished in the past. However, reading it after the tick where the game was finished will always return false.
Reproduction:
1. Stick the following in a mod's control.lua:
2. Start a new game
3. Click "continue" on the game finished screen
4. Wait a second
5. Observe that it returns true on tick 10, but false on tick 20.
Reproduction:
1. Stick the following in a mod's control.lua:
Code: Select all
script.on_event(defines.events.on_tick, function(e)
if game.tick == 10 then
game.set_game_state{
game_finished = true,
player_won = true,
can_continue = true,
victorious_force = game.forces.player,
}
game.print(game.tick.." "..tostring(game.finished))
elseif game.tick == 20 then
game.print(game.tick.." "..tostring(game.finished))
end
end)
3. Click "continue" on the game finished screen
4. Wait a second
5. Observe that it returns true on tick 10, but false on tick 20.