‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_weap_thundergun.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\util_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 
9 #using scripts\zm\_zm_weapons;
10 
11 #insert scripts\zm\_zm_weap_thundergun.gsh;
12 
13 #namespace zm_weap_thundergun;
14 
15 ‪REGISTER_SYSTEM_EX( "zm_weap_thundergun", &‪__init__, &‪__main__, undefined )
16 
17 function ‪__init__()
18 {
19  level.weaponZMThunderGun = GetWeapon( "thundergun" );
20  level.weaponZMThunderGunUpgraded = GetWeapon( "thundergun_upgraded" );
21 }
22 
23 function ‪__main__()
24 {
26 }
27 
28 
29 function ‪localplayer_spawned( localClientNum )
30 {
31  self thread ‪watch_for_thunderguns( localClientNum );
32 }
33 
34 
35 function ‪watch_for_thunderguns( localclientnum )
36 {
37  self endon( "disconnect" );
38  self notify( "watch_for_thunderguns" );
39  self endon( "watch_for_thunderguns" );
40 
41  while( isdefined(self) )
42  {
43  self waittill( "weapon_change", w_new_weapon, w_old_weapon );
44  if ( w_new_weapon == level.weaponZMThunderGun || w_new_weapon == level.weaponZMThunderGunUpgraded )
45  {
46  self thread ‪thundergun_fx_power_cell( localclientnum, w_new_weapon );
47  }
48  }
49 }
50 
51 
52 function ‪thundergun_fx_power_cell( localclientnum, w_weapon )
53 {
54  self endon( "disconnect" );
55  self endon( "weapon_change" );
56  self endon( "entityshutdown" );
57 
58  n_old_ammo = -1;
59  n_shader_val = 0; // 0 == 4 lights, 1 == 3 lights, 2 == 2 lights, 3 == 1 light
60  const N_LIGHTS = 4;
61 
62  while ( true )
63  {
64  wait 0.1;
65 
66  if (!isdefined(self))
67  {
68  return;
69  }
70 
71  n_ammo = GetWeaponAmmoClip( localclientnum, w_weapon );
72  if ( n_old_ammo > 0 && n_old_ammo != n_ammo )
73  {
74  ‪thundergun_fx_fire( localclientnum );
75  }
76  n_old_ammo = n_ammo;
77 
78  // Ammo Counter indicator
79  if ( n_ammo == 0 )
80  {
81  self MapShaderConstant( localClientNum, 0, "scriptVector2", 0, 0, 0, 0 );
82  }
83  else
84  {
85  n_shader_val = N_LIGHTS - n_ammo;
86  self MapShaderConstant( localClientNum, 0, "scriptVector2", 0, 1, n_shader_val, 0 );
87  }
88  }
89 }
90 
91 
92 function ‪thundergun_fx_fire( localclientnum )
93 {
94  playsound(localclientnum,"wpn_thunder_breath", (0,0,0));
95 }
‪__init__
‪function __init__()
Definition: _zm_weap_thundergun.csc:17
‪on_localplayer_spawned
‪function on_localplayer_spawned(local_client_num)
Definition: _perks.csc:109
‪watch_for_thunderguns
‪function watch_for_thunderguns(localclientnum)
Definition: _zm_weap_thundergun.csc:35
‪thundergun_fx_power_cell
‪function thundergun_fx_power_cell(localclientnum, w_weapon)
Definition: _zm_weap_thundergun.csc:52
‪localplayer_spawned
‪function localplayer_spawned(localClientNum)
Definition: _zm_weap_thundergun.csc:29
‪thundergun_fx_fire
‪function thundergun_fx_fire(localclientnum)
Definition: _zm_weap_thundergun.csc:92
‪REGISTER_SYSTEM_EX
‪#define REGISTER_SYSTEM_EX(__sys, __func_init_preload, __func_init_postload, __reqs)
Definition: shared.gsh:209
‪__main__
‪function __main__()
Definition: _zm_weap_thundergun.csc:23