‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_satchel_charge.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\scoreevents_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\weapons\_weaponobjects;
9 
10 #insert scripts\shared\shared.gsh;
11 
12 #precache( "fx", "weapon/fx_c4_light_orng" );
13 #precache( "fx", "weapon/fx_c4_light_blue" );
14 
15 #namespace satchel_charge;
16 
17 function ‪init_shared()
18 {
19  level._effect["satchel_charge_enemy_light"] = "weapon/fx_c4_light_orng";
20  level._effect["satchel_charge_friendly_light"] = "weapon/fx_c4_light_blue";
21 
23 }
24 
26 {
27  watcher = self ‪weaponobjects::createUseWeaponObjectWatcher( "satchel_charge", self.team );
28  watcher.altDetonate = true;
29  watcher.watchForFire = true;
30  watcher.hackable = true;
31  watcher.hackerToolRadius = level.equipmentHackerToolRadius;
32  watcher.hackerToolTimeMs = level.equipmentHackerToolTimeMs;
33  watcher.headIcon = false;
34  watcher.onDetonateCallback =&‪satchelDetonate;
35  watcher.onSpawn =&‪satchelSpawn;
36  watcher.onStun = &‪weaponobjects::weaponStun;
37  watcher.stunTime = 1;
38  watcher.altWeapon = GetWeapon( "satchel_charge_detonator" );
39  watcher.ownerGetsAssist = true;
40  watcher.detonateStationary = true;
41  watcher.detonationDelay = GetDvarFloat( "scr_satchel_detonation_delay", 0.0 );
42  watcher.detonationSound = "wpn_claymore_alert";
43  watcher.proximityAlarmActivateSound = "uin_c4_enemy_detection_alert";
44  watcher.immunespecialty = "specialty_immunetriggerc4";
45 }
46 
47 function ‪satchelDetonate( attacker, weapon, target )
48 {
49  if ( IsDefined( weapon ) && weapon.isValid )
50  {
51  if ( isdefined( attacker ) )
52  {
53  if ( self.owner ‪util::IsEnemyPlayer( attacker ) )
54  {
55  attacker ‪challenges::destroyedExplosive( weapon );
56  ‪scoreevents::processScoreEvent( "destroyed_c4", attacker, self.owner, weapon );
57  }
58  }
59  }
60 
61  ‪weaponobjects::weaponDetonate( attacker, weapon );
62 }
63 
64 function ‪satchelSpawn( watcher, owner )
65 {
66  self endon( "death" );
67 
68  self thread ‪weaponobjects::onSpawnUseWeaponObject( watcher, owner );
69 
70  if( !‪IS_TRUE( self.previouslyHacked ) )
71  {
72  if ( IsDefined( owner ) )
73  {
74  owner AddWeaponStat( self.weapon, "used", 1 );
75  }
76 
77  self playloopsound( "uin_c4_air_alarm_loop" );
78 
79  self ‪util::waittill_notify_or_timeout( "stationary", 10 );
80  delayTimeSec = self.weapon.proximityalarmactivationdelay / 1000;
81 
82  if ( delayTimeSec > 0 )
83  {
84  wait( delayTimeSec );
85  }
86  self stoploopsound( 0.1 );
87  }
88 }
‪processScoreEvent
‪function processScoreEvent(event, player, victim, weapon)
Definition: scoreevents_shared.gsc:19
‪onSpawnUseWeaponObject
‪function onSpawnUseWeaponObject(watcher, owner)
Definition: _weaponobjects.gsc:1597
‪weaponStun
‪function weaponStun()
Definition: _weaponobjects.gsc:1128
‪destroyedExplosive
‪function destroyedExplosive(weapon)
Definition: challenges_shared.gsc:951
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪IsEnemyPlayer
‪function IsEnemyPlayer(player)
Definition: util_shared.csc:1220
‪createSatchelWatcher
‪function createSatchelWatcher()
Definition: _satchel_charge.gsc:25
‪waittill_notify_or_timeout
‪function waittill_notify_or_timeout(msg, timer)
Definition: util_shared.csc:473
‪add_weapon_watcher
‪function add_weapon_watcher(callback)
Definition: callbacks_shared.gsc:609
‪satchelSpawn
‪function satchelSpawn(watcher, owner)
Definition: _satchel_charge.gsc:64
‪createUseWeaponObjectWatcher
‪function createUseWeaponObjectWatcher(weaponname, ownerTeam)
Definition: _weaponobjects.gsc:1297
‪init_shared
‪function init_shared()
Definition: _satchel_charge.gsc:17
‪weaponDetonate
‪function weaponDetonate(attacker, weapon)
Definition: _weaponobjects.gsc:563
‪satchelDetonate
‪function satchelDetonate(attacker, weapon, target)
Definition: _satchel_charge.gsc:47