‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_aat_thunder_wall.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
4 #using scripts\shared\aat_shared;
5 #using scripts\shared\array_shared;
6 #using scripts\shared\clientfield_shared;
7 #using scripts\shared\flag_shared;
8 #using scripts\shared\fx_shared;
9 #using scripts\shared\math_shared;
10 #using scripts\shared\system_shared;
11 #using scripts\shared\util_shared;
12 #using scripts\shared\ai\systems\gib;
13 
14 #insert scripts\shared\aat_zm.gsh;
15 #insert scripts\shared\shared.gsh;
16 #insert scripts\shared\version.gsh;
17 
18 #using scripts\zm\_zm_stats;
19 #using scripts\zm\_zm_utility;
20 
21 #insert scripts\zm\aats\_zm_aat_thunder_wall.gsh;
22 
23 #insert scripts\zm\_zm_utility.gsh;
24 
25 #precache( "material", ZM_AAT_THUNDER_WALL_DAMAGE_FEEDBACK_ICON );
26 #precache( "fx", ZM_AAT_THUNDER_WALL_BREAK_FX );
27 
28 #namespace zm_aat_thunder_wall;
29 
31 
32 function ‪__init__()
33 {
34  if ( !‪IS_TRUE( level.aat_in_use ) )
35  {
36  return;
37  }
38 
41 
43 }
44 
45 
46 function ‪result( ‪death, attacker, mod, weapon )
47 {
48  self thread ‪thunder_wall_blast( attacker );
49 }
50 
51 // if immune_result_direct, self is unaffected by thunder wall.
52 // if immune_result_indirect (and !immune_result_direct), self is damaged by thunder wall, but not flung
53 // self == target zombie
54 function ‪thunder_wall_blast( attacker )
55 {
56  v_thunder_wall_blast_pos = self.origin; // Stores origin point of Thunder Wall
57  v_attacker_facing_forward_dir = VectorToAngles( v_thunder_wall_blast_pos - attacker.origin ); // Stores player's facing when they fired
58  v_attacker_facing = attacker GetWeaponForwardDir(); // Angle of blast
59  v_attacker_orientation = attacker.angles; // Angle of blast fx
60 
61  a_ai_zombies = array::get_all_closest( v_thunder_wall_blast_pos, GetAITeamArray( "axis" ), undefined, undefined, 2 * ‪ZM_AAT_THUNDER_WALL_RANGE );
62  if ( !isDefined( a_ai_zombies ) )
63  {
64  return;
65  }
66 
68  f_thunder_wall_effect_area_sq = ‪ZM_AAT_THUNDER_WALL_RANGE * ‪ZM_AAT_THUNDER_WALL_RANGE * 9;
69 
70  end_pos = v_thunder_wall_blast_pos + VectorScale( v_attacker_facing, ‪ZM_AAT_THUNDER_WALL_RANGE );
71 
73 
74  level thread ‪thunder_wall_blast_fx( v_thunder_wall_blast_pos, v_attacker_orientation );
75 
76  n_flung_zombies = 0; // Tracks number of flung zombies, compares to ZM_AAT_THUNDER_WALL_MAX_ZOMBIES_FLUNG
77  for ( i = 0; i < a_ai_zombies.size; i++ )
78  {
79  // If current ai_zombie is already dead
80  if ( !IsDefined( a_ai_zombies[i] ) || !IsAlive( a_ai_zombies[i] ) )
81  {
82  continue;
83  }
84 
85  // If current ai_zombie is immune to direct results from the AAT
86  if ( ‪IS_TRUE( level.aat[ ‪ZM_AAT_THUNDER_WALL_NAME ].immune_result_direct[ a_ai_zombies[i].archetype ] ) )
87  {
88  continue;
89  }
90 
91  // If current zombie is the one hit by Thunder Wall, bypass checks
92  if ( a_ai_zombies[i] == self )
93  {
94  v_curr_zombie_origin = self.origin;
95  v_curr_zombie_origin_sq = 0;
96  }
97  else
98  {
99  // Get current zombie's data
100  v_curr_zombie_origin = a_ai_zombies[i] GetCentroid();
101  v_curr_zombie_origin_sq = DistanceSquared( v_thunder_wall_blast_pos, v_curr_zombie_origin );
102  v_curr_zombie_to_thunder_wall = VectorNormalize( v_curr_zombie_origin - v_thunder_wall_blast_pos );
103  v_curr_zombie_facing_dot = VectorDot( v_attacker_facing, v_curr_zombie_to_thunder_wall );
104 
105  // If the current zombie is in front of the zombie hit by Thunder Wall, is unaffected
106  if ( v_curr_zombie_facing_dot < 0 )
107  {
108  continue;
109  }
110 
111  // If current zombie is out of range
112  radial_origin = PointOnSegmentNearestToPoint( v_thunder_wall_blast_pos, end_pos, v_curr_zombie_origin );
113  if ( DistanceSquared( v_curr_zombie_origin, radial_origin ) > f_thunder_wall_effect_area_sq )
114  {
115  continue;
116  }
117  }
118 
119  // Executes the fling. If the zombie is the one hit by the bullet, will fling automatically
120  if ( v_curr_zombie_origin_sq < f_thunder_wall_range_sq )
121  {
122  a_ai_zombies[i] DoDamage( a_ai_zombies[i].health, v_curr_zombie_origin, attacker, attacker, "none", "MOD_IMPACT" );
123 
124  if ( IsDefined( attacker ) && IsPlayer( attacker ) )
125  {
126  attacker ‪zm_stats::increment_challenge_stat( "ZOMBIE_HUNTER_THUNDER_WALL" );
127  }
128 
129  // If current ai_zombie is not immune to indirect results from the AAT, ragdoll
130  if ( !‪IS_TRUE( level.aat[ ‪ZM_AAT_THUNDER_WALL_NAME ].immune_result_indirect[ self.archetype ] ) )
131  {
132  // Adds a slight variance to the direction of the fling
133  n_random_x = RandomFloatRange( -3, 3 );
134  n_random_y = RandomFloatRange( -3, 3 );
135 
136  a_ai_zombies[i] StartRagdoll( true );
137  a_ai_zombies[i] LaunchRagdoll ( ‪ZM_AAT_THUNDER_WALL_FORCE * VectorNormalize( v_curr_zombie_origin - v_thunder_wall_blast_pos + ( n_random_x, n_random_y, ‪ZM_AAT_THUNDER_WALL_UPWARD_ANGLE ) ), "torso_lower" );
138  }
139 
140  n_flung_zombies++;
141  }
142 
143  // Limits the number of zombies flung by the bullet
145  {
146  break;
147  }
148  }
149 }
150 
151 function ‪thunder_wall_blast_fx( v_blast_origin, v_attacker_orientation )
152 {
153  ‪fx::play( ‪ZM_AAT_THUNDER_WALL_CF_NAME_BREAK_FX, v_blast_origin, v_attacker_orientation, ‪ZM_AAT_THUNDER_WALL_FX_TIME );
154 }
‪ZM_AAT_THUNDER_WALL_OCCURS_ON_DEATH
‪#define ZM_AAT_THUNDER_WALL_OCCURS_ON_DEATH
Definition: _zm_aat_thunder_wall.gsh:9
‪death
‪function death(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _ai_tank.csc:134
‪ZM_AAT_THUNDER_WALL_UPWARD_ANGLE
‪#define ZM_AAT_THUNDER_WALL_UPWARD_ANGLE
Definition: _zm_aat_thunder_wall.gsh:17
‪ZM_AAT_THUNDER_WALL_FX_TIME
‪#define ZM_AAT_THUNDER_WALL_FX_TIME
Definition: _zm_aat_thunder_wall.gsh:23
‪ZM_AAT_THUNDER_WALL_EXPLOSION_SOUND
‪#define ZM_AAT_THUNDER_WALL_EXPLOSION_SOUND
Definition: _zm_aat_thunder_wall.gsh:12
‪ZM_AAT_THUNDER_WALL_DAMAGE_FEEDBACK_ICON
‪#define ZM_AAT_THUNDER_WALL_DAMAGE_FEEDBACK_ICON
Definition: _zm_aat_thunder_wall.gsh:10
‪__init__
‪function __init__()
Definition: _zm_aat_thunder_wall.gsc:32
‪play
‪function play(animation, v_origin_or_ent, v_angles_or_tag, n_rate=1, n_blend_in=.2, n_blend_out=.2, n_lerp, b_link=false)
Definition: animation_shared.csc:44
‪ZM_AAT_THUNDER_WALL_FORCE
‪#define ZM_AAT_THUNDER_WALL_FORCE
Definition: _zm_aat_thunder_wall.gsh:16
‪thunder_wall_blast_fx
‪function thunder_wall_blast_fx(v_blast_origin, v_attacker_orientation)
Definition: _zm_aat_thunder_wall.gsc:151
‪ZM_AAT_THUNDER_WALL_BREAK_FX
‪#define ZM_AAT_THUNDER_WALL_BREAK_FX
Definition: _zm_aat_thunder_wall.gsh:22
‪ZM_AAT_THUNDER_WALL_PERCENTAGE
‪#define ZM_AAT_THUNDER_WALL_PERCENTAGE
Definition: _zm_aat_thunder_wall.gsh:5
‪ZM_AAT_THUNDER_WALL_RANGE
‪#define ZM_AAT_THUNDER_WALL_RANGE
Definition: _zm_aat_thunder_wall.gsh:15
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪increment_challenge_stat
‪function increment_challenge_stat(stat_name, amount=1)
Definition: _zm_stats.gsc:478
‪ZM_AAT_THUNDER_WALL_COOLDOWN_ATTACKER
‪#define ZM_AAT_THUNDER_WALL_COOLDOWN_ATTACKER
Definition: _zm_aat_thunder_wall.gsh:7
‪ZM_AAT_THUNDER_WALL_COOLDOWN_ENTITY
‪#define ZM_AAT_THUNDER_WALL_COOLDOWN_ENTITY
Definition: _zm_aat_thunder_wall.gsh:6
‪ZM_AAT_THUNDER_WALL_COOLDOWN_GLOBAL
‪#define ZM_AAT_THUNDER_WALL_COOLDOWN_GLOBAL
Definition: _zm_aat_thunder_wall.gsh:8
‪ZM_AAT_THUNDER_WALL_CF_NAME_BREAK_FX
‪#define ZM_AAT_THUNDER_WALL_CF_NAME_BREAK_FX
Definition: _zm_aat_thunder_wall.gsh:21
‪result
‪function result(death, attacker, mod, weapon)
Definition: _zm_aat_thunder_wall.gsc:46
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪ZM_AAT_THUNDER_WALL_MAX_ZOMBIES_FLUNG
‪#define ZM_AAT_THUNDER_WALL_MAX_ZOMBIES_FLUNG
Definition: _zm_aat_thunder_wall.gsh:18
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪thunder_wall_blast
‪function thunder_wall_blast(attacker)
Definition: _zm_aat_thunder_wall.gsc:54
‪ZM_AAT_THUNDER_WALL_DAMAGE_FEEDBACK_SOUND
‪#define ZM_AAT_THUNDER_WALL_DAMAGE_FEEDBACK_SOUND
Definition: _zm_aat_thunder_wall.gsh:11
‪ZM_AAT_THUNDER_WALL_NAME
‪#define ZM_AAT_THUNDER_WALL_NAME
Definition: aat_zm.gsh:7