From 0bba98a3c55df736c6c5ff8579923b78de385d8c Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Sun, 27 Oct 2024 00:11:44 +0200 Subject: [PATCH] Mtn: fix when there are no players connected and the server starts --- maps/mountain_fortress_v3/functions.lua | 10 +++++++++- maps/mountain_fortress_v3/main.lua | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index 7997e983..06164d4d 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -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 diff --git a/maps/mountain_fortress_v3/main.lua b/maps/mountain_fortress_v3/main.lua index 9c63b5a3..205b457d 100644 --- a/maps/mountain_fortress_v3/main.lua +++ b/maps/mountain_fortress_v3/main.lua @@ -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