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