mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-24 03:47:58 +02:00
Merge pull request #73 from ComfyFactory/update_pause_game
update module
This commit is contained in:
commit
7f02560dc4
@ -1,18 +1,22 @@
|
||||
local Event = require 'utils.event'
|
||||
|
||||
local function halt_game()
|
||||
local function set_pause()
|
||||
game.tick_paused = true
|
||||
end
|
||||
|
||||
local function resume_game()
|
||||
game.tick_paused = false
|
||||
local player_count = #game.connected_players
|
||||
|
||||
if player_count <= 1 then
|
||||
game.tick_paused = false
|
||||
end
|
||||
end
|
||||
|
||||
local function player_left()
|
||||
local player_count = #game.connected_players
|
||||
|
||||
if player_count == 0 then
|
||||
halt_game()
|
||||
set_pause()
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user