diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index f0e640bd..e8931efd 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -30,6 +30,7 @@ main() replaceFunc(maps/mp/zombies/_zm::ai_calculate_health, scripts/zm/replaced/_zm::ai_calculate_health); 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); replaceFunc(maps/mp/zombies/_zm::actor_damage_override, scripts/zm/replaced/_zm::actor_damage_override); replaceFunc(maps/mp/zombies/_zm::player_spawn_protection, scripts/zm/replaced/_zm::player_spawn_protection); replaceFunc(maps/mp/zombies/_zm::wait_and_revive, scripts/zm/replaced/_zm::wait_and_revive); diff --git a/scripts/zm/replaced/_zm.gsc b/scripts/zm/replaced/_zm.gsc index 44d13ace..9cbe3a82 100644 --- a/scripts/zm/replaced/_zm.gsc +++ b/scripts/zm/replaced/_zm.gsc @@ -538,6 +538,36 @@ check_for_valid_spawn_near_team( revivee, return_struct ) return undefined; } +get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct ) +{ + spawn_array = getstructarray( spawn_points[ closest_group ].target, "targetname" ); + spawn_array = array_randomize( spawn_array ); + k = 0; + + while ( k < spawn_array.size ) + { + if ( positionwouldtelefrag( spawn_array[ k ].origin ) ) + { + k++; + continue; + } + + if ( is_true( return_struct ) ) + { + return spawn_array[ k ]; + } + + return spawn_array[ k ].origin; + } + + if ( is_true( return_struct ) ) + { + return spawn_array[ 0 ]; + } + + return spawn_array[ 0 ].origin; +} + player_damage_override( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime ) { if ( isDefined( level._game_module_player_damage_callback ) )