1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-10 15:17:57 -05:00

Containment: ignore players correctly on respawn and revive

Optimize ignore player on revive code
This commit is contained in:
Jbleezy
2022-01-30 11:31:48 -08:00
parent 003cd43455
commit c5154ed8a4
3 changed files with 49 additions and 10 deletions

View File

@ -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::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);
replaceFunc(maps/mp/zombies/_zm::player_revive_monitor, scripts/zm/replaced/_zm::player_revive_monitor);
replaceFunc(maps/mp/zombies/_zm::end_game, scripts/zm/replaced/_zm::end_game);
@ -1899,20 +1900,32 @@ veryhurt_blood_fx()
ignoreme_after_revived()
{
self endon( "disconnect" );
self endon("disconnect");
while(1)
{
self waittill( "player_revived", reviver );
self waittill("player_revived", reviver);
self.ignoreme = 1;
wait 1;
self.ignoreme = 0;
self thread player_revive_protection();
}
}
player_revive_protection()
{
self endon("disconnect");
self.revive_protection = 1;
for(i = 0; i < 20; i++)
{
self.ignoreme = 1;
wait 0.05;
}
self.ignoreme = 0;
self.revive_protection = 0;
}
fall_velocity_check()
{
self endon("disconnect");

View File

@ -902,6 +902,22 @@ player_laststand( einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, s
}
}
player_spawn_protection()
{
self endon( "disconnect" );
self.spawn_protection = 1;
for ( x = 0; x < 60; x++ )
{
self.ignoreme = 1;
wait 0.05;
}
self.ignoreme = 0;
self.spawn_protection = 0;
}
wait_and_revive()
{
flag_set( "wait_and_revive" );

View File

@ -2199,7 +2199,11 @@ containment_think()
{
if(is_player_valid(player))
{
player.ignoreme = 0;
if(!is_true(player.spawn_protection) && !is_true(player.revive_protection))
{
player.ignoreme = 0;
}
in_containment_zone[player.team]++;
if(isads(player))
@ -2307,7 +2311,10 @@ containment_think()
{
if(is_player_valid(player))
{
player.ignoreme = 0;
if(!is_true(player.spawn_protection) && !is_true(player.revive_protection))
{
player.ignoreme = 0;
}
}
player.containment_waypoint.color = (1, 1, 1);
}
@ -2327,7 +2334,10 @@ containment_think()
{
if(is_player_valid(player))
{
player.ignoreme = 0;
if(!is_true(player.spawn_protection) && !is_true(player.revive_protection))
{
player.ignoreme = 0;
}
}
if(isDefined(player.containment_waypoint))