mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-26 22:56:43 +02:00
Mtn: fix when there are no players connected and the server starts
This commit is contained in:
parent
6f904a0d71
commit
0bba98a3c5
@ -18,6 +18,8 @@ local Beams = require 'modules.render_beam'
|
||||
local BottomFrame = require 'utils.gui.bottom_frame'
|
||||
local Modifiers = require 'utils.player_modifiers'
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
local ICMinimap = require 'maps.mountain_fortress_v3.ic.minimap'
|
||||
local Score = require 'utils.gui.score'
|
||||
|
||||
local scenario_name = Public.scenario_name
|
||||
local zone_settings = Public.zone_settings
|
||||
@ -1480,7 +1482,7 @@ function Public.on_player_joined_game(event)
|
||||
local players = Public.get('players')
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
|
||||
Difficulty.clear_top_frame(player)
|
||||
Modifiers.update_player_modifiers(player)
|
||||
local active_surface_index = Public.get('active_surface_index')
|
||||
local surface = game.surfaces[active_surface_index or 'nauvis']
|
||||
@ -1490,6 +1492,12 @@ function Public.on_player_joined_game(event)
|
||||
local init_surface = game.get_surface('Init')
|
||||
if init_surface and init_surface.valid then
|
||||
surface = init_surface
|
||||
Score.init_player_table(player, true)
|
||||
Modifiers.reset_player_modifiers(player)
|
||||
WD.destroy_wave_gui(player)
|
||||
ICMinimap.kill_minimap(player)
|
||||
Event.raise(Public.events.reset_map, { player_index = player.index })
|
||||
Public.add_player_to_permission_group(player, 'init_island', true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,7 +127,6 @@ local function preinit_task()
|
||||
local players = game.connected_players
|
||||
for i = 1, #players do
|
||||
local player = players[i]
|
||||
Difficulty.clear_top_frame(player)
|
||||
Score.init_player_table(player, true)
|
||||
Misc.insert_all_items(player)
|
||||
Modifiers.reset_player_modifiers(player)
|
||||
@ -367,6 +366,10 @@ local scenario_manager = function ()
|
||||
local current_task = Public.get('current_task')
|
||||
if not current_task then return end
|
||||
|
||||
if #game.connected_players == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if current_task.delay then
|
||||
if game.tick < current_task.delay then
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user