‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
spike_charge.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 #using scripts\shared\postfx_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 
11 #precache( "client_fx", "weapon/fx_light_spike_launcher" );
12 
13 #namespace sticky_grenade;
14 
15 ‪REGISTER_SYSTEM( "spike_charge", &‪__init__, undefined )
16 
17 function ‪__init__()
18 {
19  level._effect["spike_light"] = "weapon/fx_light_spike_launcher";
20 
21  ‪callback::add_weapon_type( "spike_launcher", &‪spawned );
22  ‪callback::add_weapon_type( "spike_launcher_cpzm", &‪spawned );
24 }
25 
26 function ‪spawned( localClientNum )
27 {
28  self thread ‪fx_think( localClientNum );
29 }
30 
31 function ‪spawned_spike_charge( localClientNum )
32 {
33  self thread ‪fx_think( localClientNum );
34  self thread ‪spike_detonation( localClientNum );
35 }
36 
37 function ‪fx_think( localClientNum )
38 {
39  self notify( "light_disable" );
40 
41  self endon( "entityshutdown" );
42  self endon( "light_disable" );
43 
44  self ‪util::waittill_dobj( localClientNum );
45 
46 // self PlaySound( localClientNum, "wpn_semtex_countdown" );
47 
48  interval = 0.3;
49 
50  for( ;; )
51  {
52  self ‪stop_light_fx( localClientNum );
53  self ‪start_light_fx( localClientNum );
54  //self fullscreen_fx( localClientNum );
55  //self PlaySound( localClientNum, "wpn_semtex_alert" );
56 
57  ‪util::server_wait( localClientNum, interval, 0.01, "player_switch" );
58 
59  self ‪util::waittill_dobj( localClientNum );
60 
61  interval = ‪math::clamp( ( interval / 1.2 ), 0.08, 0.3 );
62  }
63 }
64 
65 function ‪start_light_fx( localClientNum )
66 {
67  player = GetLocalPlayer( localClientNum );
68 
69  self.fx = PlayFxOnTag( localClientNum, level._effect["spike_light"], self, "tag_fx" );
70 }
71 
72 function ‪stop_light_fx( localClientNum )
73 {
74  if ( isdefined( self.fx ) && self.fx != 0 )
75  {
76  StopFx( localClientNum, self.fx );
77  self.fx = undefined;
78  }
79 }
80 
81 function ‪spike_detonation( localClientNum )
82 {
83  spike_position = self.origin;
84 
85  while ( isdefined( self ) )
86  {
88  }
89 
90  if ( !IsIGCActive(localClientNum) )
91  {
92  player = GetLocalPlayer( localClientNum );
93  explosion_distance = DistanceSquared( spike_position, player.origin );
94 
95  if ( explosion_distance <= ‪SQR( 450 ) )
96  {
97  player thread postfx::PlayPostfxBundle( "pstfx_dust_chalk" );
98  }
99  if ( explosion_distance <= ‪SQR( 300 ) )
100  {
101  player thread postfx::PlayPostfxBundle( "pstfx_dust_concrete" );
102  }
103  }
104 }
105 /*
106 function sticky_indicator( player, localClientNum )
107 {
108  controllerModel = GetUIModelForController( localClientNum );
109  stickyImageModel = CreateUIModel( controllerModel, "hudItems.stickyImage" );
110 
111  SetUIModelValue( stickyImageModel, "hud_icon_stuck_semtex" );
112 
113  // this is probably good enough, but the while loop is safer
114  // self util::waittill_any( "death", "detonated" );
115 
116  while( IsDefined(self ) )
117  {
118  WAIT_CLIENT_FRAME;
119  }
120 
121  SetUIModelValue( stickyImageModel, "blacktransparent" );
122 }
123 */
124 /*
125 function fullscreen_fx( localClientNum )
126 {
127  player = GetLocalPlayer( localClientNum );
128 
129  if ( isdefined( player ) )
130  {
131  if ( player GetInKillcam( localClientNum ) )
132  {
133  return;
134  }
135  else if ( player util::is_player_view_linked_to_entity( localClientNum ) )
136  {
137  return;
138  }
139  }
140 
141  if ( self util::friend_not_foe( localClientNum ) )
142  {
143  return;
144  }
145 
146  parent = self GetParentEntity();
147 
148  if ( isdefined( parent ) && parent == player )
149  {
150  parent PlayRumbleOnEntity( localClientNum, "buzz_high" );
151 
152  if ( GetDvarint( "ui_hud_hardcore" ) == 0 )
153  {
154  self thread sticky_indicator( player, localClientNum );
155  }
156  }
157 }
158 */
‪start_light_fx
‪function start_light_fx(localClientNum)
Definition: spike_charge.csc:65
‪SQR
‪#define SQR(__var)
Definition: shared.gsh:293
‪__init__
‪function __init__()
Definition: spike_charge.csc:17
‪spike_detonation
‪function spike_detonation(localClientNum)
Definition: spike_charge.csc:81
‪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
‪fx_think
‪function fx_think(localClientNum)
Definition: spike_charge.csc:37
‪spawned_spike_charge
‪function spawned_spike_charge(localClientNum)
Definition: spike_charge.csc:31
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪stop_light_fx
‪function stop_light_fx(localClientNum)
Definition: spike_charge.csc:72
‪spawned
‪function spawned(localClientNum)
Definition: spike_charge.csc:26
‪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
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266