‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_aat_turned.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\aat_shared;
4 #using scripts\shared\array_shared;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\flag_shared;
7 #using scripts\shared\math_shared;
8 #using scripts\shared\spawner_shared;
9 #using scripts\shared\system_shared;
10 #using scripts\shared\table_shared;
11 #using scripts\shared\util_shared;
12 #using scripts\shared\ai\systems\gib;
13 #using scripts\shared\ai\zombie_utility;
14 
15 #insert scripts\shared\aat_zm.gsh;
16 #insert scripts\shared\shared.gsh;
17 #insert scripts\shared\version.gsh;
18 
19 #using scripts\zm\_zm_stats;
20 #using scripts\zm\_zm_utility;
21 
22 #insert scripts\zm\aats\_zm_aat_turned.gsh;
23 
24 #insert scripts\zm\_zm_utility.gsh;
25 
26 #precache( "material", ZM_AAT_TURNED_DAMAGE_FEEDBACK_ICON );
27 
28 #namespace zm_aat_turned;
29 
31 
32 function ‪__init__()
33 {
34  if ( !‪IS_TRUE( level.aat_in_use ) )
35  {
36  return;
37  }
38 
41 
43 }
44 
45 function ‪result( ‪death, attacker, mod, weapon )
46 {
48 
49  self thread ‪zombie_death_time_limit( attacker );
50 
51  self.team = "allies";
52  self.aat_turned = true;
53  self.n_aat_turned_zombie_kills = 0;
54  self.allowDeath = false;
55  self.allowpain = false;
56  self.no_gib = true;
57 
58  // make sure it's the fastest type of zombie
60  if ( ‪math::cointoss() )
61  {
62  if ( self.zombie_arms_position == "up" )
63  {
64  self.variant_type = ‪ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_UP - 1;
65  }
66  else
67  {
68  self.variant_type = ‪ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_DOWN - 1;
69  }
70  }
71  else
72  {
73  if ( self.zombie_arms_position == "up" )
74  {
76  }
77  else
78  {
80  }
81  }
82 
83  if ( IsDefined( attacker ) && IsPlayer( attacker ) )
84  {
85  attacker ‪zm_stats::increment_challenge_stat( "ZOMBIE_HUNTER_TURNED" );
86  }
87 
88  self thread ‪turned_local_blast( attacker );
89  self thread ‪zombie_kill_tracker( attacker );
90 }
91 
92 //self == turned zombie
93 function ‪turned_local_blast( attacker )
94 {
95  v_turned_blast_pos = self.origin;
96 
97  a_ai_zombies = array::get_all_closest( v_turned_blast_pos, GetAITeamArray( "axis" ), undefined, undefined, ‪ZM_AAT_TURNED_RANGE );
98  if ( !isDefined( a_ai_zombies ) )
99  {
100  return;
101  }
102 
103  f_turned_range_sq = ‪ZM_AAT_TURNED_RANGE * ‪ZM_AAT_TURNED_RANGE;
104 
105  n_flung_zombies = 0; // Tracks number of flung zombies, compares to ZM_AAT_TURNED_MAX_ZOMBIES_FLUNG
106  for ( i = 0; i < a_ai_zombies.size; i++ )
107  {
108  // If current ai_zombie is already dead
109  if ( !IsDefined( a_ai_zombies[i] ) || !IsAlive( a_ai_zombies[i] ) )
110  {
111  continue;
112  }
113 
114  // If current ai_zombie is immune to indirect results from the AAT
115  if ( ‪IS_TRUE( level.aat[ ‪ZM_AAT_TURNED_NAME ].immune_result_indirect[ a_ai_zombies[i].archetype ] ) )
116  {
117  continue;
118  }
119 
120  // If current zombie is the one hit by Turned, bypass checks
121  if ( a_ai_zombies[i] == self )
122  {
123  continue;
124  }
125 
126  // Get current zombie's data
127  v_curr_zombie_origin = a_ai_zombies[i] GetCentroid();
128  if ( DistanceSquared( v_turned_blast_pos, v_curr_zombie_origin ) > f_turned_range_sq )
129  {
130  continue;
131  }
132 
133  // Executes the fling.
134  a_ai_zombies[i] DoDamage( a_ai_zombies[i].health, v_curr_zombie_origin, attacker, attacker, "none", "MOD_IMPACT" );
135 
136  // Adds a slight variance to the direction of the fling
137  n_random_x = RandomFloatRange( -3, 3 );
138  n_random_y = RandomFloatRange( -3, 3 );
139 
140  a_ai_zombies[i] StartRagdoll( true );
141  a_ai_zombies[i] LaunchRagdoll ( ‪ZM_AAT_TURNED_FORCE * VectorNormalize( v_curr_zombie_origin - v_turned_blast_pos + ( n_random_x, n_random_y, ‪ZM_AAT_TURNED_UPWARD_ANGLE ) ), "torso_lower" );
142 
143  // Limits the number of zombies flung
144  n_flung_zombies++;
146  {
147  break;
148  }
149  }
150 }
151 
152 // Checks to see if fire works is running
153 // self == zombie
155 {
156  // Bypasses enemys who are immune to AAT results
157  if ( ‪IS_TRUE( level.aat[ ‪ZM_AAT_TURNED_NAME ].immune_result_direct[ self.archetype ] ) )
158  {
159  return false;
160  }
161 
162  if( ‪IS_TRUE( self.barricade_enter ) )
163  {
164  return false;
165  }
166 
167  if ( ‪IS_TRUE( self.is_traversing ) )
168  {
169  return false;
170  }
171 
172  if ( !‪IS_TRUE( self.completed_emerging_into_playable_area ) )
173  {
174  return false;
175  }
176 
177  if ( ‪IS_TRUE( self.is_leaping ) )
178  {
179  return false;
180  }
181 
182  if ( IsDefined( level.zm_aat_turned_validation_override ) && !self [[level.zm_aat_turned_validation_override]]() )
183  {
184  return false;
185  }
186 
187  return true;
188 }
189 
190 // Sets Time Limit before zombie dies
191 // self == affected zombie
192 function ‪zombie_death_time_limit( e_attacker )
193 {
194  self endon( "death" );
195  self endon( "entityshutdown" );
196 
198 
200  self.allowDeath = true;
201  self ‪zombie_death_gib( e_attacker );
202 }
203 
204 // self == zombie
205 function ‪zombie_kill_tracker( e_attacker )
206 {
207  self endon( "death" );
208  self endon( "entityshutdown" );
209 
210  while ( self.n_aat_turned_zombie_kills < ‪ZM_AAT_TURNED_KILL_LIMIT )
211  {
212  wait ‪SERVER_FRAME;
213  }
214 
215  wait .5; // Slight pause to complete any currently running swipe animations before death
217  self.allowDeath = true;
218  self ‪zombie_death_gib( e_attacker );
219 }
220 
221 // Gibs and Kills zombie
222 // self == affected zombie
223 function ‪zombie_death_gib( e_attacker )
224 {
225  gibserverutils::gibhead( self );
226 
227  if ( ‪math::cointoss() )
228  {
229  gibserverutils::gibleftarm( self );
230  }
231  else
232  {
233  gibserverutils::gibrightarm( self );
234  }
235 
236  gibserverutils::giblegs( self );
237 
238  self DoDamage( self.health, self.origin );
239 }
‪ZM_AAT_TURNED_UPWARD_ANGLE
‪#define ZM_AAT_TURNED_UPWARD_ANGLE
Definition: _zm_aat_turned.gsh:21
‪ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_UP
‪#define ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_UP
Definition: _zm_aat_turned.gsh:24
‪death
‪function death(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _ai_tank.csc:134
‪ZM_AAT_TURNED_TIME_LIMIT
‪#define ZM_AAT_TURNED_TIME_LIMIT
Definition: _zm_aat_turned.gsh:12
‪ZM_AAT_TURNED_OCCURS_ON_DEATH
‪#define ZM_AAT_TURNED_OCCURS_ON_DEATH
Definition: _zm_aat_turned.gsh:9
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪cointoss
‪function cointoss()
Definition: math_shared.csc:171
‪ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_DOWN
‪#define ZM_AAT_TURNED_SPRINT_VARIANT_MAX_ARMS_DOWN
Definition: _zm_aat_turned.gsh:25
‪zombie_death_gib
‪function zombie_death_gib(e_attacker)
Definition: _zm_aat_turned.gsc:223
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪__init__
‪function __init__()
Definition: _zm_aat_turned.gsc:32
‪result
‪function result(death, attacker, mod, weapon)
Definition: _zm_aat_turned.gsc:45
‪ZM_AAT_TURNED_COOLDOWN_ENTITY
‪#define ZM_AAT_TURNED_COOLDOWN_ENTITY
Definition: _zm_aat_turned.gsh:6
‪increment_challenge_stat
‪function increment_challenge_stat(stat_name, amount=1)
Definition: _zm_stats.gsc:478
‪turned_zombie_validation
‪function turned_zombie_validation()
Definition: _zm_aat_turned.gsc:154
‪zombie_death_time_limit
‪function zombie_death_time_limit(e_attacker)
Definition: _zm_aat_turned.gsc:192
‪ZM_AAT_TURNED_KILL_LIMIT
‪#define ZM_AAT_TURNED_KILL_LIMIT
Definition: _zm_aat_turned.gsh:13
‪zombie_kill_tracker
‪function zombie_kill_tracker(e_attacker)
Definition: _zm_aat_turned.gsc:205
‪ZM_AAT_TURNED_COOLDOWN_ATTACKER
‪#define ZM_AAT_TURNED_COOLDOWN_ATTACKER
Definition: _zm_aat_turned.gsh:7
‪ZM_AAT_TURNED_RANGE
‪#define ZM_AAT_TURNED_RANGE
Definition: _zm_aat_turned.gsh:19
‪ZM_AAT_TURNED_DAMAGE_FEEDBACK_ICON
‪#define ZM_AAT_TURNED_DAMAGE_FEEDBACK_ICON
Definition: _zm_aat_turned.gsh:10
‪SERVER_FRAME
‪#define SERVER_FRAME
Definition: shared.gsh:264
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪ZM_AAT_TURNED_NAME
‪#define ZM_AAT_TURNED_NAME
Definition: aat_zm.gsh:8
‪set_zombie_run_cycle
‪function set_zombie_run_cycle(new_move_speed)
Definition: zombie_utility.gsc:2076
‪ZM_AAT_TURNED_MAX_ZOMBIES_FLUNG
‪#define ZM_AAT_TURNED_MAX_ZOMBIES_FLUNG
Definition: _zm_aat_turned.gsh:22
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪ZM_AAT_TURNED_COOLDOWN_GLOBAL
‪#define ZM_AAT_TURNED_COOLDOWN_GLOBAL
Definition: _zm_aat_turned.gsh:8
‪ZM_AAT_TURNED_PERCENTAGE
‪#define ZM_AAT_TURNED_PERCENTAGE
Definition: _zm_aat_turned.gsh:5
‪turned_local_blast
‪function turned_local_blast(attacker)
Definition: _zm_aat_turned.gsc:93
‪ZM_AAT_TURNED_DAMAGE_FEEDBACK_SOUND
‪#define ZM_AAT_TURNED_DAMAGE_FEEDBACK_SOUND
Definition: _zm_aat_turned.gsh:11
‪ZM_AAT_TURNED_FORCE
‪#define ZM_AAT_TURNED_FORCE
Definition: _zm_aat_turned.gsh:20