‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_gadget_active_camo.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 #using scripts\shared\callbacks_shared;
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\flagsys_shared;
5 #using scripts\shared\abilities\_ability_gadgets;
6 #using scripts\shared\abilities\_ability_player;
7 #using scripts\shared\abilities\_ability_util;
8 
9 #insert scripts\shared\shared.gsh;
10 #insert scripts\shared\version.gsh;
11 #insert scripts\shared\abilities\_ability_util.gsh;
12 
13 #using scripts\shared\system_shared;
14 
15 ‪REGISTER_SYSTEM( "gadget_active_camo", &‪__init__, undefined )
16 
17 function ‪__init__()
18 {
24 
25  //clientfield::register( "allplayers", "camo_shader", VERSION_SHIP, 3, "int" ); //already registered in _gadget_camo
29 }
31 {
32  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
33  {
34  self [[level.cybercom.active_camo._on_connect]]();
35  }
36 }
38 {
39  /*if ( IsDefined( self.active_camo_sound_ent ) )
40  {
41  self.active_camo_sound_ent stoploopsound( .05 );
42  self.active_camo_sound_ent delete();
43  }*/
44 }
45 function ‪camo_on_spawn()
46 {
47  self ‪flagsys::clear( "camo_suit_on" );
48  self notify( "camo_off" );
49  self ‪clientfield::set( "camo_shader", ‪GADGET_CAMO_SHADER_OFF );
50  /*if ( IsDefined( self.active_camo_sound_ent ) )
51  {
52  self.active_camo_sound_ent stoploopsound( .05 );
53  self.active_camo_sound_ent delete();
54  }*/
55 }
56 
57 
58 function ‪camo_is_inuse( slot )
59 {
60  return self ‪flagsys::get( "camo_suit_on" );
61 }
62 
63 function ‪camo_is_flickering( slot )
64 {
65  // returns true when the gadget is flickering
66  return self GadgetFlickering( slot );
67 }
68 
69 function ‪camo_on_give( slot, weapon )
70 {
71  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
72  {
73  self [[level.cybercom.active_camo._on_give]](slot, weapon);
74  }
75 }
76 
77 function ‪camo_on_take( slot, weapon )
78 {
79  self notify( "camo_removed" );
80  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
81  {
82  self [[level.cybercom.active_camo._on_take]](slot, weapon);
83  }
84 }
85 
86 function ‪camo_on_flicker( slot, weapon )
87 {
88  self thread ‪suspend_camo_suit( slot, weapon );
89  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
90  {
91  self thread [[level.cybercom.active_camo._on_flicker]](slot, weapon);
92  }
93 }
94 
95 function ‪camo_gadget_on( slot, weapon )
96 {
97  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
98  {
99  self thread [[level.cybercom.active_camo._on]](slot, weapon);
100  }
101  else
102  {
103  self ‪clientfield::set( "camo_shader", ‪GADGET_CAMO_SHADER_ON );
104  }
105  self ‪flagsys::set( "camo_suit_on" );
106  //self thread camo_loop_audio();
107 }
108 
109 function ‪camo_gadget_off( slot, weapon )
110 {
111  self ‪flagsys::clear( "camo_suit_on" );
112  if(isDefined(level.cybercom) && isDefined(level.cybercom.active_camo))
113  {
114  self thread [[level.cybercom.active_camo._off]](slot, weapon);
115  }
116  /*if ( IsDefined( self.active_camo_sound_ent ) )
117  {
118  self.active_camo_sound_ent PlaySound( "gdt_camo_suit_off");
119  self.active_camo_sound_ent delete();
120  }*/
121  self notify( "camo_off" );
122  self ‪clientfield::set( "camo_shader", ‪GADGET_CAMO_SHADER_OFF );
123 }
124 
125 
126 function ‪suspend_camo_suit( slot, weapon )
127 {
128  self endon( "disconnect" );
129  self endon( "camo_off" );
130 
131  self ‪clientfield::set( "camo_shader", ‪GADGET_CAMO_SHADER_FLICKER );
132 
133  ‪suspend_camo_suit_wait( slot, weapon );
134 
135  if ( self ‪camo_is_inuse( slot ) )
136  {
137  self ‪clientfield::set( "camo_shader", ‪GADGET_CAMO_SHADER_ON );
138  }
139 }
140 
141 function ‪suspend_camo_suit_wait( slot, weapon )
142 {
143  self endon( "death" );
144  self endon( "camo_off" );
145 
146  while ( self ‪camo_is_flickering( slot ) )
147  {
148  wait 0.5;
149  }
150 }
151 
152 /*function camo_loop_audio()
153 {
154  if ( IsDefined( self.active_camo_sound_ent ) )
155  {
156  self.active_camo_sound_ent stoploopsound( .05 );
157  self.active_camo_sound_ent delete();
158  }
159  self.active_camo_sound_ent = Spawn( "script_origin", self.origin );
160  self.active_camo_sound_ent linkto( self );
161  self playsound ("gdt_camo_suit_on");
162  wait .5;
163 
164  if ( IsDefined( self.active_camo_sound_ent ) )
165  {
166  self.active_camo_sound_ent PlayLoopSound( "gdt_camo_suit_loop" , .1 );
167  }
168 }
169 */
‪register_gadget_is_flickering_callbacks
‪function register_gadget_is_flickering_callbacks(type, flickering_func)
Definition: _ability_player.gsc:299
‪camo_is_flickering
‪function camo_is_flickering(slot)
Definition: _gadget_active_camo.gsc:63
‪GADGET_CAMO_SHADER_OFF
‪#define GADGET_CAMO_SHADER_OFF
Definition: _ability_util.gsh:54
‪GADGET_TYPE_ACTIVE_CAMO
‪#define GADGET_TYPE_ACTIVE_CAMO
Definition: _ability_util.gsh:36
‪register_gadget_possession_callbacks
‪function register_gadget_possession_callbacks(type, on_give, on_take)
Definition: _ability_player.gsc:221
‪GADGET_CAMO_SHADER_ON
‪#define GADGET_CAMO_SHADER_ON
Definition: _ability_util.gsh:55
‪clear
‪function clear(str_flag)
Definition: flag_shared.csc:130
‪register_gadget_is_inuse_callbacks
‪function register_gadget_is_inuse_callbacks(type, inuse_func)
Definition: _ability_player.gsc:289
‪GADGET_CAMO_SHADER_FLICKER
‪#define GADGET_CAMO_SHADER_FLICKER
Definition: _ability_util.gsh:56
‪camo_on_spawn
‪function camo_on_spawn()
Definition: _gadget_active_camo.gsc:45
‪on_disconnect
‪function on_disconnect()
Definition: _wager.gsc:88
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪camo_is_inuse
‪function camo_is_inuse(slot)
Definition: _gadget_active_camo.gsc:58
‪register_gadget_flicker_callbacks
‪function register_gadget_flicker_callbacks(type, on_flicker)
Definition: _ability_player.gsc:253
‪suspend_camo_suit
‪function suspend_camo_suit(slot, weapon)
Definition: _gadget_active_camo.gsc:126
‪camo_on_flicker
‪function camo_on_flicker(slot, weapon)
Definition: _gadget_active_camo.gsc:86
‪on_spawned
‪function on_spawned(func, obj)
Definition: callbacks_shared.csc:245
‪suspend_camo_suit_wait
‪function suspend_camo_suit_wait(slot, weapon)
Definition: _gadget_active_camo.gsc:141
‪register_gadget_activation_callbacks
‪function register_gadget_activation_callbacks(type, turn_on, turn_off)
Definition: _ability_player.gsc:237
‪camo_gadget_on
‪function camo_gadget_on(slot, weapon)
Definition: _gadget_active_camo.gsc:95
‪__init__
‪function __init__()
Definition: _gadget_active_camo.gsc:17
‪camo_on_disconnect
‪function camo_on_disconnect()
Definition: _gadget_active_camo.gsc:37
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪camo_on_connect
‪function camo_on_connect()
Definition: _gadget_active_camo.gsc:30
‪camo_gadget_off
‪function camo_gadget_off(slot, weapon)
Definition: _gadget_active_camo.gsc:109
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪camo_on_take
‪function camo_on_take(slot, weapon)
Definition: _gadget_active_camo.gsc:77
‪on_connect
‪function on_connect()
Definition: _arena.gsc:20
‪camo_on_give
‪function camo_on_give(slot, weapon)
Definition: _gadget_active_camo.gsc:69