‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_microwave_turret.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\challenges_shared;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\flag_shared;
7 #using scripts\shared\hostmigration_shared;
8 #using scripts\shared\killstreaks_shared;
9 #using scripts\shared\popups_shared;
10 #using scripts\shared\scoreevents_shared;
11 #using scripts\shared\turret_shared;
12 #using scripts\shared\util_shared;
13 #using scripts\shared\vehicle_death_shared;
14 #using scripts\shared\vehicle_shared;
15 #using scripts\shared\weapons\_weaponobjects;
16 
17 #using scripts\mp\_util;
18 #using scripts\mp\gametypes\_globallogic_audio;
19 #using scripts\mp\gametypes\_hostmigration;
20 #using scripts\mp\gametypes\_spawning;
21 #using scripts\mp\killstreaks\_airsupport;
22 #using scripts\mp\killstreaks\_airsupport;
23 #using scripts\mp\killstreaks\_emp;
24 #using scripts\mp\killstreaks\_killstreakrules;
25 #using scripts\mp\killstreaks\_killstreaks;
26 #using scripts\mp\killstreaks\_killstreak_bundles;
27 #using scripts\mp\killstreaks\_killstreak_hacking;
28 #using scripts\mp\killstreaks\_placeables;
29 #using scripts\mp\killstreaks\_remote_weapons;
30 #using scripts\mp\killstreaks\_turret;
31 #using scripts\mp\teams\_teams;
32 
33 #insert scripts\mp\_hacker_tool.gsh;
34 #insert scripts\mp\killstreaks\_killstreaks.gsh;
35 #insert scripts\shared\shared.gsh;
36 #insert scripts\shared\version.gsh;
37 
38 #precache( "string", "KILLSTREAK_EARNED_AUTO_TURRET" );
39 #precache( "string", "KILLSTREAK_AUTO_TURRET_NOT_AVAILABLE" );
40 
41 #precache( "string", "KILLSTREAK_AUTO_TURRET_CRATE" );
42 #precache( "string", "KILLSTREAK_MICROWAVE_TURRET_CRATE" );
43 #precache( "string", "KILLSTREAK_EARNED_AUTO_TURRET" );
44 #precache( "string", "KILLSTREAK_AUTO_TURRET_NOT_AVAILABLE" );
45 #precache( "string", "KILLSTREAK_AIRSPACE_FULL" );
46 #precache( "string", "KILLSTREAK_EARNED_MICROWAVE_TURRET" );
47 #precache( "string", "KILLSTREAK_MICROWAVE_TURRET_NOT_AVAILABLE" );
48 #precache( "string", "KILLSTREAK_MICROWAVE_TURRET_HACKED" );
49 #precache( "string", "KILLSTREAK_MICROWAVE_TURRET_INBOUND" );
50 #precache( "string", "KILLSTREAK_DESTROYED_MICROWAVE_TURRET" );
51 #precache( "triggerstring", "KILLSTREAK_MICROWAVE_TURRET_PLACE_TURRET_HINT" );
52 #precache( "triggerstring", "KILLSTREAK_MICROWAVE_TURRET_INVALID_TURRET_LOCATION" );
53 #precache( "triggerstring", "KILLSTREAK_MICROWAVE_TURRET_PICKUP" );
54 #precache( "string", "mpl_killstreak_turret" );
55 #precache( "string", "mpl_killstreak_auto_turret" );
56 #precache( "fx", "killstreaks/fx_sentry_emp_stun" );
57 #precache( "fx", "killstreaks/fx_sentry_damage_state" );
58 #precache( "fx", "killstreaks/fx_sentry_death_state" );
59 #precache( "fx", "killstreaks/fx_sentry_exp" );
60 #precache( "fx", "killstreaks/fx_sentry_disabled_spark" );
61 #precache( "fx", "killstreaks/fx_sg_emp_stun" );
62 #precache( "fx", "killstreaks/fx_sg_damage_state" );
63 #precache( "fx", "killstreaks/fx_sg_death_state" );
64 #precache( "fx", "killstreaks/fx_sg_exp" );
65 #precache( "fx", "killstreaks/fx_sg_distortion_cone_ash" );
66 #precache( "fx", "killstreaks/fx_sg_distortion_cone_ash_sm" );
67 #precache( "fx", "explosions/fx_exp_equipment_lg" );
68 #precache( "model", MICROWAVE_TURRET_INVALID_PLACEMENT_MODEL );
69 #precache( "model", MICROWAVE_TURRET_VALID_PLACEMENT_MODEL );
70 #precache( "model", "wpn_t7_none_world" );
71 
72 #using_animtree( "mp_microwaveturret" );
73 
74 #define MICROWAVE_TURRET_NAME "microwave_turret"
75 #define MICROWAVE_TURRET_WEAPON_NAME "microwave_turret_deploy"
76 #define MICROWAVE_TURRET_ON_TARGET_ANGLE (15)
77 #define MICROWAVE_TURRET_DELETE_ON_DEATH_DELAY 0.1
78 
79 #define MICROWAVE_TURRET_FX_SIZE ( 135 )
80 #define MICROWAVE_TURRET_FX_HALF_SIZE_THRESHOLD ( 68 )
81 #define MICROWAVE_TURRET_FX_START_OFFSET ( 68 + 34 )
82 #define MICROWAVE_TURRET_FX "killstreaks/fx_sg_distortion_cone_ash"
83 #define MICROWAVE_TURRET_FX_HALF "killstreaks/fx_sg_distortion_cone_ash_sm"
84 #define MICROWAVE_TURRET_STUN_FX "killstreaks/fx_sg_emp_stun"
85 #define MICROWAVE_TURRET_FX_TRACE_ANGLE ( 55 )
86 #define MICROWAVE_TURRET_FX_CHECK_TIME ( 1.0 )
87 
88 #namespace microwave_turret;
89 
90 function ‪init()
91 {
93  ‪killstreaks::register_strings( ‪MICROWAVE_TURRET_NAME, &"KILLSTREAK_EARNED_MICROWAVE_TURRET", &"KILLSTREAK_MICROWAVE_TURRET_NOT_AVAILABLE", &"KILLSTREAK_MICROWAVE_TURRET_INBOUND", undefined, &"KILLSTREAK_MICROWAVE_TURRET_HACKED", false );
94  ‪killstreaks::register_dialog( ‪MICROWAVE_TURRET_NAME, "mpl_killstreak_turret", "microwaveTurretDialogBundle", undefined, "friendlyMicrowaveTurret", "enemyMicrowaveTurret", "enemyMicrowaveTurretMultiple", "friendlyMicrowaveTurretHacked", "enemyMicrowaveTurretHacked", "requestMicrowaveTurret", "threatMicrowaveTurret" );
96 
97  level.microwaveOpenAnim = %o_turret_guardian_open;
98  level.microwaveCloseAnim = %o_turret_guardian_close;
99 
100  ‪clientfield::register( "vehicle", "turret_microwave_open", ‪VERSION_SHIP, 1, "int" );
101  ‪clientfield::register( "scriptmover", "turret_microwave_init", ‪VERSION_SHIP, 1, "int" ); // re-export model in close position to save this clientfield
102  ‪clientfield::register( "scriptmover", "turret_microwave_close", ‪VERSION_SHIP, 1, "int" );
103 
104  vehicle::add_main_callback( ‪MICROWAVE_TURRET_VEHICLE_NAME, &‪InitTurretVehicle );
105 
108 }
109 
111 {
112  turretVehicle = self;
113  //turretVehicle.delete_on_death = true;
114 
116  turretVehicle.damageTaken = 0;
117  turretVehicle.deal_no_crush_damage = true;
118  turretVehicle.health = turretVehicle.maxhealth;
119 
122  turretVehicle ‪clientfield::set( "enemyvehicle", ‪ENEMY_VEHICLE_ACTIVE );
123  turretVehicle.soundmod = "hpm";
124 
125  turretVehicle.overrideVehicleDamage = &‪OnTurretDamage;
126  turretVehicle.overrideVehicleDeath = &‪OnTurretDeath;
127  turretVehicle.overrideVehicleDeathPostGame = &‪OnTurretDeathPostGame;
128 
129  turretVehicle.aim_only_no_shooting = true;
130 }
131 
133 {
134  // needs to reset this whenever a player spawns, could be switching teams and this var remains defined
136 }
137 
139 {
141 }
142 
144 {
145  self.lastMicrowavedBy = undefined;
146  self.beingMicrowavedBy = undefined;
147 }
148 
150 {
151  player = self;
152  assert( IsPlayer( player ) );
153 
154  killstreakId = self ‪killstreakrules::killstreakStart( ‪MICROWAVE_TURRET_NAME, player.team, false, false );
155  if( killstreakId == ‪INVALID_KILLSTREAK_ID )
156  {
157  return false;
158  }
159 
160  bundle = level.killstreakBundle[‪MICROWAVE_TURRET_NAME];
161 
162  turret = player ‪placeables::SpawnPlaceable( ‪MICROWAVE_TURRET_NAME, killstreakId,
166  bundle.ksPlaceableHint, bundle.ksPlaceableInvalidLocationHint );
168  turret.damageTaken = 0;
169  turret.killstreakEndTime = getTime() + ‪MICROWAVE_TURRET_DURATION;
170  turret thread ‪WatchKillstreakEnd( killstreakId, player.team );
171  turret thread ‪util::ghost_wait_show_to_player( player );
172  turret.otherModel thread ‪util::ghost_wait_show_to_others( player );
173  turret ‪clientfield::set( "turret_microwave_init", 1 );
174  turret.otherModel ‪clientfield::set( "turret_microwave_init", 1 );
175 
176  event = turret ‪util::waittill_any_return( "placed", "cancelled", "death", "disconnect" );
177  if( event != "placed" )
178  {
179  return false;
180  }
181 
182  return true;
183 }
184 
185 function ‪OnPlaceTurret( turret )
186 {
187  player = self;
188  assert( IsPlayer( player ) );
189 
190  if( isdefined( turret.vehicle ) )
191  {
192  turret.vehicle.origin = turret.origin;
193  turret.vehicle.angles = turret.angles;
194  turret.vehicle thread ‪util::ghost_wait_show( 0.05 );
195  //turret.vehicle playsound ("wpn_micro_turret_start");
196  }
197  else
198  {
199  turret.vehicle = SpawnVehicle( ‪MICROWAVE_TURRET_VEHICLE_NAME, turret.origin, turret.angles, "dynamic_spawn_ai" );
200  turret.vehicle.owner = player;
201  turret.vehicle SetOwner( player );
202  turret.vehicle.ownerEntNum = player.entNum;
203  turret.vehicle.parentStruct = turret;
204 
205  turret.vehicle.team = player.team;
206  turret.vehicle SetTeam( player.team );
207  turret.vehicle ‪turret::set_team( player.team, 0 );
208  turret.vehicle.ignore_vehicle_underneath_splash_scalar = true;
209  turret.vehicle.use_non_teambased_enemy_selection = true;
210  turret.vehicle.turret = turret;
211 
212  turret.vehicle thread ‪util::ghost_wait_show( 0.05 );
213 
215  player AddWeaponStat( GetWeapon( ‪MICROWAVE_TURRET_NAME ), "used", 1 );
216 
217  turret.vehicle ‪killstreaks::configure_team( ‪MICROWAVE_TURRET_NAME, turret.killstreakId, player );
219  player ‪killstreaks::play_killstreak_start_dialog( ‪MICROWAVE_TURRET_NAME, player.pers["team"], turret.killstreakId );
220  }
221 
222  turret.vehicle ‪turret::enable( 0, false );
223  Target_Set( turret.vehicle, ( 0, 0, 36 ) );
224 
225  turret.vehicle ‪vehicle::disconnect_paths( 0, false );
226 
227  turret ‪StartMicrowave();
228 }
229 
230 function ‪HackedPreFunction( hacker )
231 {
232  turretVehicle = self;
233  turretvehicle.turret notify( "hacker_delete_placeable_trigger" );
234  turretvehicle.turret ‪StopMicrowave();
235  turretvehicle.turret ‪killstreaks::configure_team( ‪MICROWAVE_TURRET_NAME, turretvehicle.turret.killstreakId, hacker, undefined, undefined, undefined, true );
236 }
237 
238 function ‪HackedPostFunction( hacker )
239 {
240  turretVehicle = self;
241  turretvehicle.turret ‪StartMicrowave();
242 }
243 
244 function ‪OnCancelPlacement( turret )
245 {
246  turret notify( "microwave_turret_shutdown" );
247 }
248 
249 function ‪OnPickupTurret( turret )
250 {
251  turret ‪StopMicrowave();
252 
253  turret.vehicle thread ‪GhostAfterWait( 0.05 );
254  turret.vehicle ‪turret::disable( 0 );
255  turret.vehicle LinkTo( turret );
256  Target_Remove( turret.vehicle );
257 
258  turret.vehicle ‪vehicle::connect_paths();
259 
260  //turret.vehicle playsound ("wpn_micro_turret_stop");
261 }
262 
263 function ‪GhostAfterWait( wait_time )
264 {
265  self endon( "death" );
266 
267  wait wait_time;
268  self Ghost();
269 }
270 
271 function ‪OnEMP( attacker )
272 {
273  turret = self;
274  //TODO: Play Turret EMP FX
275 }
276 
277 function ‪OnTurretDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, weapon, vPoint, vDir, sHitLoc, vDamageOrigin, psOffsetTime, damageFromUnderneath, modelIndex, partName, vSurfaceNormal )
278 {
279  empDamage = int( iDamage + ( self.healthdefault * ‪TURRET_EMP_DAMAGE_PERCENTAGE ) + 0.5 );
280 
281  iDamage = self ‪killstreaks::OnDamagePerWeapon( ‪MICROWAVE_TURRET_NAME, eAttacker, iDamage, iDFlags, sMeansOfDeath, weapon, self.maxhealth, undefined, self.maxhealth*0.4, undefined, empDamage, undefined, true, 1.0 );
282  self.damageTaken += iDamage;
283  return iDamage;
284 }
285 
286 function ‪OnTurretDeath( eInflictor, eAttacker, iDamage, sMeansOfDeath, weapon, vDir, sHitLoc, psOffsetTime )
287 {
288  turretVehicle = self;
289 
290  eAttacker = self [[ level.figure_out_attacker ]]( eAttacker );
291 
292  if ( isdefined( turretVehicle.parentStruct ) )
293  {
294  turretVehicle.parentStruct ‪placeables::ForceShutdown();
295 
296  if ( turretVehicle.parentStruct.killstreakTimedOut === true && isdefined( turretVehicle.owner ) )
297  {
298  turretVehicle.owner ‪globallogic_audio::play_taacom_dialog( "timeout", turretVehicle.parentStruct.killstreakType );
299  }
300  else
301  {
302  if ( isdefined( eAttacker ) && IsPlayer( eAttacker ) && isdefined( turretVehicle.owner ) && ( eAttacker != turretVehicle.owner ) )
303  turretVehicle.parentStruct ‪killstreaks::play_destroyed_dialog_on_owner( turretVehicle.parentStruct.killstreakType, turretVehicle.parentStruct.killstreakId );
304  }
305  }
306 
307  if( isdefined( eAttacker ) && IsPlayer( eAttacker ) && ( !isdefined( self.owner ) || self.owner ‪util::IsEnemyPlayer( eAttacker ) ) )
308  {
309  ‪scoreevents::processScoreEvent( "destroyed_microwave_turret", eAttacker, self.owner, weapon );
310  eAttacker ‪challenges::destroyScoreStreak( weapon, false, true, false );
312  eAttacker AddPlayerStat( "destroy_turret", 1 );
313  eAttacker AddWeaponStat( weapon, "destroy_turret", 1 );
314  LUINotifyEvent( &"player_callout", 2, &"KILLSTREAK_DESTROYED_MICROWAVE_TURRET", eAttacker.entnum );
315  }
316 
317  if ( isdefined( turretVehicle.parentStruct ) )
318  {
319  turretVehicle.parentStruct notify( "microwave_turret_shutdown" );
320  }
321 
322  turretVehicle ‪vehicle_death::death_fx();
323 
325 
326  turretVehicle delete();
327 }
328 
329 function ‪OnTurretDeathPostGame( eInflictor, eAttacker, iDamage, sMeansOfDeath, weapon, vDir, sHitLoc, psOffsetTime )
330 {
331  turretVehicle = self;
332 
333  if ( isdefined( turretVehicle.parentStruct ) )
334  {
335  turretVehicle.parentStruct ‪placeables::ForceShutdown();
336  }
337  if ( isdefined( turretVehicle.parentStruct ) )
338  {
339  turretVehicle.parentStruct notify( "microwave_turret_shutdown" );
340  }
341 
342  turretVehicle ‪vehicle_death::death_fx();
343 
345 
346  turretVehicle delete();
347 }
348 
349 
350 function ‪OnShutdown( turret )
351 {
352  turret ‪StopMicrowave();
353 
354  if ( isdefined( turret.vehicle ) )
355  {
356  turret.vehicle playsound ("mpl_m_turret_exp");
357  turret.vehicle Kill();
358  }
359 
360  turret notify( "microwave_turret_shutdown" );
361 }
362 
363 function ‪WatchKillstreakEnd( killstreak_id, team )
364 {
365  turret = self;
366 
367  turret waittill( "microwave_turret_shutdown" );
368 
370 }
371 
373 {
374  turret = self;
375  if ( isdefined( turret.trigger ) )
376  {
377  turret.trigger delete();
378  }
379  turret.trigger = ‪spawn("trigger_radius", turret.origin + (0,0,-‪MICROWAVE_TURRET_RADIUS), level.aiTriggerSpawnFlags | level.vehicleTriggerSpawnFlags, ‪MICROWAVE_TURRET_RADIUS, ‪MICROWAVE_TURRET_RADIUS*2);
380  turret thread ‪TurretThink();
381 
382  turret ‪clientfield::set( "turret_microwave_close", 0 );
383  turret.otherModel ‪clientfield::set( "turret_microwave_close", 0 );
384 
385  if ( isdefined( turret.vehicle ))
386  {
387  turret.vehicle ‪clientfield::set( "turret_microwave_open", 1 );
388  }
389 
390  turret ‪turret::CreateTurretInfluencer( "turret" );
391  turret ‪turret::CreateTurretInfluencer( "turret_close" );
392 
393  /#
394  turret thread ‪TurretDebugWatch();
395  #/
396 }
397 
399 {
400  turret = self;
402 
403  if( isdefined( turret ) )
404  {
405  turret ‪clientfield::set( "turret_microwave_close", 1 );
406  turret.otherModel ‪clientfield::set( "turret_microwave_close", 1 );
407 
408  if ( isdefined( turret.vehicle ) )
409  {
410  turret.vehicle ‪clientfield::set( "turret_microwave_open", 0 );
411  }
412 
413  turret playsound ("mpl_microwave_beam_off");
414 
415  if( isdefined( turret.microwaveFXEnt ) )
416  {
417  turret.microwaveFXEnt delete();
418 
419  // /# IPrintLnBold( "Deleted Microwave Fx Ent: " + GetTime() ); #/
420  }
421 
422  if( isdefined( turret.trigger ) )
423  {
424  turret.trigger notify( "microwave_end_fx" );
425  turret.trigger Delete();
426  }
427 
428  /#
429  turret notify( "stop_turret_debug" );
430  #/
431  }
432 }
433 
435 {
436  turret = self;
437  turret endon( "stop_turret_debug" );
438 
439  for(;;)
440  {
441  if ( GetDvarInt( "scr_microwave_turret_debug" ) != 0 )
442  {
443  turret ‪TurretDebug();
444 
446  }
447  else
448  {
449  wait 1.0;
450  }
451  }
452 }
453 
454 function ‪TurretDebug()
455 {
456  turret = self;
457 
458  debug_line_frames = 3;
459 
460  angles = turret.vehicle GetTagAngles( "tag_flash" );
461  origin = turret.vehicle GetTagOrigin( "tag_flash" );
462 
463  cone_apex = origin;
464  forward = AnglesToForward( angles ) ;
465  dome_apex = cone_apex + VectorScale( forward, ‪MICROWAVE_TURRET_RADIUS );
466 
467  ‪util::debug_spherical_cone( cone_apex, dome_apex, ‪MICROWAVE_TURRET_CONE_ANGLE, 16, ( 0.95, 0.1, 0.1 ), 0.3, true, debug_line_frames );
468 }
469 
470 
471 function ‪TurretThink()
472 {
473  turret = self;
474  turret endon( "microwave_turret_shutdown" );
475 
476  turret.trigger endon( "death" );
477  turret.trigger endon( "delete" );
478 
479  turret.turret_vehicle_entnum = turret.vehicle GetEntityNumber();
480 
481  while( true )
482  {
483  turret.trigger waittill( "trigger", ent );
484 
485  if ( ent == turret )
486  continue;
487 
488  if ( !isdefined( ent.beingMicrowavedBy ) )
489  {
490  ent.beingMicrowavedBy = [];
491  }
492 
493  if( !isdefined( ent.beingMicrowavedBy[ turret.turret_vehicle_entnum ] ) )
494  {
495  turret thread ‪MicrowaveEntity( ent );
496  }
497  }
498 }
499 
501 {
502  entity endon( "disconnect" );
503  entity endon( "end_MicrowaveEntityPostShutdownCleanup" );
504 
505  turret = self;
506 
507  turret_vehicle_entnum = turret.turret_vehicle_entnum;
508 
509  turret waittill( "microwave_turret_shutdown" );
510 
511  if ( isdefined(entity) )
512  {
513  if ( isdefined( entity.beingMicrowavedBy ) && isdefined( entity.beingMicrowavedBy[ turret_vehicle_entnum ] ) )
514  {
515  entity.beingMicrowavedBy[ turret_vehicle_entnum ] = undefined;
516  }
517  }
518 }
519 
520 function ‪MicrowaveEntity( entity )
521 {
522  turret = self;
523 
524  turret endon( "microwave_turret_shutdown" );
525  entity endon( "disconnect" );
526  entity endon( "death" );
527 
528  if ( IsPlayer( entity ) )
529  {
530  entity endon( "joined_team" );
531  entity endon( "joined_spectators" );
532  }
533 
534  turret thread ‪MicrowaveEntityPostShutdownCleanup( entity );
535 
536  entity.beingMicrowavedBy[ turret.turret_vehicle_entnum ] = turret.owner;
537  entity.microwaveDamageInitialDelay = true;
538  entity.microwaveEffect = 0;
539 
540  shellShockScalar = 1;
541  viewKickScalar = 1;
542  damageScalar = 1;
543 
544  if ( IsPlayer( entity ) && entity hasPerk( "specialty_microwaveprotection" ) )
545  {
546  shellShockScalar = getDvarFloat( "specialty_microwaveprotection_shellshock_scalar", 0.5 );
547  viewKickScalar = getDvarFloat( "specialty_microwaveprotection_viewkick_scalar", 0.5 );
548  damageScalar = getDvarFloat( "specialty_microwaveprotection_damage_scalar", 0.5 );
549  }
550 
551  turretWeapon = GetWeapon( "microwave_turret" );
552 
553  while( true )
554  {
555  if( !isdefined( turret ) || !turret ‪MicrowaveTurretAffectsEntity( entity ) || !isdefined( turret.trigger ) )
556  {
557  if( !isdefined(entity))
558  {
559  return;
560  }
561 
562  entity.beingMicrowavedBy[ turret.turret_vehicle_entnum ] = undefined;
563 
564  if( isdefined( entity.microwavePoisoning ) && entity.microwavePoisoning )
565  {
566  entity.microwavePoisoning = false;
567  }
568 
569  entity notify( "end_MicrowaveEntityPostShutdownCleanup" );
570 
571  return;
572  }
573 
574  ‪damage = ‪MICROWAVE_TURRET_DAMAGE * damageScalar;
575 
576  if ( level.hardcoreMode )
577  {
578  ‪damage = ‪damage / 2;
579  }
580 
581  if ( !IsAi( entity ) && entity ‪util::mayApplyScreenEffect() )
582  {
583  if ( !isdefined( entity.microwavePoisoning ) || !entity.microwavePoisoning )
584  {
585  entity.microwavePoisoning = true;
586  entity.microwaveEffect = 0;
587  }
588  }
589 
590  // randomly wait a bit before applying intial damage to "stagger" it and prevent performance spikes
591  if ( isdefined( entity.microwaveDamageInitialDelay ) )
592  {
594  entity.microwaveDamageInitialDelay = undefined;
595  }
596 
597  entity DoDamage( ‪damage, // iDamage Integer specifying the amount of damage done
598  turret.origin, // vPoint The point the damage is from?
599  turret.owner, // eAttacker The entity that is attacking.
600  turret.vehicle, // eInflictor The entity that causes the damage.(e.g. a turret)
601  0,
602  "MOD_TRIGGER_HURT", // sMeansOfDeath Integer specifying the method of death
603  0, // iDFlags Integer specifying flags that are to be applied to the damage
604  turretWeapon ); // Weapon The weapon used to inflict the damage
605 
606  entity.microwaveEffect++;
607  entity.lastMicrowavedBy = turret.owner;
608  time = GetTime();
609 
610  if( IsPlayer(entity) && !(entity IsRemoteControlling() ) )
611  {
612  if ( time - ‪VAL( entity.microwaveShellshockAndViewKickTime, 0 ) > 950 ) // the time here ties in with the wait 0.5 below and the microwaveEffect % 2
613  {
614  if( entity.microwaveEffect % 2 == 1 )
615  {
616  if ( DistanceSquared( entity.origin, turret.origin ) > (‪MICROWAVE_TURRET_RADIUS * 2/3) * (‪MICROWAVE_TURRET_RADIUS * 2/3) )
617  {
618  entity shellshock( "mp_radiation_low", 1.5 * shellShockScalar );
619  entity ViewKick( int( 25 * viewKickScalar ), turret.origin );
620  }
621  else if ( DistanceSquared( entity.origin, turret.origin ) > (‪MICROWAVE_TURRET_RADIUS * 1/3) * (‪MICROWAVE_TURRET_RADIUS * 1/3) )
622  {
623  entity shellshock( "mp_radiation_med", 1.5 * shellShockScalar );
624  entity ViewKick( int( 50 * viewKickScalar ), turret.origin );
625  }
626  else
627  {
628  entity shellshock( "mp_radiation_high", 1.5 * shellShockScalar );
629  entity ViewKick( int( 75 * viewKickScalar ), turret.origin );
630  }
631 
632  entity.microwaveShellshockAndViewKickTime = time;
633  }
634  }
635  }
636 
637  if( IsPlayer( entity ) && entity.microwaveEffect % 3 == 2 )
638  {
639  ‪scoreevents::processScoreEvent( "hpm_suppress", turret.owner, entity, turretWeapon );
640  }
641 
642  wait 0.5;
643  }
644 }
645 
647 {
648  turret = self;
649 
650  if( !IsAlive( entity ) )
651  {
652  return false;
653  }
654 
655  if( !IsPlayer( entity ) && !IsAi( entity ) )
656  {
657  return false;
658  }
659 
660  if ( entity.ignoreme === true )
661  {
662  return false;
663  }
664 
665 
666  if( isdefined( turret.carried ) && turret.carried )
667  {
668  return false;
669  }
670 
671  if( turret ‪weaponobjects::isStunned() )
672  {
673  return false;
674  }
675 
676  if( isdefined( turret.owner ) && entity == turret.owner )
677  {
678  return false;
679  }
680 
681  if( !‪weaponobjects::friendlyFireCheck( turret.owner, entity, 0 ) )
682  {
683  return false;
684  }
685 
686  if( DistanceSquared( entity.origin, turret.origin ) > ‪MICROWAVE_TURRET_RADIUS * ‪MICROWAVE_TURRET_RADIUS )
687  {
688  return false;
689  }
690 
691  angles = turret.vehicle GetTagAngles( "tag_flash" );
692  origin = turret.vehicle GetTagOrigin( "tag_flash" );
693 
694  shoot_at_pos = entity GetShootAtPos( turret );
695 
696  entDirection = vectornormalize( shoot_at_pos - origin );
697  forward = AnglesToForward( angles ) ;
698  dot = vectorDot( entDirection, forward );
699  if( dot < cos( ‪MICROWAVE_TURRET_CONE_ANGLE ) )
700  {
701  return false;
702  }
703 
704  if( entity damageConeTrace( origin, turret, forward ) <= 0 )
705  {
706  return false;
707  }
708 
709  return true;
710 }
‪processScoreEvent
‪function processScoreEvent(event, player, victim, weapon)
Definition: scoreevents_shared.gsc:19
‪enable
‪function enable(handler)
Definition: _perplayer.gsc:54
‪StopMicrowave
‪function StopMicrowave()
Definition: _microwave_turret.gsc:398
‪GhostAfterWait
‪function GhostAfterWait(wait_time)
Definition: _microwave_turret.gsc:263
‪OnTurretDeath
‪function OnTurretDeath(eInflictor, eAttacker, iDamage, sMeansOfDeath, weapon, vDir, sHitLoc, psOffsetTime)
Definition: _microwave_turret.gsc:286
‪on_player_spawned
‪function on_player_spawned()
Definition: _microwave_turret.gsc:132
‪ForceShutdown
‪function ForceShutdown()
Definition: _placeables.gsc:455
‪set_max_target_distance
‪function set_max_target_distance(n_distance, n_index)
Definition: turret_shared.gsc:842
‪MICROWAVE_TURRET_INVALID_PLACEMENT_MODEL
‪#define MICROWAVE_TURRET_INVALID_PLACEMENT_MODEL
Definition: _killstreaks.gsh:42
‪MICROWAVE_TURRET_PICKUP_TEXT
‪#define MICROWAVE_TURRET_PICKUP_TEXT
Definition: _killstreaks.gsh:43
‪connect_paths
‪function connect_paths()
Definition: vehicle_shared.gsc:3592
‪MICROWAVE_TURRET_VALID_PLACEMENT_MODEL
‪#define MICROWAVE_TURRET_VALID_PLACEMENT_MODEL
Definition: _killstreaks.gsh:41
‪MICROWAVE_TURRET_CONE_ANGLE
‪#define MICROWAVE_TURRET_CONE_ANGLE
Definition: _killstreaks.gsh:49
‪MICROWAVE_TURRET_EMP_DAMAGE
‪#define MICROWAVE_TURRET_EMP_DAMAGE
Definition: _killstreaks.gsh:51
‪MICROWAVE_TURRET_INITIAL_DAMAGE_DELAY_MAX
‪#define MICROWAVE_TURRET_INITIAL_DAMAGE_DELAY_MAX
Definition: _killstreaks.gsh:56
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪waittill_any_return
‪function waittill_any_return(string1, string2, string3, string4, string5, string6, string7)
Definition: util_shared.csc:212
‪play_killstreak_start_dialog
‪function play_killstreak_start_dialog(killstreakType, team, killstreakId)
Definition: _killstreaks.gsc:1905
‪destroyScoreStreak
‪function destroyScoreStreak(weapon, playerControlled, groundBased, countAsKillstreakVehicle=true)
Definition: challenges_shared.gsc:784
‪TurretDebug
‪function TurretDebug()
Definition: _microwave_turret.gsc:454
‪VAL
‪#define VAL(__var, __default)
Definition: shared.gsh:272
‪OnDamagePerWeapon
‪function OnDamagePerWeapon(killstreak_ref, attacker, damage, flags, type, weapon, max_health, destroyed_callback, low_health, low_health_callback, emp_damage, emp_callback, allow_bullet_damage, chargeLevel)
Definition: _killstreaks.gsc:2667
‪ENEMY_VEHICLE_ACTIVE
‪#define ENEMY_VEHICLE_ACTIVE
Definition: _hacker_tool.gsh:2
‪MICROWAVE_TURRET_RADIUS
‪#define MICROWAVE_TURRET_RADIUS
Definition: _killstreaks.gsh:48
‪MICROWAVE_TURRET_MODEL
‪#define MICROWAVE_TURRET_MODEL
Definition: _killstreaks.gsh:40
‪TURRET_EMP_DAMAGE_PERCENTAGE
‪#define TURRET_EMP_DAMAGE_PERCENTAGE
Definition: _killstreaks.gsh:34
‪spawn
‪function spawn(v_origin=(0, 0, 0), v_angles=(0, 0, 0))
Definition: struct.csc:23
‪set_team
‪function set_team(str_team, n_index)
Definition: turret_shared.gsc:371
‪set_on_target_angle
‪function set_on_target_angle(n_angle, n_index)
Definition: turret_shared.gsc:643
‪disable
‪function disable(handler)
Definition: _perplayer.gsc:79
‪DisplayKillstreakTeamMessageToAll
‪function DisplayKillstreakTeamMessageToAll(killstreak, player)
Definition: popups_shared.gsc:91
‪TurretDebugWatch
‪function TurretDebugWatch()
Definition: _microwave_turret.gsc:434
‪OnPickupTurret
‪function OnPickupTurret(turret)
Definition: _microwave_turret.gsc:249
‪IsEnemyPlayer
‪function IsEnemyPlayer(player)
Definition: util_shared.csc:1220
‪MICROWAVE_TURRET_WEAPON_NAME
‪#define MICROWAVE_TURRET_WEAPON_NAME
Definition: _microwave_turret.gsc:75
‪MICROWAVE_TURRET_ON_TARGET_ANGLE
‪#define MICROWAVE_TURRET_ON_TARGET_ANGLE
Definition: _microwave_turret.gsc:76
‪SpawnPlaceable
‪function SpawnPlaceable(killstreakRef, killstreakId, onPlaceCallback, onCancelCallback, onMoveCallback, onShutdownCallback, onDeathCallback, onEmpCallback, model, validModel, invalidModel, spawnsVehicle, pickupString, timeout, health, empDamage, placeHintString, invalidLocationHintString)
Definition: _placeables.gsc:20
‪MicrowaveEntity
‪function MicrowaveEntity(entity)
Definition: _microwave_turret.gsc:520
‪damage
‪function damage(trap)
Definition: _zm_trap_electric.gsc:116
‪WatchKillstreakEnd
‪function WatchKillstreakEnd(killstreak_id, team)
Definition: _microwave_turret.gsc:363
‪OnShutdown
‪function OnShutdown(turret)
Definition: _microwave_turret.gsc:350
‪on_spawned
‪function on_spawned(func, obj)
Definition: callbacks_shared.csc:245
‪MICROWAVE_TURRET_DELETE_ON_DEATH_DELAY
‪#define MICROWAVE_TURRET_DELETE_ON_DEATH_DELAY
Definition: _microwave_turret.gsc:77
‪StartMicrowave
‪function StartMicrowave()
Definition: _microwave_turret.gsc:372
‪OnCancelPlacement
‪function OnCancelPlacement(turret)
Definition: _microwave_turret.gsc:244
‪play_destroyed_dialog_on_owner
‪function play_destroyed_dialog_on_owner(killstreakType, killstreakId)
Definition: _killstreaks.gsc:1982
‪isStunned
‪function isStunned()
Definition: util_shared.gsc:813
‪debug_spherical_cone
‪function debug_spherical_cone(origin, domeApex, angle, slices, color, alpha, depthTest, duration)
Definition: util_shared.gsc:185
‪OnTurretDeathPostGame
‪function OnTurretDeathPostGame(eInflictor, eAttacker, iDamage, sMeansOfDeath, weapon, vDir, sHitLoc, psOffsetTime)
Definition: _microwave_turret.gsc:329
‪death_fx
‪function death_fx()
Definition: _qrdrone.gsc:958
‪ghost_wait_show
‪function ghost_wait_show(wait_time=0.1)
Definition: _util.gsc:916
‪reset_being_microwaved
‪function reset_being_microwaved()
Definition: _microwave_turret.gsc:143
‪ghost_wait_show_to_player
‪function ghost_wait_show_to_player(player, wait_time=0.1, self_endon_string1)
Definition: _util.gsc:937
‪remove_influencers
‪function remove_influencers()
Definition: _spawning.gsc:405
‪MicrowaveEntityPostShutdownCleanup
‪function MicrowaveEntityPostShutdownCleanup(entity)
Definition: _microwave_turret.gsc:500
‪register_dialog
‪function register_dialog(killstreakType, informDialog, taacomDialogBundleKey, pilotDialogArrayKey, startDialogKey, enemyStartDialogKey, enemyStartMultipleDialogKey, hackedDialogKey, hackedStartDialogKey, requestDialogKey, threatDialogKey, isInventory)
Definition: _killstreaks.gsc:239
‪INVALID_KILLSTREAK_ID
‪#define INVALID_KILLSTREAK_ID
Definition: _killstreaks.gsh:2
‪OnEMP
‪function OnEMP(attacker)
Definition: _microwave_turret.gsc:271
‪HackedPreFunction
‪function HackedPreFunction(hacker)
Definition: _microwave_turret.gsc:230
‪InitTurretVehicle
‪function InitTurretVehicle()
Definition: _microwave_turret.gsc:110
‪register_strings
‪function register_strings(killstreakType, receivedText, notUsableText, inboundText, inboundNearPlayerText, hackedText, utilizesAirspace=true, isInventory=false)
Definition: _killstreaks.gsc:223
‪killstreakStop
‪function killstreakStop(hardpointType, team, id)
Definition: _killstreakrules.gsc:293
‪setup_health
‪function setup_health(killstreak_ref, max_health, low_health)
Definition: _killstreaks.gsc:2466
‪OnTurretDamage
‪function OnTurretDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, weapon, vPoint, vDir, sHitLoc, vDamageOrigin, psOffsetTime, damageFromUnderneath, modelIndex, partName, vSurfaceNormal)
Definition: _microwave_turret.gsc:277
‪OnPlaceTurret
‪function OnPlaceTurret(turret)
Definition: _microwave_turret.gsc:185
‪killstreakStart
‪function killstreakStart(hardpointType, team, hacked, displayTeamMessage)
Definition: _killstreakrules.gsc:184
‪on_vehicle_spawned
‪function on_vehicle_spawned()
Definition: _microwave_turret.gsc:138
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪MICROWAVE_TURRET_INITIAL_DAMAGE_DELAY_MIN
‪#define MICROWAVE_TURRET_INITIAL_DAMAGE_DELAY_MIN
Definition: _killstreaks.gsh:57
‪configure_team
‪function configure_team(killstreakType, killstreakId, owner, influencerType, configureTeamPreFunction, configureTeamPostFunction, isHacked=false)
Definition: _killstreaks.gsc:2806
‪TurretThink
‪function TurretThink()
Definition: _microwave_turret.gsc:471
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪init
‪function init()
Definition: _microwave_turret.gsc:90
‪CreateTurretInfluencer
‪function CreateTurretInfluencer(name)
Definition: _turret.gsc:458
‪play_taacom_dialog
‪function play_taacom_dialog(dialogKey, killstreakType, killstreakId)
Definition: _globallogic_audio.gsc:274
‪MICROWAVE_TURRET_DAMAGE
‪#define MICROWAVE_TURRET_DAMAGE
Definition: _killstreaks.gsh:50
‪register_remote_override_weapon
‪function register_remote_override_weapon(killstreakType, weaponName, isInventory)
Definition: _killstreaks.gsc:349
‪ActivateMicrowaveTurret
‪function ActivateMicrowaveTurret()
Definition: _microwave_turret.gsc:149
‪enable_hacking
‪function enable_hacking(killstreakName, preHackFunction, postHackFunction)
Definition: _killstreak_hacking.gsc:22
‪HackedPostFunction
‪function HackedPostFunction(hacker)
Definition: _microwave_turret.gsc:238
‪destroyNonAirScoreStreak_PostStatsLock
‪function destroyNonAirScoreStreak_PostStatsLock(weapon)
Definition: challenges_shared.gsc:126
‪disconnect_paths
‪function disconnect_paths(detail_level=2, move_allowed=true)
Definition: vehicle_shared.gsc:3580
‪mayApplyScreenEffect
‪function mayApplyScreenEffect()
Definition: util_shared.gsc:2613
‪friendlyFireCheck
‪function friendlyFireCheck(owner, attacker, forcedFriendlyFireRule)
Definition: _weaponobjects.gsc:2733
‪MICROWAVE_TURRET_DURATION
‪#define MICROWAVE_TURRET_DURATION
Definition: _killstreaks.gsh:44
‪MicrowaveTurretAffectsEntity
‪function MicrowaveTurretAffectsEntity(entity)
Definition: _microwave_turret.gsc:646
‪MICROWAVE_TURRET_NAME
‪#define MICROWAVE_TURRET_NAME
Definition: _microwave_turret.gsc:74
‪MICROWAVE_TURRET_VEHICLE_NAME
‪#define MICROWAVE_TURRET_VEHICLE_NAME
Definition: _killstreaks.gsh:39
‪ghost_wait_show_to_others
‪function ghost_wait_show_to_others(player, wait_time=0.1, self_endon_string1)
Definition: _util.gsc:977
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265