1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-11 14:49:24 +02:00

Wave defense - fix pause waves

This commit is contained in:
Gerkiz 2023-05-05 11:35:06 +02:00
parent 7bb34efd4b
commit ed7def7de7
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,3 @@
[wave_defense]
pause_waves=[color=blue][Wave Defense][/color] New waves will not spawn for 5 minutes!
pause_waves=[color=blue][Wave Defense][/color] New waves will not spawn for __1__ minutes!
start_waves=[color=blue][Wave Defense][/color] Waves will spawn normally again.

View File

@ -11,6 +11,7 @@ local main_frame_name = Gui.uid_name()
local save_button_name = Gui.uid_name()
local discard_button_name = Gui.uid_name()
local random = math.random
local floor = math.floor
local random_greetings = {
'Dear defender',
@ -113,11 +114,14 @@ end
local function pause_waves_state(state)
if state then
local message = ({'wave_defense.pause_waves'})
Alert.alert_all_players(30, message, nil, 'achievement/tech-maniac', 0.75)
local pause_wave_in_ticks = Public.get('pause_wave_in_ticks')
Public.set('paused', true)
Public.set('last_pause', game.tick)
Public.set('paused_waves_for', game.tick + 18000)
Public.set('paused_waves_for', game.tick + pause_wave_in_ticks)
local pause_for = floor(pause_wave_in_ticks / 60 / 60)
local message = ({'wave_defense.pause_waves', pause_for})
Alert.alert_all_players(30, message, nil, 'achievement/tech-maniac', 0.75)
local next_wave = Public.get('next_wave')
Public.set('next_wave', next_wave + 18000)