diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index 765fad0f..58311bf9 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -28,6 +28,7 @@ main() replaceFunc(common_scripts\utility::struct_class_init, scripts\zm\replaced\utility::struct_class_init); replaceFunc(maps\mp\zombies\_zm::check_quickrevive_for_hotjoin, scripts\zm\replaced\_zm::check_quickrevive_for_hotjoin); replaceFunc(maps\mp\zombies\_zm::ai_calculate_health, scripts\zm\replaced\_zm::ai_calculate_health); + replaceFunc(maps\mp\zombies\_zm::onallplayersready, scripts\zm\replaced\_zm::onallplayersready); replaceFunc(maps\mp\zombies\_zm::last_stand_pistol_rank_init, scripts\zm\replaced\_zm::last_stand_pistol_rank_init); replaceFunc(maps\mp\zombies\_zm::check_for_valid_spawn_near_team, scripts\zm\replaced\_zm::check_for_valid_spawn_near_team); replaceFunc(maps\mp\zombies\_zm::get_valid_spawn_location, scripts\zm\replaced\_zm::get_valid_spawn_location); diff --git a/scripts/zm/replaced/_zm.gsc b/scripts/zm/replaced/_zm.gsc index 50ec287f..67aff6e0 100644 --- a/scripts/zm/replaced/_zm.gsc +++ b/scripts/zm/replaced/_zm.gsc @@ -43,6 +43,64 @@ ai_calculate_health( round_number ) } } +onallplayersready() +{ + timeout = gettime() + 5000; + + while ( getnumexpectedplayers() == 0 && gettime() < timeout ) + wait 0.1; + + player_count_actual = 0; + + while ( getnumconnectedplayers() < getnumexpectedplayers() || player_count_actual != getnumexpectedplayers() ) + { + players = get_players(); + player_count_actual = 0; + + for ( i = 0; i < players.size; i++ ) + { + players[i] freezecontrols( 1 ); + + if ( players[i].sessionstate == "playing" ) + player_count_actual++; + } + + wait 0.1; + } + + setinitialplayersconnected(); + + if ( 1 == getnumconnectedplayers() && getdvarint( "scr_zm_enable_bots" ) == 1 ) + { + level thread add_bots(); + flag_set( "initial_players_connected" ); + } + else + { + players = get_players(); + + if ( players.size == 1 && level.scr_zm_ui_gametype != "zgrief" ) + { + flag_set( "solo_game" ); + level.solo_lives_given = 0; + + foreach ( player in players ) + player.lives = 0; + + level maps\mp\zombies\_zm::set_default_laststand_pistol( 1 ); + } + + flag_set( "initial_players_connected" ); + + while ( !aretexturesloaded() ) + wait 0.05; + + thread start_zombie_logic_in_x_sec( 3.0 ); + } + + fade_out_intro_screen_zm( 5.0, 1.5, 1 ); +} + last_stand_pistol_rank_init() { level.pistol_values = [];