‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_sentinel_drone.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\filter_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\vehicle_shared;
9 #using scripts\shared\archetype_shared\archetype_shared;
10 #using scripts\shared\beam_shared;
11 
12 #using scripts\shared\postfx_shared;
13 
14 #insert scripts\shared\shared.gsh;
15 #insert scripts\shared\version.gsh;
16 #insert scripts\shared\vehicles\_sentinel_drone.gsh;
17 
18 #namespace sentinel_drone;
19 
20 #using_animtree( "generic" );
21 
22 #define SENTINEL_DRONE_CLAW_RIGHT_FX_TAG "tag_fx1"
23 #define SENTINEL_DRONE_CLAW_LEFT_FX_TAG "tag_fx2"
24 #define SENTINEL_DRONE_CLAW_TOP_FX_TAG "tag_fx3"
25 #define SENTINEL_DRONE_CAMERA_FX_TAG "tag_flash"
26 
27 #define SENTINEL_DRONE_ENGINE_FX_TAG "tag_fx_engine_left"
28 
29 #define SENTINEL_DRONE_BEAM "electric_taser_beam_1"
30 #define SENTINEL_DRONE_BEAM_TARGET_FX "dlc3/stalingrad/fx_sentinel_drone_taser_fire_tgt"
31 
32 #define SENTINEL_DRONE_CLAWS_AMBIENT_FX "dlc3/stalingrad/fx_sentinel_drone_taser_idle"
33 #define SENTINEL_DRONE_CLAWS_CHARGING_FX "dlc3/stalingrad/fx_sentinel_drone_taser_charging"
34 #define SENTINEL_DRONE_CAMERA_AMBIENT_FX "dlc3/stalingrad/fx_sentinel_drone_eye_camera_lens_glow"
35 #define SENTINEL_DRONE_CORE_GLOW_FX "dlc3/stalingrad/fx_sentinel_drone_energy_core_glow"
36 #define SENTINEL_DRONE_SCANNER_LIGHT_FX "dlc3/stalingrad/fx_sentinel_drone_scanner_light_glow"
37 
38 #define SENTINEL_DRONE_FACE_BREAK_FX "dlc3/stalingrad/fx_sentinel_drone_dest_core"
39 #define SENTINEL_DRONE_ARM_BREAK_FX "dlc3/stalingrad/fx_sentinel_drone_dest_arm"
40 #define SENTINEL_DRONE_EYE_BREAK_FX "dlc3/stalingrad/fx_sentinel_drone_dest_camera_eye"
41 
42 #define SENTINEL_DRONE_ENGINE_FX "dlc3/stalingrad/fx_sentinel_drone_engine_idle"
43 #define SENTINEL_DRONE_ENGINE_ROLL_FX "dlc3/stalingrad/fx_sentinel_drone_engine_smk_fast"
44 
45 #define SENTINEL_DRONE_PLAYER_DAMAGE_FX "sentinel_pstfx_shock_charge"
46 
47 //Effects
48 #precache( "client_fx", SENTINEL_DRONE_BEAM );
49 #precache( "client_fx", SENTINEL_DRONE_BEAM_TARGET_FX );
50 
51 #precache( "client_fx", SENTINEL_DRONE_CLAWS_AMBIENT_FX );
52 #precache( "client_fx", SENTINEL_DRONE_CLAWS_CHARGING_FX );
53 #precache( "client_fx", SENTINEL_DRONE_CAMERA_AMBIENT_FX );
54 #precache( "client_fx", SENTINEL_DRONE_CORE_GLOW_FX );
55 #precache( "client_fx", SENTINEL_DRONE_SCANNER_LIGHT_FX );
56 
57 #precache( "client_fx", SENTINEL_DRONE_FACE_BREAK_FX );
58 #precache( "client_fx", SENTINEL_DRONE_ARM_BREAK_FX );
59 #precache( "client_fx", SENTINEL_DRONE_EYE_BREAK_FX );
60 
61 #precache( "client_fx", SENTINEL_DRONE_ENGINE_FX );
62 #precache( "client_fx", SENTINEL_DRONE_ENGINE_ROLL_FX );
63 
64 //Models
65 #precache( "client_fx", SENTINEL_DRONE_FACE_MODEL );
66 #precache( "client_fx", SENTINEL_DRONE_ARM_MODEL );
67 #precache( "client_fx", SENTINEL_DRONE_CLAW_MODEL );
68 
69 
70 ‪REGISTER_SYSTEM( "sentinel_drone", &‪__init__, undefined )
71 
72 function ‪__init__()
73 {
74  ‪clientfield::register( "scriptmover", "sentinel_drone_beam_set_target_id", ‪VERSION_DLC3, 5, "int", &‪sentinel_drone_beam_set_target_id, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT);
75  ‪clientfield::register( "vehicle", "sentinel_drone_beam_set_source_to_target", ‪VERSION_DLC3, 5, "int", &‪sentinel_drone_beam_set_source_to_target, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
76 
77  ‪clientfield::register( "toplayer", "sentinel_drone_damage_player_fx", ‪VERSION_DLC3, 1, "counter", &‪sentinel_drone_damage_player_fx, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
78 
82 
86 
88 
90 
92 
94 
96 
97 
98  level._sentinel_Enemy_Detected_Taunts = [];
99  ‪ARRAY_ADD(level._sentinel_Enemy_Detected_Taunts, "vox_valk_valkyrie_detected_0");
100  ‪ARRAY_ADD(level._sentinel_Enemy_Detected_Taunts, "vox_valk_valkyrie_detected_1");
101  ‪ARRAY_ADD(level._sentinel_Enemy_Detected_Taunts, "vox_valk_valkyrie_detected_2");
102  ‪ARRAY_ADD(level._sentinel_Enemy_Detected_Taunts, "vox_valk_valkyrie_detected_3");
103  ‪ARRAY_ADD(level._sentinel_Enemy_Detected_Taunts, "vox_valk_valkyrie_detected_4");
104 
105  level._sentinel_Attack_Taunts = [];
106  ‪ARRAY_ADD(level._sentinel_Attack_Taunts, "vox_valk_valkyrie_attack_0");
107  ‪ARRAY_ADD(level._sentinel_Attack_Taunts, "vox_valk_valkyrie_attack_1");
108  ‪ARRAY_ADD(level._sentinel_Attack_Taunts, "vox_valk_valkyrie_attack_2");
109  ‪ARRAY_ADD(level._sentinel_Attack_Taunts, "vox_valk_valkyrie_attack_3");
110  ‪ARRAY_ADD(level._sentinel_Attack_Taunts, "vox_valk_valkyrie_attack_4");
111 }
112 
113 function ‪sentinel_is_drone_initialized( localClientNum, b_check_for_target_existance_only )
114 {
115  if(!‪IS_TRUE(b_check_for_target_existance_only) )
116  {
117  if( !‪IS_TRUE(self.‪init) )
118  {
119  return false;
120  }
121 
122  if( (!self HasDObj( localClientNum )) )
123  {
124  return false;
125  }
126 
127  return true;
128  }
129  else
130  {
131  source_num = self GetEntityNumber();
132 
133  if( isdefined(level.sentinel_drone_source_to_target) && isdefined(level.sentinel_drone_source_to_target[source_num]) && isdefined(level.sentinel_drone_target_id) && isdefined(level.sentinel_drone_target_id[level.sentinel_drone_source_to_target[source_num]]) )
134  {
135  return true;
136  }
137 
138  return false;
139  }
140 }
141 
142 function ‪sentinel_drone_damage_player_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
143 {
144  localPlayer = GetLocalPlayer( localClientNum );
145 
146  if(isdefined(localPlayer))
147  {
148  localPlayer thread postfx::PlayPostfxBundle( ‪SENTINEL_DRONE_PLAYER_DAMAGE_FX );
149  }
150 }
151 
152 function ‪sentinel_drone_deathfx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
153 {
154  settings = ‪struct::get_script_bundle( "vehiclecustomsettings", "sentinel_drone_settings" );
155 
156  if( isdefined( settings ) )
157  {
158  if( newVal )
159  {
160  handle = PlayFX( localClientNum, settings.drone_secondary_death_fx_1, self.origin );
161  SetFXIgnorePause( localClientNum, handle, true );
162 
163  //Turn off the beam target FX
164  if(isdefined(self.beam_target_fx) && isdefined(self.beam_target_fx[localClientNum]))
165  {
166  StopFX(localClientNum, self.beam_target_fx[localClientNum]);
167  self.beam_target_fx[localClientNum] = undefined;
168  }
169  }
170  }
171 }
172 
173 function ‪sentinel_drone_camera_scanner( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
174 {
175  if(!‪sentinel_is_drone_initialized(localClientNum))
176  {
177  return false;
178  }
179 
180  if(newVal == 1)
181  {
182  if(!isdefined(self.CameraScannerFX) && !‪IS_TRUE(self.CameraDestroyed) )
183  {
184  self.CameraScannerFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_SCANNER_LIGHT_FX, self, ‪SENTINEL_DRONE_CAMERA_FX_TAG);
185  }
186 
187  //Turn on the engine roll FX
188  ‪sentinel_play_engine_fx( localclientnum, false, true );
189  }
190  else
191  {
192  //Turn off the scanner light
193  /#
194  keep_scanner_on = GetDvarInt("sentinel_DebugFX_KeepScannerOn", 0);
195  #/
196 
197  if( isdefined(self.CameraScannerFX) && !‪IS_TRUE(keep_scanner_on))
198  {
199  StopFX(localClientNum, self.CameraScannerFX);
200  self.CameraScannerFX = undefined;
201  }
202 
203  //Turn off the engine roll FX
204  ‪sentinel_play_engine_fx( localclientnum, true, false );
205  }
206 }
207 
208 function ‪sentinel_drone_camera_destroyed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
209 {
210  self.CameraDestroyed = true;
211 
212  if( isdefined(self.CameraScannerFX) )
213  {
214  StopFX(localClientNum, self.CameraScannerFX);
215  self.CameraScannerFX = undefined;
216  }
217 
218  if(isdefined(self.CameraAmbientFX))
219  {
220  StopFX(localClientNum, self.CameraAmbientFX);
221  self.CameraAmbientFX = undefined;
222  }
223 }
224 
225 function ‪sentinel_drone_beam_fire1( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
226 {
228 }
229 
230 function ‪sentinel_drone_beam_fire2( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
231 {
233 }
234 
235 function ‪sentinel_drone_beam_fire3( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
236 {
238 }
239 
240 function ‪sentinel_drone_beam_fire(localClientNum, newVal, tag_id)
241 {
242  if(‪sentinel_is_drone_initialized(localClientNum, newVal == 0))
243  {
244  source_num = self GetEntityNumber();
245  beam_target = level.sentinel_drone_target_id[level.sentinel_drone_source_to_target[source_num]];
246  }
247  else
248  {
249  return;
250  }
251 
252  if(newVal == 1)
253  {
254  level ‪beam::launch( self, tag_id, beam_target, "tag_origin", ‪SENTINEL_DRONE_BEAM );
255 
256  self playsound(0, "zmb_sentinel_attack_short" );
257 
258  //Turn on the beam target FX
259  if(!isdefined(beam_target.beam_target_fx))
260  {
261  beam_target.beam_target_fx = [];
262  }
263 
264  if(!isdefined(beam_target.beam_target_fx[localClientNum]))
265  {
266  beam_target.beam_target_fx[localClientNum] = PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_BEAM_TARGET_FX, beam_target, "tag_origin" );
267  }
268 
269  //Turn off the scanner light
270  /#
271  keep_scanner_on = GetDvarInt("sentinel_DebugFX_KeepScannerOn", 0);
272  #/
273 
274  if( isdefined(self.CameraScannerFX) && !‪IS_TRUE(keep_scanner_on))
275  {
276  StopFX(localClientNum, self.CameraScannerFX);
277  self.CameraScannerFX = undefined;
278  }
279  }
280  else
281  {
282  level ‪beam::kill( self, tag_id, beam_target, "tag_origin", ‪SENTINEL_DRONE_BEAM );
283 
284  //Turn off the beam target FX
285  if(isdefined(beam_target.beam_target_fx) && isdefined(beam_target.beam_target_fx[localClientNum]))
286  {
287  StopFX(localClientNum, beam_target.beam_target_fx[localClientNum]);
288  beam_target.beam_target_fx[localClientNum] = undefined;
289  }
290 
291  //Turn on the claws ambient FX
292  self ‪sentinel_play_claws_ambient_fx(localclientnum);
293  }
294 }
295 
296 function ‪sentinel_drone_beam_set_target_id( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
297 {
298  if(!isdefined(level.sentinel_drone_target_id))
299  {
300  level.sentinel_drone_target_id = [];
301  }
302 
303  level.sentinel_drone_target_id[ newVal ] = self;
304 }
305 
306 function ‪sentinel_drone_beam_set_source_to_target( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
307 {
308  if(!isdefined(level.sentinel_drone_source_to_target))
309  {
310  level.sentinel_drone_source_to_target = [];
311  }
312 
313  source_num = self GetEntityNumber();
314  level.sentinel_drone_source_to_target[source_num] = newVal;
315 
316  self.init = true;
317 
318  //Turn on the claws ambient FX
319  self ‪sentinel_play_claws_ambient_fx(localclientnum);
320 
321  //Set Camera Ambient FX
322  self.CameraAmbientFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_CAMERA_AMBIENT_FX, self, ‪SENTINEL_DRONE_CAMERA_FX_TAG);
323 
324  //Scanner light
325  self.CameraScannerFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_SCANNER_LIGHT_FX, self, ‪SENTINEL_DRONE_CAMERA_FX_TAG);
326 
327  //Turn on the engine FX
328  ‪sentinel_play_engine_fx( localclientnum, true, false );
329 
330  //Play the antenna twitch animation
331  self UseAnimTree( #animtree );
332  self SetAnim("ai_zm_dlc3_sentinel_antenna_twitch");
333 }
334 
335 function ‪sentinel_drone_arm_cut_1( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
336 {
338 }
339 
340 function ‪sentinel_drone_arm_cut_2( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
341 {
343 }
344 
345 function ‪sentinel_drone_arm_cut_3( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
346 {
348 }
349 
350 function ‪sentinel_spawn_broken_arm( localClientNum, arm, arm_tag, claw_tag )
351 {
352  if(!‪sentinel_is_drone_initialized(localClientNum))
353  {
354  return false;
355  }
356 
357  velocity = self GetVelocity();
358  velocity_normal = VectorNormalize(velocity);
359  velocity_length = Length(velocity);
360 
361  if( arm == ‪SENTINEL_DRONE_ARM_TOP )
362  {
363  launch_dir = AnglesToForward( self.angles) * -1;
364  launch_dir = launch_dir + ( 0, 0, 1);
365  launch_dir = VectorNormalize( launch_dir );
366  }
367  else if( arm == ‪SENTINEL_DRONE_ARM_RIGHT )
368  {
369  launch_dir = AnglesToRight( self.angles);
370  }
371  else
372  {
373  launch_dir = AnglesToRight( self.angles) * -1;
374  }
375 
376  velocity_length = velocity_length * 0.1;
377 
378  if(velocity_length < 10)
379  {
380  velocity_length = 10;
381  }
382 
383  launch_dir = launch_dir * 0.5 + velocity_normal * 0.5;
384  launch_dir = launch_dir * velocity_length;
385 
386  claw_pos = self GetTagOrigin( claw_tag ) + launch_dir * 3;
387  claw_ang = self GetTagAngles( claw_tag );
388  thread ‪sentinel_launch_piece( localClientNum, SENTINEL_DRONE_CLAW_MODEL, claw_pos, claw_ang, self.origin, launch_dir * 1.3 );
389 
390  arm_pos = self GetTagOrigin( arm_tag ) + launch_dir * 2;
391  arm_ang = self GetTagAngles( arm_tag );
392  thread ‪sentinel_launch_piece( localClientNum, ‪SENTINEL_DRONE_ARM_MODEL, arm_pos, arm_ang, self.origin, launch_dir );
393 }
394 
395 function ‪sentinel_drone_arm_cut( localClientNum, arm )
396 {
397  if( arm == ‪SENTINEL_DRONE_ARM_RIGHT)
398  {
399  if(!‪IS_TRUE(self.rightArmLost))
400  {
401  //Spawn Dynant
403 
404  //Stop Ambient, Charging and Beam effects
405 
406  self.rightArmLost = true;
408 
409  if(isdefined(self.rightClawAmbientFX))
410  {
411  StopFX(localClientNum, self.rightClawAmbientFX);
412  self.rightClawAmbientFX = undefined;
413  }
414 
415  if(isdefined(self.rightClawChargeFX))
416  {
417  StopFX(localClientNum, self.rightClawChargeFX);
418  self.rightClawChargeFX = undefined;
419  }
420 
421  if(‪sentinel_is_drone_initialized(localClientNum))
422  {
423  //Play Break Effect
424  PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_ARM_BREAK_FX, self, ‪SENTINEL_DRONE_ARM_RIGHT_FX_TAG );
425 
426  //Play Twitch Animation
427  self SetAnim("ai_zm_dlc3_sentinel_arms_broken_right");
428  }
429  }
430  }
431  else if ( arm == ‪SENTINEL_DRONE_ARM_LEFT)
432  {
433  if(!‪IS_TRUE(self.leftArmLost))
434  {
435  //Spawn Dynant
437 
438  //Stop Ambient, Charging and Beam effects
439 
440  self.leftArmLost = true;
442 
443  if(isdefined(self.leftClawAmbientFX))
444  {
445  StopFX(localClientNum, self.leftClawAmbientFX);
446  self.leftClawAmbientFX = undefined;
447  }
448 
449  if(isdefined(self.leftClawChargeFX))
450  {
451  StopFX(localClientNum, self.leftClawChargeFX);
452  self.leftClawChargeFX = undefined;
453  }
454 
455  if(‪sentinel_is_drone_initialized(localClientNum))
456  {
457  //Play Break Effect
458  PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_ARM_BREAK_FX, self, ‪SENTINEL_DRONE_ARM_LEFT_FX_TAG );
459 
460  //Play Twitch Animation
461  self SetAnim("ai_zm_dlc3_sentinel_arms_broken_left");
462  }
463  }
464  }
465  else if ( arm == ‪SENTINEL_DRONE_ARM_TOP)
466  {
467  if(!‪IS_TRUE(self.topArmLost))
468  {
469  //Spawn Dynant
471 
472  //Stop Ambient, Charging and Beam effects
473 
474  self.topArmLost = true;
476 
477  if(isdefined(self.topClawAmbientFX))
478  {
479  StopFX(localClientNum, self.topClawAmbientFX);
480  self.topClawAmbientFX = undefined;
481  }
482 
483  if(isdefined(self.topClawChargeFX))
484  {
485  StopFX(localClientNum, self.topClawChargeFX);
486  self.topClawChargeFX = undefined;
487  }
488 
489  if(‪sentinel_is_drone_initialized(localClientNum))
490  {
491  //Play Break Effect
492  PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_ARM_BREAK_FX, self, ‪SENTINEL_DRONE_ARM_TOP_FX_TAG );
493 
494  //Play Twitch Animation
495  self SetAnim("ai_zm_dlc3_sentinel_arms_broken_top");
496  }
497  }
498  }
499 }
500 
501 function ‪sentinel_drone_beam_charge( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
502 {
503  if(!‪sentinel_is_drone_initialized(localClientNum))
504  {
505  return false;
506  }
507 
508  if(newVal == 1)
509  {
510  //Scanner light
511  if(!isdefined(self.CameraScannerFX))
512  {
513  self.CameraScannerFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_SCANNER_LIGHT_FX, self, ‪SENTINEL_DRONE_CAMERA_FX_TAG);
514  }
515 
516  //Turn off the claws ambient FX
517  self ‪sentinel_play_claws_ambient_fx(localclientnum, true);
518 
519  if(!‪IS_TRUE(self.rightArmLost))
520  {
521  self.rightClawChargeFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_CHARGING_FX, self, ‪SENTINEL_DRONE_CLAW_RIGHT_FX_TAG);
522  }
523 
524  if(!‪IS_TRUE(self.leftArmLost))
525  {
526  self.leftClawChargeFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_CHARGING_FX, self, ‪SENTINEL_DRONE_CLAW_LEFT_FX_TAG);
527  }
528 
529  if(!‪IS_TRUE(self.topArmLost))
530  {
531  self.topClawChargeFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_CHARGING_FX, self, ‪SENTINEL_DRONE_CLAW_TOP_FX_TAG);
532  }
533 
534  if( isdefined(self.enemy_already_spotted) )
535  {
536  if( RandomInt(100) < 30 )
537  {
538  ‪sentinel_play_taunt( localClientNum, level._sentinel_Attack_Taunts);
539  }
540  }
541  else
542  {
543  self.enemy_already_spotted = true;
544  ‪sentinel_play_taunt( localClientNum, level._sentinel_Enemy_Detected_Taunts);
545  }
546  }
547  else
548  {
549  if(isdefined(self.rightClawChargeFX))
550  {
551  StopFX(localClientNum, self.rightClawChargeFX);
552  self.rightClawChargeFX = undefined;
553  }
554 
555  if(isdefined(self.leftClawChargeFX))
556  {
557  StopFX(localClientNum, self.leftClawChargeFX);
558  self.leftClawChargeFX = undefined;
559  }
560 
561  if(isdefined(self.topClawChargeFX))
562  {
563  StopFX(localClientNum, self.topClawChargeFX);
564  self.topClawChargeFX = undefined;
565  }
566  }
567 }
568 
569 function ‪sentinel_drone_face_cut( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
570 {
571  if(!‪sentinel_is_drone_initialized(localClientNum))
572  {
573  return false;
574  }
575 
576  face_pos = self GetTagOrigin( ‪SENTINEL_DRONE_FACE_TAG );
577  face_ang = self GetTagAngles( ‪SENTINEL_DRONE_FACE_TAG );
578  velocity = self GetVelocity();
579 
580  velocity_normal = VectorNormalize(velocity);
581  velocity_length = Length(velocity);
582 
583  launch_dir = AnglesToForward( self.angles);
584 
585  velocity_length = velocity_length * 0.1;
586 
587  if(velocity_length < 10)
588  {
589  velocity_length = 10;
590  }
591 
592  launch_dir = launch_dir * 0.5 + velocity_normal * 0.5;
593  launch_dir = launch_dir * velocity_length;
594 
595  thread ‪sentinel_launch_piece( localClientNum, ‪SENTINEL_DRONE_FACE_MODEL, face_pos, face_ang, self.origin, launch_dir );
596 
597  PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_FACE_BREAK_FX, self, ‪SENTINEL_DRONE_FACE_TAG );
598 
599  PlayFXOnTag( localClientNum, ‪SENTINEL_DRONE_CORE_GLOW_FX, self, ‪SENTINEL_DRONE_CORE_TAG );
600 }
601 
602 function ‪sentinel_play_claws_ambient_fx( localClientNum, b_false )
603 {
604  if(!‪sentinel_is_drone_initialized(localClientNum))
605  {
606  return false;
607  }
608 
609  if(!‪IS_TRUE(b_false))
610  {
611  if(!‪IS_TRUE(self.rightArmLost) && !isdefined(self.rightClawAmbientFX) )
612  {
613  self.rightClawAmbientFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_AMBIENT_FX, self, ‪SENTINEL_DRONE_CLAW_RIGHT_FX_TAG);
614  }
615 
616  if(!‪IS_TRUE(self.leftArmLost) && !isdefined(self.leftClawAmbientFX) )
617  {
618  self.leftClawAmbientFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_AMBIENT_FX, self, ‪SENTINEL_DRONE_CLAW_LEFT_FX_TAG);
619  }
620 
621  if(!‪IS_TRUE(self.topArmLost) && !isdefined(self.topClawAmbientFX) )
622  {
623  self.topClawAmbientFX = PlayFXOnTag(localClientNum, ‪SENTINEL_DRONE_CLAWS_AMBIENT_FX, self, ‪SENTINEL_DRONE_CLAW_TOP_FX_TAG);
624  }
625  }
626  else
627  {
628  if( isdefined(self.rightClawAmbientFX) )
629  {
630  StopFX(localClientNum, self.rightClawAmbientFX);
631  self.rightClawAmbientFX = undefined;
632  }
633 
634  if( isdefined(self.leftClawAmbientFX) )
635  {
636  StopFX(localClientNum, self.leftClawAmbientFX);
637  self.leftClawAmbientFX = undefined;
638  }
639 
640  if( isdefined(self.topClawAmbientFX) )
641  {
642  StopFX(localClientNum, self.topClawAmbientFX);
643  self.topClawAmbientFX = undefined;
644  }
645  }
646 }
647 
648 function ‪sentinel_play_engine_fx( localClientNum, b_engine, b_roll_engine)
649 {
650  if(!‪sentinel_is_drone_initialized(localClientNum))
651  {
652  return false;
653  }
654 
655  //Turn on the engine FX
656  if( ‪IS_TRUE(b_engine) )
657  {
658  self.EngineFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_ENGINE_FX, self, ‪SENTINEL_DRONE_ENGINE_FX_TAG);
659  }
660  else if( isdefined(self.EngineFX) )
661  {
662  StopFX(localclientnum,self.EngineFX);
663  }
664 
665  //Turn on the engine Roll FX
666  //Turn on the engine FX
667  if( ‪IS_TRUE(b_roll_engine) )
668  {
669  self.EngineRollFX = PlayFXOnTag(localclientnum, ‪SENTINEL_DRONE_ENGINE_ROLL_FX, self, ‪SENTINEL_DRONE_ENGINE_FX_TAG);
670  }
671  else if( isdefined(self.EngineRollFX) )
672  {
673  StopFX(localclientnum,self.EngineRollFX);
674  }
675 }
676 
677 function ‪sentinel_play_taunt( localClientNum, taunt_Arr )
678 {
679  if ( isdefined( level._lastplayed_drone_taunt ) && ( GetTime() - level._lastplayed_drone_taunt ) < 6000 )
680  {
681  return;
682  }
683 
684  if( ‪IS_TRUE( level.voxAIdeactivate ) )
685  {
686  return;
687  }
688 
689  taunt = RandomInt(taunt_Arr.size);
690 
691  level._lastplayed_drone_taunt = GetTime();
692  self PlaySound( localClientNum, taunt_Arr[taunt]);
693 }
694 
695 function ‪sentinel_launch_piece( localClientNum, model, pos, angles, ‪hitPos, force)
696 {
697  dynEnt = CreateDynEntAndLaunch( localClientNum, model, pos, angles, ‪hitPos, force );
698 
699  if(!isdefined(dynEnt))
700  {
701  return;
702  }
703 
704  posHeight = pos[2];
705 
706  wait 0.5;
707 
708  if( !isdefined(dynEnt) || !IsDynEntValid(dynEnt) )
709  {
710  return false;
711  }
712 
713  if( dynEnt.origin == pos )
714  {
715  SetDynEntEnabled(dynEnt, false);
716  return;
717  }
718 
719  pos = dynEnt.origin;
720 
721  wait 0.4;
722 
723  if( !isdefined(dynEnt) || !IsDynEntValid(dynEnt) )
724  {
725  return false;
726  }
727 
728  if( dynEnt.origin == pos )
729  {
730  SetDynEntEnabled(dynEnt, false);
731  return;
732  }
733 
734  wait 1;
735 
736  if( !isdefined(dynEnt) || !IsDynEntValid(dynEnt) )
737  {
738  return false;
739  }
740 
741  count = 0;
742  old_pos = dynEnt.origin;
743 
744  while( isdefined(dynEnt) && IsDynEntValid(dynEnt) )
745  {
746  if( old_pos == dynEnt.origin)
747  {
748  old_pos = dynEnt.origin;
749  count++;
750 
751  if(count == 5)
752  {
753  if( posHeight - dynEnt.origin[2] < 15)
754  {
755  SetDynEntEnabled(dynEnt, false);
756  }
757  else
758  {
759  break;
760  }
761  }
762  }
763  else
764  {
765  count = 0;
766  }
767 
768  wait 0.2;
769  }
770 }
‪sentinel_drone_arm_cut_1
‪function sentinel_drone_arm_cut_1(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:335
‪sentinel_drone_beam_set_target_id
‪function sentinel_drone_beam_set_target_id(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:296
‪SENTINEL_DRONE_ARM_TOP
‪#define SENTINEL_DRONE_ARM_TOP
Definition: _sentinel_drone.gsh:32
‪hitPos
‪function hitPos(start, end, color)
Definition: _incendiary.gsc:384
‪SENTINEL_DRONE_FACE_BREAK_FX
‪#define SENTINEL_DRONE_FACE_BREAK_FX
Definition: _sentinel_drone.csc:38
‪SENTINEL_DRONE_ARM_TOP_FX_TAG
‪#define SENTINEL_DRONE_ARM_TOP_FX_TAG
Definition: _sentinel_drone.gsh:47
‪sentinel_drone_arm_cut_2
‪function sentinel_drone_arm_cut_2(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:340
‪sentinel_drone_camera_scanner
‪function sentinel_drone_camera_scanner(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:173
‪sentinel_is_drone_initialized
‪function sentinel_is_drone_initialized(localClientNum, b_check_for_target_existance_only)
Definition: _sentinel_drone.csc:113
‪SENTINEL_DRONE_CLAW_LEFT_FX_TAG
‪#define SENTINEL_DRONE_CLAW_LEFT_FX_TAG
Definition: _sentinel_drone.csc:23
‪SENTINEL_DRONE_ARM_RIGHT
‪#define SENTINEL_DRONE_ARM_RIGHT
Definition: _sentinel_drone.gsh:30
‪SENTINEL_DRONE_ARM_LEFT_FX_TAG
‪#define SENTINEL_DRONE_ARM_LEFT_FX_TAG
Definition: _sentinel_drone.gsh:45
‪launch
‪function launch(ent_1, str_tag1, ent_2, str_tag2, str_beam_type)
Definition: beam_shared.csc:11
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪SENTINEL_DRONE_CAMERA_AMBIENT_FX
‪#define SENTINEL_DRONE_CAMERA_AMBIENT_FX
Definition: _sentinel_drone.csc:34
‪sentinel_drone_camera_destroyed
‪function sentinel_drone_camera_destroyed(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:208
‪SENTINEL_DRONE_PLAYER_DAMAGE_FX
‪#define SENTINEL_DRONE_PLAYER_DAMAGE_FX
Definition: _sentinel_drone.csc:45
‪sentinel_drone_beam_set_source_to_target
‪function sentinel_drone_beam_set_source_to_target(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:306
‪SENTINEL_DRONE_ARM_BREAK_FX
‪#define SENTINEL_DRONE_ARM_BREAK_FX
Definition: _sentinel_drone.csc:39
‪sentinel_drone_arm_cut_3
‪function sentinel_drone_arm_cut_3(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:345
‪__init__
‪function __init__()
Definition: _sentinel_drone.csc:72
‪VERSION_DLC3
‪#define VERSION_DLC3
Definition: version.gsh:95
‪SENTINEL_DRONE_CORE_GLOW_FX
‪#define SENTINEL_DRONE_CORE_GLOW_FX
Definition: _sentinel_drone.csc:35
‪SENTINEL_DRONE_FACE_MODEL
‪#define SENTINEL_DRONE_FACE_MODEL
Definition: _sentinel_drone.gsh:64
‪sentinel_spawn_broken_arm
‪function sentinel_spawn_broken_arm(localClientNum, arm, arm_tag, claw_tag)
Definition: _sentinel_drone.csc:350
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪sentinel_drone_beam_fire3
‪function sentinel_drone_beam_fire3(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:235
‪sentinel_drone_deathfx
‪function sentinel_drone_deathfx(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:152
‪sentinel_drone_beam_fire
‪function sentinel_drone_beam_fire(localClientNum, newVal, tag_id)
Definition: _sentinel_drone.csc:240
‪sentinel_play_taunt
‪function sentinel_play_taunt(localClientNum, taunt_Arr)
Definition: _sentinel_drone.csc:677
‪sentinel_play_claws_ambient_fx
‪function sentinel_play_claws_ambient_fx(localClientNum, b_false)
Definition: _sentinel_drone.csc:602
‪SENTINEL_DRONE_ENGINE_ROLL_FX
‪#define SENTINEL_DRONE_ENGINE_ROLL_FX
Definition: _sentinel_drone.csc:43
‪SENTINEL_DRONE_BEAM_TARGET_FX
‪#define SENTINEL_DRONE_BEAM_TARGET_FX
Definition: _sentinel_drone.csc:30
‪sentinel_drone_beam_fire2
‪function sentinel_drone_beam_fire2(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:230
‪sentinel_drone_damage_player_fx
‪function sentinel_drone_damage_player_fx(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:142
‪kill
‪function kill(ent_1, str_tag1, ent_2, str_tag2, str_beam_type)
Definition: beam_shared.csc:41
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪ARRAY_ADD
‪#define ARRAY_ADD(__array, __item)
Definition: shared.gsh:304
‪SENTINEL_DRONE_CLAWS_AMBIENT_FX
‪#define SENTINEL_DRONE_CLAWS_AMBIENT_FX
Definition: _sentinel_drone.csc:32
‪SENTINEL_DRONE_CAMERA_FX_TAG
‪#define SENTINEL_DRONE_CAMERA_FX_TAG
Definition: _sentinel_drone.csc:25
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪sentinel_drone_beam_charge
‪function sentinel_drone_beam_charge(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:501
‪SENTINEL_DRONE_CLAW_TOP_FX_TAG
‪#define SENTINEL_DRONE_CLAW_TOP_FX_TAG
Definition: _sentinel_drone.csc:24
‪SENTINEL_DRONE_ARM_MODEL
‪#define SENTINEL_DRONE_ARM_MODEL
Definition: _sentinel_drone.gsh:65
‪init
‪function init()
Definition: struct.csc:1
‪SENTINEL_DRONE_ARM_LEFT
‪#define SENTINEL_DRONE_ARM_LEFT
Definition: _sentinel_drone.gsh:31
‪sentinel_play_engine_fx
‪function sentinel_play_engine_fx(localClientNum, b_engine, b_roll_engine)
Definition: _sentinel_drone.csc:648
‪SENTINEL_DRONE_BEAM
‪#define SENTINEL_DRONE_BEAM
Definition: _sentinel_drone.csc:29
‪SENTINEL_DRONE_FACE_TAG
‪#define SENTINEL_DRONE_FACE_TAG
Definition: _sentinel_drone.gsh:49
‪SENTINEL_DRONE_ENGINE_FX
‪#define SENTINEL_DRONE_ENGINE_FX
Definition: _sentinel_drone.csc:42
‪sentinel_drone_face_cut
‪function sentinel_drone_face_cut(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:569
‪sentinel_drone_arm_cut
‪function sentinel_drone_arm_cut(localClientNum, arm)
Definition: _sentinel_drone.csc:395
‪SENTINEL_DRONE_CORE_TAG
‪#define SENTINEL_DRONE_CORE_TAG
Definition: _sentinel_drone.gsh:50
‪SENTINEL_DRONE_SCANNER_LIGHT_FX
‪#define SENTINEL_DRONE_SCANNER_LIGHT_FX
Definition: _sentinel_drone.csc:36
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪get_script_bundle
‪function get_script_bundle(str_type, str_name)
Definition: struct.csc:45
‪SENTINEL_DRONE_ARM_RIGHT_FX_TAG
‪#define SENTINEL_DRONE_ARM_RIGHT_FX_TAG
Definition: _sentinel_drone.gsh:46
‪sentinel_launch_piece
‪function sentinel_launch_piece(localClientNum, model, pos, angles, hitPos, force)
Definition: _sentinel_drone.csc:695
‪sentinel_drone_beam_fire1
‪function sentinel_drone_beam_fire1(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _sentinel_drone.csc:225
‪SENTINEL_DRONE_ENGINE_FX_TAG
‪#define SENTINEL_DRONE_ENGINE_FX_TAG
Definition: _sentinel_drone.csc:27
‪SENTINEL_DRONE_CLAW_RIGHT_FX_TAG
‪#define SENTINEL_DRONE_CLAW_RIGHT_FX_TAG
Definition: _sentinel_drone.csc:22
‪SENTINEL_DRONE_CLAWS_CHARGING_FX
‪#define SENTINEL_DRONE_CLAWS_CHARGING_FX
Definition: _sentinel_drone.csc:33