1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-22 21:20:15 -05:00

Players respawn near where they died if no other valid players

Buried: remove unnecessary respawn near team override
This commit is contained in:
Jbleezy
2023-03-23 19:04:04 -07:00
parent 00bcc450ad
commit 065f34f8f0
2 changed files with 48 additions and 112 deletions

View File

@ -593,6 +593,53 @@ check_for_valid_spawn_near_team( revivee, return_struct )
}
}
for ( j = 0; j < spawn_points.size; j++ )
{
if ( isdefined( spawn_points[ j ].script_int ) )
{
ideal_distance = spawn_points[ j ].script_int;
}
else
{
ideal_distance = 1000;
}
if ( spawn_points[ j ].locked == 0 )
{
plyr_dist = distancesquared( self.origin, spawn_points[ j ].origin );
if ( plyr_dist < ideal_distance * ideal_distance )
{
if ( plyr_dist < closest_distance )
{
closest_distance = plyr_dist;
closest_group = j;
}
}
else
{
if ( plyr_dist < backup_distance )
{
backup_group = j;
backup_distance = plyr_dist;
}
}
}
}
if ( !isdefined( closest_group ) )
{
closest_group = backup_group;
}
if ( isdefined( closest_group ) )
{
spawn_location = get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
if ( isdefined( spawn_location ) )
{
return spawn_location;
}
}
return undefined;
}

View File

@ -42,7 +42,7 @@ init()
if(is_gametype_active("zgrief"))
{
level.check_for_valid_spawn_near_team_callback = ::zgrief_respawn_override;
level.check_for_valid_spawn_near_team_callback = undefined;
}
turn_power_on();
@ -81,117 +81,6 @@ buried_special_weapon_magicbox_check(weapon)
return 1;
}
zgrief_respawn_override( revivee, return_struct )
{
players = array_randomize(get_players());
spawn_points = maps\mp\gametypes_zm\_zm_gametype::get_player_spawns_for_gametype();
grief_initial = getstructarray( "street_standard_player_spawns", "targetname" );
foreach ( struct in grief_initial )
{
if ( isDefined( struct.script_int ) && struct.script_int == 2000 )
{
spawn_points[ spawn_points.size ] = struct;
initial_point = struct;
initial_point.locked = 0;
}
}
if ( spawn_points.size == 0 )
{
return undefined;
}
closest_group = undefined;
closest_distance = 100000000;
backup_group = undefined;
backup_distance = 100000000;
i = 0;
while ( i < players.size )
{
if ( is_player_valid( players[ i ], undefined, 1 ) && players[ i ] != self )
{
j = 0;
while ( j < spawn_points.size )
{
if ( isDefined( spawn_points[ j ].script_int ) )
{
ideal_distance = spawn_points[ j ].script_int;
}
else
{
ideal_distance = 1000;
}
if ( spawn_points[ j ].locked == 0 )
{
plyr_dist = distancesquared( players[ i ].origin, spawn_points[ j ].origin );
if ( plyr_dist < ( ideal_distance * ideal_distance ) )
{
if ( plyr_dist < closest_distance )
{
closest_distance = plyr_dist;
closest_group = j;
}
j++;
continue;
}
else
{
if ( plyr_dist < backup_distance )
{
backup_group = j;
backup_distance = plyr_dist;
}
}
}
j++;
}
}
if ( !isDefined( closest_group ) )
{
closest_group = backup_group;
}
if ( isDefined( closest_group ) )
{
spawn_location = maps\mp\zombies\_zm::get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
if ( isDefined( spawn_location ) && !positionwouldtelefrag( spawn_location.origin ) )
{
if ( isDefined( spawn_location.plyr ) && spawn_location.plyr != revivee getentitynumber() )
{
i++;
continue;
}
else
{
return spawn_location;
}
}
}
i++;
}
if ( isDefined( initial_point ) )
{
k = 0;
while ( k < spawn_points.size )
{
if ( spawn_points[ k ] == initial_point )
{
closest_group = k;
spawn_location = maps\mp\zombies\_zm::get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
return spawn_location;
}
k++;
}
}
return undefined;
}
turn_power_on()
{
if(!(is_classic() && level.scr_zm_map_start_location == "processing"))