‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_explosive_bolt.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\math_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
7 
8 #insert scripts\shared\shared.gsh;
9 
10 #using scripts\mp\_util;
11 
12 #precache( "client_fx", "weapon/fx_equip_light_os" );
13 #namespace explosive_bolt;
14 
15 ‪REGISTER_SYSTEM( "explosive_bolt", &‪__init__, undefined )
16 
17 function ‪__init__()
18 {
19  level._effect["crossbow_light"] = "weapon/fx_equip_light_os";
20 
21  ‪callback::add_weapon_type( "explosive_bolt", &‪spawned );
22 }
23 
24 function ‪spawned( localClientNum )
25 {
26  if ( self isGrenadeDud() )
27  return;
28 
29  self thread ‪fx_think( localClientNum );
30 }
31 
32 function ‪fx_think( localClientNum )
33 {
34  self notify( "light_disable" );
35 
36  self endon( "entityshutdown" );
37  self endon( "light_disable" );
38 
39  self ‪util::waittill_dobj( localClientNum );
40 
41  interval = 0.3;
42 
43  for( ;; )
44  {
45  self ‪stop_light_fx( localClientNum );
46  self ‪start_light_fx( localClientNum );
47  self ‪fullscreen_fx( localClientNum );
48  self PlaySound( localClientNum, "wpn_semtex_alert" );
49 
50  ‪util::server_wait( localClientNum, interval, ‪CLIENT_FRAME, "player_switch" );
51  interval = ‪math::clamp( ( interval / 1.2 ), 0.08, 0.3 );
52  }
53 }
54 
55 function ‪start_light_fx( localClientNum )
56 {
57  player = GetLocalPlayer( localClientNum );
58 
59  self.fx = PlayFxOnTag( localClientNum, level._effect["crossbow_light"], self, "tag_origin" );
60 }
61 
62 function ‪stop_light_fx( localClientNum )
63 {
64  if ( isdefined( self.fx ) && self.fx != 0 )
65  {
66  StopFx( localClientNum, self.fx );
67  self.fx = undefined;
68  }
69 }
70 
71 function ‪fullscreen_fx( localClientNum )
72 {
73  player = GetLocalPlayer( localClientNum );
74 
75  if ( isdefined( player ) )
76  {
77  if ( player GetInKillcam( localClientNum ) )
78  {
79  return;
80  }
81  else if ( player ‪util::is_player_view_linked_to_entity( localClientNum ) )
82  {
83  return;
84  }
85  }
86 
87  if ( self ‪util::friend_not_foe( localClientNum ) )
88  {
89  return;
90  }
91 
92  parent = self GetParentEntity();
93 
94  if ( isdefined( parent ) && parent == player )
95  {
96  parent PlayRumbleOnEntity( localClientNum, "buzz_high" );
97 
98  // support for this has been removed with the .menu system
99  /*
100  if ( IsSplitscreen() )
101  {
102  AnimateUI( localClientNum, "sticky_grenade_overlay_ss"+localClientNum, "overlay", "pulse", 0 );
103 
104  if ( GetDvarint( "ui_hud_hardcore" ) == 0 )
105  {
106  AnimateUI( localClientNum, "stuck_ss"+localClientNum, "explosive_bolt", "pulse", 0 );
107  }
108  }
109  else
110  {
111  AnimateUI( localClientNum, "sticky_grenade_overlay"+localClientNum, "overlay", "pulse", 0 );
112 
113  if ( GetDvarint( "ui_hud_hardcore" ) == 0 )
114  {
115  AnimateUI( localClientNum, "stuck"+localClientNum, "explosive_bolt", "pulse", 0 );
116  }
117  }
118  */
119  }
120 }
‪__init__
‪function __init__()
Definition: _explosive_bolt.csc:17
‪is_player_view_linked_to_entity
‪function is_player_view_linked_to_entity(localClientNum)
Definition: util_shared.csc:1244
‪fullscreen_fx
‪function fullscreen_fx(localClientNum)
Definition: _explosive_bolt.csc:71
‪spawned
‪function spawned(localClientNum)
Definition: _explosive_bolt.csc:24
‪friend_not_foe
‪function friend_not_foe(localClientIndex, predicted)
Definition: util_shared.csc:1164
‪CLIENT_FRAME
‪#define CLIENT_FRAME
Definition: shared.gsh:263
‪stop_light_fx
‪function stop_light_fx(localClientNum)
Definition: _explosive_bolt.csc:62
‪fx_think
‪function fx_think(localClientNum)
Definition: _explosive_bolt.csc:32
‪add_weapon_type
‪function add_weapon_type(weapontype, callback)
Definition: callbacks_shared.csc:780
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪start_light_fx
‪function start_light_fx(localClientNum)
Definition: _explosive_bolt.csc:55
‪clamp
‪function clamp(val, val_min, val_max)
Definition: math_shared.csc:16
‪server_wait
‪function server_wait(localClientNum, seconds, waitBetweenChecks, level_endon)
Definition: util_shared.csc:1125