‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_hive_gun.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\system_shared;
6 #using scripts\shared\util_shared;
7 #using scripts\shared\visionset_mgr_shared;
8 #using scripts\shared\ai\systems\gib;
9 
10 #using scripts\shared\weapons\_weaponobjects;
11 
12 #insert scripts\shared\shared.gsh;
13 #insert scripts\shared\version.gsh;
14 
15 #insert scripts\shared\ai\systems\gib.gsh;
16 #insert scripts\shared\weapons\_hive_gun.gsh;
17 
18 #namespace hive_gun;
19 
20 #precache( "client_fx", "weapon/fx_hero_firefly_hunting" );
21 #precache( "client_fx", "weapon/fx_hero_firefly_death" );
22 #precache( "client_fx", "weapon/fx_hero_firefly_attack" );
23 #precache( "client_fx", "weapon/fx_ability_firefly_attack_1p" );
24 #precache( "client_fx", "weapon/fx_ability_firefly_chase_1p" );
25 #precache( "client_fx", "weapon/fx_hero_firefly_attack_limb" );
26 #precache( "client_fx", "weapon/fx_hero_firefly_attack_limb_reaper" );
27 //#precache( "client_fx", "weapon/fx_hero_firefly_start" );
28 #precache( "client_fx", "weapon/fx_hero_firefly_start_entity" );
29 
30 function ‪init_shared()
31 {
32 // visionset_mgr::register_overlay_info_style_postfx_bundle( "hive_gungun_splat", VERSION_SHIP, 7, "pstfx_hive_gun_splat", hive_gun_SPLAT_DURATION_MAX );
33  level thread register();
34 }
35 
36 function register()
37 {
39 // clientfield::register( "scriptmover", "firefly_target", VERSION_SHIP, 6, "int",&firefly_target, !CF_HOST_ONLY, !CF_CALLBACK_ZERO_ON_NEW_ENT );
42 }
43 
44 function ‪getOtherTeam( team )
45 {
46  if ( team == "allies" )
47  return "axis";
48  else if ( team == "axis" )
49  return "allies";
50  else
51  return "free";
52 }
53 
54 function ‪fireflies_attacking( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
55 {
56  self endon("entityshutdown");
57  self ‪util::waittill_dobj( localClientNum );
58 
59  if ( !isdefined(self) )
60  return;
61 
62  if ( newVal )
63  {
64  self notify ( "stop_player_fx" );
65 
66  if ( self IsLocalPlayer() && !(self GetInKillcam( localClientNum )) )
67  {
68  fx = PlayFXOnCamera( localClientNum, "weapon/fx_ability_firefly_attack_1p", (0,0,0), (1,0,0), (0,0,1) );
69  self thread ‪watch_player_fx_finished( localClientNum, fx );
70  }
71  }
72  else
73  {
74  self notify ( "stop_player_fx" );
75  }
76 }
77 
78 function ‪fireflies_chasing( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
79 {
80  self endon("entityshutdown");
81  self ‪util::waittill_dobj( localClientNum );
82 
83  if ( !isdefined(self) )
84  return;
85 
86  if ( newVal )
87  {
88  self notify ( "stop_player_fx" );
89 
90  if ( self IsLocalPlayer() && !(self GetInKillcam( localClientNum )) )
91  {
92  fx = PlayFXOnCamera( localClientNum, "weapon/fx_ability_firefly_chase_1p", (0,0,0), (1,0,0), (0,0,1) );
93  sound = self PlayLoopSound("wpn_gelgun_hive_hunt_lp" );
94  self PlayRumbleLoopOnEntity( localClientNum, "firefly_chase_rumble_loop" );
95  self thread ‪watch_player_fx_finished( localClientNum, fx, sound );
96  }
97  }
98  else
99  {
100  self notify ( "stop_player_fx" );
101  }
102 }
103 
104 function ‪watch_player_fx_finished( localClientNum, fx, sound )
105 {
106  self ‪util::waittill_any( "entityshutdown", "stop_player_fx" );
107 
108  if( isDefined( self ) )
109  {
110  self StopRumble( localClientNum, "firefly_chase_rumble_loop" );
111  }
112 
113  if ( IsDefined( fx ) )
114  {
115  StopFx( localClientNum, fx );
116  }
117 
118  if ( isdefined( sound ) && isDefined( self ) )
119  {
120  self StopLoopSound( sound );
121  }
122 }
123 
124 function ‪firefly_state_change( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
125 {
126  self endon("entityshutdown");
127 
128  self ‪util::waittill_dobj( localClientNum );
129 
130  if ( !isdefined(self) )
131  return;
132 
133  if ( !isdefined( self.initied ) )
134  {
135  self thread ‪firefly_init( localClientNum );
136  self.initied = true;
137  }
138 
139  switch( newVal )
140  {
141  case ‪FIREFLY_INIT:
142  {
143  break;
144  }
146  {
147  self ‪firefly_deploying( localClientNum );
148  break;
149  }
150  case ‪FIREFLY_HUNTING:
151  {
152  self ‪firefly_hunting( localClientNum );
153  break;
154  }
156  {
157  self ‪firefly_attacking( localClientNum );
158  break;
159  }
161  {
162  self ‪firefly_link_attacking( localClientNum );
163  break;
164  }
165  }
166 }
167 
168 function ‪on_shutdown(localClientNum, ent)
169 {
170  if ( isdefined(ent) && isdefined(ent.origin) && self === ent && !‪IS_TRUE( self.no_death_fx ) )
171  {
172  fx = PlayFX( localClientNum,"weapon/fx_hero_firefly_death", ent.origin, (0,0,1) );
173  SetFXTeam( localClientNum, fx, ent.team );
174  }
175 }
176 
177 function ‪firefly_init( localClientNum )
178 {
180 }
181 
182 function ‪firefly_deploying( localClientNum )
183 {
184  fx = PlayFX( localClientNum, "weapon/fx_hero_firefly_start", self.origin, AnglesToUp(self.angles) );
185  SetFXTeam( localClientNum, fx, self.team );
186 }
187 
188 function ‪firefly_hunting( localClientNum )
189 {
190  fx = PlayFXOnTag( localClientNum, "weapon/fx_hero_firefly_hunting", self, "tag_origin");
191  SetFXTeam( localClientNum, fx, self.team );
192  self thread ‪firefly_watch_fx_finished( localClientNum, fx );
193 }
194 
195 function ‪firefly_watch_fx_finished( localClientNum, fx )
196 {
197  self ‪util::waittill_any( "entityshutdown", "stop_effects" );
198 
199  if ( isdefined( fx ) )
200  {
201  StopFx( localClientNum, fx );
202  }
203 }
204 
205 function ‪firefly_attacking( localClientNum )
206 {
207  self notify ( "stop_effects" );
208  self.no_death_fx = true;
209 }
210 
211 function ‪firefly_link_attacking( localClientNum )
212 {
213  fx = PlayFX( localClientNum, "weapon/fx_hero_firefly_start_entity", self.origin, AnglesToUp(self.angles) );
214  SetFXTeam( localClientNum, fx, self.team );
215 
216  self notify ( "stop_effects" );
217  self.no_death_fx = true;
218 }
219 
220 function ‪gib_fx( localClientNum, fxFileName, gibFlag )
221 {
222  fxTag = ‪GibClientUtils::PlayerGibTag( localClientNum, gibFlag );
223  if ( isdefined( fxTag ) )
224  {
225  fx = PlayFxOnTag( localClientNum, fxFileName, self, fxTag );
226  SetFXTeam( localClientNum, fx, ‪getOtherTeam( self.team ) );
227  }
228 }
229 
230 function ‪gib_corpse( localClientNum, value )
231 {
232  self endon("entityshutdown");
233 
234  self thread ‪watch_for_gib_notetracks( localClientNum );
235 }
236 
237 function ‪watch_for_gib_notetracks( localClientNum )
238 {
239  self endon("entityshutdown");
240 
242  return;
243 
244  fxFileName = "weapon/fx_hero_firefly_attack_limb";
245  bodyType = self GetCharacterBodyType();
246  if ( bodyType >= 0 )
247  {
248  bodyTypeFields = GetCharacterFields( bodyType, CurrentSessionMode() );
249  if( ‪VAL( bodyTypeFields.digitalBlood, false ) )
250  {
251  fxFileName = "weapon/fx_hero_firefly_attack_limb_reaper";
252  }
253  }
254 
255 
256  arm_gib = 0;
257  leg_gib = 0;
258  while( 1 )
259  {
260  notetrack = self ‪util::waittill_any_return( "gib_leftarm", "gib_leftleg", "gib_rightarm", "gib_rightleg", "entityshutdown" );
261 
262  switch( noteTrack )
263  {
264  case "gib_rightarm":
265  {
266  arm_gib = arm_gib | 1;
267  ‪gib_fx( localClientNum, fxFileName, ‪GIB_TORSO_RIGHT_ARM_FLAG );
268  self ‪GibClientUtils::PlayerGibLeftArm( localClientNum );
269  self SetCorpseGibState( leg_gib, arm_gib );
270  }
271  break;
272  case "gib_leftarm":
273  {
274  arm_gib = arm_gib | 2;
275  ‪gib_fx( localClientNum, fxFileName, ‪GIB_TORSO_LEFT_ARM_FLAG );
276  self ‪GibClientUtils::PlayerGibLeftArm( localClientNum );
277  self SetCorpseGibState( leg_gib, arm_gib );
278  }
279  break;
280  case "gib_rightleg":
281  {
282  leg_gib = leg_gib | 1;
283  ‪gib_fx( localClientNum, fxFileName, ‪GIB_LEGS_RIGHT_LEG_FLAG );
284  self ‪GibClientUtils::PlayerGibLeftLeg( localClientNum );
285  self SetCorpseGibState( leg_gib, arm_gib );
286  }
287  break;
288  case "gib_leftleg":
289  {
290  leg_gib = leg_gib | 2;
291  ‪gib_fx( localClientNum, fxFileName, ‪GIB_LEGS_LEFT_LEG_FLAG );
292  self ‪GibClientUtils::PlayerGibLeftLeg( localClientNum );
293  self SetCorpseGibState( leg_gib, arm_gib );
294  }
295  break;
296  default:
297  break;
298  }
299  }
300 }
‪GIB_LEGS_RIGHT_LEG_FLAG
‪#define GIB_LEGS_RIGHT_LEG_FLAG
Definition: gib.gsh:28
‪is_gib_restricted_build
‪function is_gib_restricted_build()
Definition: util_shared.csc:1305
‪register
‪function register()
Definition: _hive_gun.csc:36
‪firefly_init
‪function firefly_init(localClientNum)
Definition: _hive_gun.csc:177
‪watch_for_gib_notetracks
‪function watch_for_gib_notetracks(localClientNum)
Definition: _hive_gun.csc:237
‪PlayerGibLeftLeg
‪function PlayerGibLeftLeg(localClientNum)
Definition: gib.csc:773
‪GIB_TORSO_RIGHT_ARM_FLAG
‪#define GIB_TORSO_RIGHT_ARM_FLAG
Definition: gib.gsh:25
‪is_mature
‪function is_mature()
Definition: util_shared.csc:1300
‪gib_corpse
‪function gib_corpse(localClientNum, value)
Definition: _hive_gun.csc:230
‪firefly_link_attacking
‪function firefly_link_attacking(localClientNum)
Definition: _hive_gun.csc:211
‪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
‪waittill_any_return
‪function waittill_any_return(string1, string2, string3, string4, string5, string6, string7)
Definition: util_shared.csc:212
‪VAL
‪#define VAL(__var, __default)
Definition: shared.gsh:272
‪fireflies_attacking
‪function fireflies_attacking(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _hive_gun.csc:54
‪FIREFLY_DEPLOYING
‪#define FIREFLY_DEPLOYING
Definition: _hive_gun.gsh:7
‪PlayerGibTag
‪function PlayerGibTag(localClientNum, gibFlag)
Definition: gib.csc:789
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪firefly_watch_fx_finished
‪function firefly_watch_fx_finished(localClientNum, fx)
Definition: _hive_gun.csc:195
‪firefly_attacking
‪function firefly_attacking(localClientNum)
Definition: _hive_gun.csc:205
‪FIREFLY_HUNTING
‪#define FIREFLY_HUNTING
Definition: _hive_gun.gsh:8
‪firefly_hunting
‪function firefly_hunting(localClientNum)
Definition: _hive_gun.csc:188
‪FIREFLY_ATTACKING
‪#define FIREFLY_ATTACKING
Definition: _hive_gun.gsh:9
‪on_shutdown
‪function on_shutdown(localClientNum, ent)
Definition: _hive_gun.csc:168
‪GIB_LEGS_LEFT_LEG_FLAG
‪#define GIB_LEGS_LEFT_LEG_FLAG
Definition: gib.gsh:29
‪firefly_deploying
‪function firefly_deploying(localClientNum)
Definition: _hive_gun.csc:182
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪waittill_any
‪function waittill_any(str_notify1, str_notify2, str_notify3, str_notify4, str_notify5)
Definition: util_shared.csc:375
‪FIREFLY_LINK_ATTACKING
‪#define FIREFLY_LINK_ATTACKING
Definition: _hive_gun.gsh:10
‪watch_player_fx_finished
‪function watch_player_fx_finished(localClientNum, fx, sound)
Definition: _hive_gun.csc:104
‪PlayerGibLeftArm
‪function PlayerGibLeftArm(localClientNum)
Definition: gib.csc:763
‪fireflies_chasing
‪function fireflies_chasing(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _hive_gun.csc:78
‪GIB_TORSO_LEFT_ARM_FLAG
‪#define GIB_TORSO_LEFT_ARM_FLAG
Definition: gib.gsh:26
‪gib_fx
‪function gib_fx(localClientNum, fxFileName, gibFlag)
Definition: _hive_gun.csc:220
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪firefly_state_change
‪function firefly_state_change(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _hive_gun.csc:124
‪getOtherTeam
‪function getOtherTeam(team)
Definition: _hive_gun.csc:44
‪FIREFLY_INIT
‪#define FIREFLY_INIT
Definition: _hive_gun.gsh:6
‪init_shared
‪function init_shared()
Definition: _hive_gun.csc:30