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

Encounter on Docks: Tower Trap no longer stays targeted on a player

This commit is contained in:
Jbleezy
2023-10-02 01:03:55 -07:00
parent 1c722234c1
commit a53b5f9d39
2 changed files with 60 additions and 89 deletions

View File

@ -353,19 +353,18 @@ activate_tower_trap()
foreach ( zombie in zombies )
{
if ( zombie istouching( self.range_trigger ) )
{
zombies_sorted[zombies_sorted.size] = zombie;
}
}
if ( zombies_sorted.size <= 0 )
{
wait_network_frame();
wait 0.05;
continue;
}
else
{
wait_network_frame();
self tower_trap_fires( zombies_sorted );
}
self tower_trap_fires( zombies_sorted );
}
}
@ -378,37 +377,33 @@ tower_trap_fires( a_zombies )
}
if ( a_zombies.size <= 0 )
{
return;
}
self endon( "tower_trap_off" );
e_org = getstruct( self.range_trigger.target, "targetname" );
n_index = randomintrange( 0, a_zombies.size );
while ( 1 )
{
if ( a_zombies.size <= 0 )
{
wait 0.05;
return;
}
n_index = randomintrange( 0, a_zombies.size );
e_target = a_zombies[n_index];
if ( !isalive( e_target ) )
{
arrayremovevalue( a_zombies, e_target, 0 );
if ( a_zombies.size <= 0 )
return;
n_index = randomintrange( 0, a_zombies.size );
continue;
}
if ( isplayer( e_target ) && e_target maps\mp\zombies\_zm_laststand::player_is_in_laststand() )
{
arrayremovevalue( a_zombies, e_target, 0 );
if ( a_zombies.size <= 0 )
return;
n_index = randomintrange( 0, a_zombies.size );
continue;
}
@ -417,17 +412,14 @@ tower_trap_fires( a_zombies )
if ( sighttracepassed( e_org.origin, v_zombietarget, 1, undefined ) )
{
magicbullet( self.weapon_name, e_org.origin, v_zombietarget );
wait( self.trap_reload_time );
return;
}
else
{
arrayremovevalue( a_zombies, e_target, 0 );
if ( a_zombies.size <= 0 )
return;
n_index = randomintrange( 0, a_zombies.size );
continue;
}
}

View File

@ -1706,37 +1706,11 @@ game_module_player_damage_callback( einflictor, eattacker, idamage, idflags, sme
if ( isDefined( level._effect[ "butterflies" ] ) )
{
pos = vpoint;
angle = vectorToAngles(eattacker getCentroid() - self getCentroid());
angle = (0, angle[1], 0);
stun_fx_amount = 3;
if(!isDefined(self.stun_fx))
{
// spawning in model right before playfx causes the fx not to play occasionally
// stun fx lasts longer than stun time, so alternate between different models
self.stun_fx = [];
self.stun_fx_ind = 0;
for(i = 0; i < stun_fx_amount; i++)
{
self.stun_fx[i] = spawn("script_model", pos);
self.stun_fx[i] setModel("tag_origin");
}
}
self.stun_fx[self.stun_fx_ind] unlink();
self.stun_fx[self.stun_fx_ind].origin = pos;
self.stun_fx[self.stun_fx_ind].angles = angle;
self.stun_fx[self.stun_fx_ind] linkTo(self);
playFXOnTag(level._effect["butterflies"], self.stun_fx[self.stun_fx_ind], "tag_origin");
self.stun_fx_ind = (self.stun_fx_ind + 1) % stun_fx_amount;
self do_game_mode_stun_fx(einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime);
}
self thread do_game_mode_shellshock();
self playsound( "zmb_player_hit_ding" );
return 0;
}
@ -1875,42 +1849,7 @@ game_module_player_damage_callback( einflictor, eattacker, idamage, idflags, sme
if ( isDefined( level._effect[ "butterflies" ] ) )
{
pos = vpoint;
angle = vectorToAngles(eattacker getCentroid() - self getCentroid());
if ( (isDefined( sweapon ) && weapontype( sweapon ) == "grenade") || (isDefined( sweapon ) && weapontype( sweapon ) == "projectile") )
{
pos_offset = vectorNormalize(vpoint - self getCentroid()) * 8;
pos_offset = (pos_offset[0], pos_offset[1], 0);
pos = self getCentroid() + pos_offset;
angle = vectorToAngles(vpoint - self getCentroid());
}
angle = (0, angle[1], 0);
stun_fx_amount = 3;
if(!isDefined(self.stun_fx))
{
// spawning in model right before playfx causes the fx not to play occasionally
// stun fx lasts longer than stun time, so alternate between different models
self.stun_fx = [];
self.stun_fx_ind = 0;
for(i = 0; i < stun_fx_amount; i++)
{
self.stun_fx[i] = spawn("script_model", pos);
self.stun_fx[i] setModel("tag_origin");
}
}
self.stun_fx[self.stun_fx_ind] unlink();
self.stun_fx[self.stun_fx_ind].origin = pos;
self.stun_fx[self.stun_fx_ind].angles = angle;
self.stun_fx[self.stun_fx_ind] linkTo(self);
playFXOnTag(level._effect["butterflies"], self.stun_fx[self.stun_fx_ind], "tag_origin");
self.stun_fx_ind = (self.stun_fx_ind + 1) % stun_fx_amount;
self do_game_mode_stun_fx(einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime);
}
self thread do_game_mode_shellshock(is_melee, is_weapon_upgraded(sweapon));
@ -1933,6 +1872,46 @@ game_module_player_damage_callback( einflictor, eattacker, idamage, idflags, sme
}
}
do_game_mode_stun_fx(einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime)
{
pos = vpoint;
angle = vectorToAngles(eattacker getCentroid() - self getCentroid());
if ( (isDefined( sweapon ) && weapontype( sweapon ) == "grenade") || (isDefined( sweapon ) && weapontype( sweapon ) == "projectile") )
{
pos_offset = vectorNormalize(vpoint - self getCentroid()) * 8;
pos_offset = (pos_offset[0], pos_offset[1], 0);
pos = self getCentroid() + pos_offset;
angle = vectorToAngles(vpoint - self getCentroid());
}
angle = (0, angle[1], 0);
stun_fx_amount = 3;
if(!isDefined(self.stun_fx))
{
// spawning in model right before playfx causes the fx not to play occasionally
// stun fx lasts longer than stun time, so alternate between different models
self.stun_fx = [];
self.stun_fx_ind = 0;
for(i = 0; i < stun_fx_amount; i++)
{
self.stun_fx[i] = spawn("script_model", pos);
self.stun_fx[i] setModel("tag_origin");
}
}
self.stun_fx[self.stun_fx_ind] unlink();
self.stun_fx[self.stun_fx_ind].origin = pos;
self.stun_fx[self.stun_fx_ind].angles = angle;
self.stun_fx[self.stun_fx_ind] linkTo(self);
playFXOnTag(level._effect["butterflies"], self.stun_fx[self.stun_fx_ind], "tag_origin");
self.stun_fx_ind = (self.stun_fx_ind + 1) % stun_fx_amount;
}
do_game_mode_shellshock(is_melee = 0, is_upgraded = 0)
{
self notify( "do_game_mode_shellshock" );