mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-27 21:38:54 +02:00
Mtn v3 - minor fixes
This commit is contained in:
parent
3db00ee5dc
commit
fd2b5efa95
@ -348,23 +348,23 @@ commands.add_command(
|
||||
return
|
||||
end
|
||||
if not Collapse.has_collapse_started() then
|
||||
Collapse.start_now(true)
|
||||
Collapse.start_now(true, false)
|
||||
Discord.send_notification_raw(scenario_name, player.name .. ' has enabled collapse.')
|
||||
game.print(mapkeeper .. ' ' .. player.name .. ', has enabled collapse!', {r = 0.98, g = 0.66, b = 0.22})
|
||||
log(player.name .. ', has enabled collapse!')
|
||||
else
|
||||
Collapse.start_now(false)
|
||||
Collapse.start_now(false, true)
|
||||
Discord.send_notification_raw(scenario_name, player.name .. ' has disabled collapse.')
|
||||
game.print(mapkeeper .. ' ' .. player.name .. ', has disabled collapse!', {r = 0.98, g = 0.66, b = 0.22})
|
||||
log(player.name .. ', has disabled collapse!')
|
||||
end
|
||||
else
|
||||
if not Collapse.has_collapse_started() then
|
||||
Collapse.start_now(true)
|
||||
Collapse.start_now(true, false)
|
||||
Discord.send_notification_raw(scenario_name, 'Server has enabled collapse.')
|
||||
log('Collapse has started.')
|
||||
else
|
||||
Collapse.start_now(false)
|
||||
Collapse.start_now(false, true)
|
||||
Discord.send_notification_raw(scenario_name, 'Server has disabled collapse.')
|
||||
log('Collapse has stopped.')
|
||||
end
|
||||
|
@ -151,9 +151,12 @@ end
|
||||
local pause_waves_custom_callback_token =
|
||||
Task.register(
|
||||
function(status)
|
||||
Collapse.start_now(status)
|
||||
local status_str = status and 'has stopped!' or 'is active once again!'
|
||||
Alert.alert_all_players(30, 'Collapse ' .. status_str, nil, 'achievement/tech-maniac', 0.6)
|
||||
local wave_number = WD.get_wave()
|
||||
if wave_number >= 200 then
|
||||
Collapse.start_now(status)
|
||||
local status_str = status and 'has stopped!' or 'is active once again!'
|
||||
Alert.alert_all_players(30, 'Collapse ' .. status_str, nil, 'achievement/tech-maniac', 0.6)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
@ -441,9 +441,15 @@ function Public.get_speed()
|
||||
return this.speed
|
||||
end
|
||||
|
||||
function Public.start_now(state)
|
||||
--- Set the collapse to start or not, accepts a second argument to disable the collapse completely.
|
||||
---@param state boolean
|
||||
---@param disabled boolean
|
||||
---@return boolean
|
||||
function Public.start_now(state, disabled)
|
||||
this.start_now = state or false
|
||||
|
||||
this.disabled = disabled or false
|
||||
|
||||
return this.start_now
|
||||
end
|
||||
|
||||
@ -454,6 +460,10 @@ function Public.reverse_start_now(state)
|
||||
end
|
||||
|
||||
function Public.has_collapse_started()
|
||||
if this.disabled then
|
||||
return true
|
||||
end
|
||||
|
||||
return this.start_now
|
||||
end
|
||||
|
||||
@ -499,6 +509,7 @@ local function on_init()
|
||||
this.tiles = nil
|
||||
this.reverse_tiles = nil
|
||||
this.speed = 1
|
||||
this.disabled = false
|
||||
this.reverse_start_now = false
|
||||
this.amount = 8
|
||||
this.start_now = false
|
||||
@ -510,6 +521,10 @@ local function on_tick()
|
||||
return
|
||||
end
|
||||
|
||||
if this.disabled then
|
||||
return
|
||||
end
|
||||
|
||||
progress()
|
||||
progress_reverse()
|
||||
end
|
||||
|
@ -117,9 +117,10 @@ function Public.update_gui(player)
|
||||
gui.wave_number.caption = wave_number
|
||||
if wave_number == 0 then
|
||||
gui.label.caption = {'wave_defense.gui_1'}
|
||||
gui.label.tooltip = 'Next pause will occur in: ' .. floor((Public.get('next_pause_interval') - game.tick) / 60 / 60) + 1 .. ' minute(s)'
|
||||
gui.wave_number.caption = floor((next_wave - game.tick) / 60) + 1 .. 's'
|
||||
end
|
||||
gui.label.tooltip = 'Next pause will occur in: ' .. floor((Public.get('next_pause_interval') - game.tick) / 60 / 60) + 1 .. ' minute(s)'
|
||||
gui.wave_number.tooltip = 'Next pause will occur in: ' .. floor((Public.get('next_pause_interval') - game.tick) / 60 / 60) + 1 .. ' minute(s)'
|
||||
local interval = next_wave - last_wave
|
||||
local value = 1 - (next_wave - game.tick) / interval
|
||||
if value < 0 then
|
||||
|
Loading…
x
Reference in New Issue
Block a user