‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_rcbomb.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\math_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
7 #using scripts\shared\vehicle_shared;
8 #using scripts\shared\vehicles\_driving_fx;
9 
10 #insert scripts\mp\killstreaks\_killstreaks.gsh;
11 #insert scripts\shared\shared.gsh;
12 #insert scripts\shared\version.gsh;
13 
14 #using scripts\mp\_callbacks;
15 #using scripts\mp\_util;
16 #using scripts\mp\_vehicle;
17 
18 // _rcbomb.csc
19 // Sets up clientside behavior for the rcbomb
20 
21 #precache( "client_fx", "killstreaks/fx_rcxd_lights_blinky" );
22 #precache( "client_fx", "killstreaks/fx_rcxd_lights_solid" );
23 #precache( "client_fx", "killstreaks/fx_rcxd_lights_red" );
24 #precache( "client_fx", "killstreaks/fx_rcxd_lights_grn" );
25 #precache( "client_fx", "_t6/weapon/grenade/fx_spark_disabled_rc_car" );
26 
27 #namespace rcbomb;
28 
29 #define RCBOMB_BLUR_AMOUNT GetDvarFloat( "scr_rcbomb_amount", 0.1 )
30 #define RCBOMB_BLUR_INNER_RADIUS GetDvarFloat( "scr_rcbomb_inner_radius", 0.5 )
31 #define RCBOMB_BLUR_OUTER_RADIUS GetDvarFloat( "scr_rcbomb_outer_radius", 0.75 )
32 #define RCBOMB_BLUR_BOOST_DURATION GetDvarFloat( "scr_rcbomb_duration", 1.0 )
33 
34 ‪REGISTER_SYSTEM( "rcbomb", &‪__init__, undefined )
35 
36 function ‪__init__()
37 {
38  level._effect["rcbomb_enemy_light"] = "killstreaks/fx_rcxd_lights_blinky";
39  level._effect["rcbomb_friendly_light"] = "killstreaks/fx_rcxd_lights_solid";
40  level._effect["rcbomb_enemy_light_blink"] = "killstreaks/fx_rcxd_lights_red";
41  level._effect["rcbomb_friendly_light_blink"] = "killstreaks/fx_rcxd_lights_grn";
42  level._effect["rcbomb_stunned"] = "_t6/weapon/grenade/fx_spark_disabled_rc_car";
43 
44  level.rcBombBundle = ‪struct::get_script_bundle( "killstreak", "killstreak_rcbomb" );
45 
46  // vehicle flags
48 
50 }
51 
52 function ‪spawned(localClientNum)
53 {
54  self thread ‪demo_think( localClientNum );
55  self thread ‪stunnedHandler(localClientNum);
56  self thread ‪boost_think( localClientNum );
57  self thread ‪shutdown_think( localClientNum );
58 
59  self.driving_fx_collision_override = &‪OnDrivingFxCollision;
60  self.driving_fx_jump_landing_override = &‪OnDrivingFxJumpLanding;
61 
62  self.killstreakBundle = level.rcBombBundle;
63 }
64 
65 function ‪demo_think( localClientNum )
66 {
67  self endon( "entityshutdown" );
68 
69  if ( !IsDemoPlaying() )
70  {
71  return;
72  }
73 
74  for ( ;; )
75  {
76  level ‪util::waittill_any( "demo_jump", "demo_player_switch" );
77  self ‪vehicle::lights_off( localClientNum );
78  }
79 }
80 
81 function ‪boost_blur( localClientNum )
82 {
83  self endon( "entityshutdown" );
84 
85  if ( isdefined( self.owner ) && self.owner isLocalPlayer() )
86  {
87  EnableSpeedBlur( localClientNum, ‪RCBOMB_BLUR_AMOUNT, ‪RCBOMB_BLUR_INNER_RADIUS, ‪RCBOMB_BLUR_OUTER_RADIUS, false, 0 );
88 
90 
91  DisableSpeedBlur( localClientNum );
92  }
93 }
94 
95 function ‪boost_think( localClientNum )
96 {
97  self endon( "entityshutdown" );
98 
99  for ( ;; )
100  {
101  self waittill( "veh_boost" );
102  self ‪boost_blur( localClientNum );
103  }
104 }
105 
106 function ‪shutdown_think( localClientNum )
107 {
108  self waittill( "entityshutdown" );
109  DisableSpeedBlur( localClientNum );
110 }
111 
112 function ‪play_screen_fx_dirt(localClientNum)
113 {
114  // support for this has been removed with the .menu system
115  /*
116  pick_one = RandomIntRange(0,4);
117  if ( pick_one == 0 )
118  {
119  AnimateUI( localClientNum, "fullscreen_dirt", "dirt", "in", 0 );
120  }
121  else if ( pick_one == 1 )
122  {
123  AnimateUI( localClientNum, "fullscreen_dirt", "dirt_right_splash", "in", 0 );
124  }
125  else if ( pick_one == 2 )
126  {
127  AnimateUI( localClientNum, "fullscreen_dirt", "dirt_left_splash", "in", 0 );
128  }
129  else
130  {
131  AnimateUI( localClientNum, "fullscreen_dirt", "blurred_dirt_random", "in", 0 );
132  }
133  */
134 }
135 
136 function ‪play_screen_fx_dust(localClientNum)
137 {
138  // support for this has been removed with the .menu system
139  /*
140  pick_one = RandomIntRange(0,4);
141  if ( pick_one == 0 )
142  {
143  AnimateUI( localClientNum, "fullscreen_dust", "dust", "in", 0 );
144  }
145  else if ( pick_one == 1 )
146  {
147  AnimateUI( localClientNum, "fullscreen_dust", "dust_right_splash", "in", 0 );
148  }
149  else if ( pick_one == 2 )
150  {
151  AnimateUI( localClientNum, "fullscreen_dust", "dust_left_splash", "in", 0 );
152  }
153  else
154  {
155  AnimateUI( localClientNum, "fullscreen_dust", "blurred_dust_random", "in", 0 );
156  }
157  */
158 }
159 
160 function ‪play_driving_screen_fx( localClientNum )
161 {
162  speed_fraction = 0;
163 
164  while(1)
165  {
166  speed = self getspeed();
167  maxspeed = self getmaxspeed();
168 
169  if ( speed < 0 )
170  {
171  maxspeed = self getmaxreversespeed();
172  }
173 
174  if ( maxspeed > 0 )
175  {
176  speed_fraction = Abs(speed) / maxspeed;
177  }
178  else
179  {
180  speed_fraction = 0;
181  }
182  if ( self iswheelcolliding( "back_left" ) || self iswheelcolliding( "back_right" ) )
183  {
184  // probably need to fix this to work on spectators
185  if ( self IsLocalClientDriver( localClientNum ) )
186  {
187  }
188  }
189  }
190 }
191 
192 function ‪play_boost_fx( localClientNum )
193 {
194  self endon( "entityshutdown" );
195 
196  while( 1 )
197  {
198  speed = self GetSpeed();
199 
200  if ( speed > 400 )
201  {
202  self PlaySound( localClientNum, "mpl_veh_rc_boost" );
203  return;
204  }
205 
206  ‪util::server_wait( localClientNum, 0.1 );
207  }
208 }
209 
210 function ‪stunnedHandler( localClientNum )
211 {
212  self endon( "entityshutdown" );
213 
214  self thread ‪engineStutterHandler( localClientNum );
215 
216  while( 1 )
217  {
218  self waittill( "stunned" );
220 // PrintLn( "CLIENT ***************** stunned" );
221 //#/
222 
223  self setstunned( true );
224 
225  self thread ‪notStunnedHandler( localClientNum );
226 
227  self thread ‪play_stunned_fx_handler( localClientNum );
228  }
229 }
230 
231 function ‪notStunnedHandler( localClientNum )
232 {
233  self endon( "entityshutdown" );
234  self endon( "stunned" );
235 
236  self waittill( "not_stunned" );
238 // PrintLn( "CLIENT ***************** not stunned" );
239 //#/
240 
241  self setstunned( false );
242 }
243 
244 function ‪play_stunned_fx_handler( localClientNum ) // self == rc car
245 {
246  self endon( "entityshutdown" );
247  self endon( "stunned" );
248  self endon( "not_stunned" );
249 
250  // we need this so we can continue to play fx if being stunned by the jammer
251  while( true )
252  {
253  playfxontag( localClientNum, level._effect["rcbomb_stunned"], self, "tag_origin" );
254  wait( 0.5 );
255  }
256 }
257 
258 function ‪engineStutterHandler( localClientNum )
259 {
260  self endon( "entityshutdown" );
261 
262  while( 1 )
263  {
264  self waittill( "veh_engine_stutter" );
265  if ( self IsLocalClientDriver( localClientNum ) )
266  {
267  player = getlocalplayer( localClientNum );
268 
269  if( isdefined( player ) )
270  {
271  player PlayRumbleOnEntity( localClientNum, "rcbomb_engine_stutter" );
272  }
273  }
274  }
275 }
276 
277 function ‪OnDrivingFxCollision( localClientNum, player, hip, hitn, hit_intensity )
278 {
279  if( isdefined( hit_intensity ) && hit_intensity > 15 )
280  {
282 
283  if (isdefined (self.sounddef))
284  {
285  alias = self.sounddef + "_suspension_lg_hd";
286  }
287  else
288  {
289  alias = "veh_default_suspension_lg_hd";
290  }
291 
292  id = PlaySound( 0, alias, self.origin, volume);
293  player Earthquake( 0.7, 0.25, player.origin, 1500 );
294  player PlayRumbleOnEntity( localClientNum, "damage_heavy" );
295  }
296 }
297 
298 function ‪OnDrivingFxJumpLanding( localClientNum, player )
299 {
300  // do nothing for now
301 }
302 
303 
‪RCBOMB_BLUR_OUTER_RADIUS
‪#define RCBOMB_BLUR_OUTER_RADIUS
Definition: _rcbomb.csc:31
‪play_driving_screen_fx
‪function play_driving_screen_fx(localClientNum)
Definition: _rcbomb.csc:160
‪lights_off
‪function lights_off(localClientNum)
Definition: vehicle_shared.csc:652
‪RCBOMB_BLUR_BOOST_DURATION
‪#define RCBOMB_BLUR_BOOST_DURATION
Definition: _rcbomb.csc:32
‪boost_think
‪function boost_think(localClientNum)
Definition: _rcbomb.csc:95
‪RCBOMB_BLUR_AMOUNT
‪#define RCBOMB_BLUR_AMOUNT
Definition: _rcbomb.csc:29
‪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
‪engineStutterHandler
‪function engineStutterHandler(localClientNum)
Definition: _rcbomb.csc:258
‪play_stunned_fx_handler
‪function play_stunned_fx_handler(localClientNum)
Definition: _rcbomb.csc:244
‪boost_blur
‪function boost_blur(localClientNum)
Definition: _rcbomb.csc:81
‪play_boost_fx
‪function play_boost_fx(localClientNum)
Definition: _rcbomb.csc:192
‪RCBOMB_BLUR_INNER_RADIUS
‪#define RCBOMB_BLUR_INNER_RADIUS
Definition: _rcbomb.csc:30
‪RCBOMB_VEHICLE
‪#define RCBOMB_VEHICLE
Definition: _killstreaks.gsh:309
‪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
‪OnDrivingFxJumpLanding
‪function OnDrivingFxJumpLanding(localClientNum, player)
Definition: _rcbomb.csc:298
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪demo_think
‪function demo_think(localClientNum)
Definition: _rcbomb.csc:65
‪__init__
‪function __init__()
Definition: _rcbomb.csc:36
‪stunnedHandler
‪function stunnedHandler(localClientNum)
Definition: _rcbomb.csc:210
‪play_screen_fx_dust
‪function play_screen_fx_dust(localClientNum)
Definition: _rcbomb.csc:136
‪add_vehicletype_callback
‪function add_vehicletype_callback(vehicletype, callback)
Definition: vehicle_shared.csc:77
‪spawned
‪function spawned(localClientNum)
Definition: _rcbomb.csc:52
‪get_impact_vol_from_speed
‪function get_impact_vol_from_speed()
Definition: _driving_fx.csc:571
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪get_script_bundle
‪function get_script_bundle(str_type, str_name)
Definition: struct.csc:45
‪notStunnedHandler
‪function notStunnedHandler(localClientNum)
Definition: _rcbomb.csc:231
‪server_wait
‪function server_wait(localClientNum, seconds, waitBetweenChecks, level_endon)
Definition: util_shared.csc:1125
‪shutdown_think
‪function shutdown_think(localClientNum)
Definition: _rcbomb.csc:106
‪play_screen_fx_dirt
‪function play_screen_fx_dirt(localClientNum)
Definition: _rcbomb.csc:112
‪callback_stunned
‪function callback_stunned(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _callbacks.csc:266
‪OnDrivingFxCollision
‪function OnDrivingFxCollision(localClientNum, player, hip, hitn, hit_intensity)
Definition: _rcbomb.csc:277