‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_raps.csc
Go to the documentation of this file.
1 #insert scripts\shared\shared.gsh;
2 #insert scripts\shared\version.gsh;
3 
4 #using scripts\codescripts\struct;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\vehicles\_raps;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\vehicle_shared;
10 
11 #insert scripts\mp\killstreaks\_killstreaks.gsh;
12 
13 #precache( "client_fx", RAPS_HELI_DEATH_TRAIL_FX );
14 
15 #namespace raps_mp;
16 
17 #define RAPS_WHOOSH_BEFORE_IMPACT_TIME ( 0.15 )
18 #define RAPS_HALF_GRAVITY ( 386.088 / 2.0 )
19 
20 ‪REGISTER_SYSTEM( "raps_mp", &‪__init__, undefined )
21 
22 function ‪__init__()
23 {
27 }
28 
29 
30 function ‪heli_low_health_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
31 {
32  if ( newVal == 0 )
33  return;
34 
35  self endon( "entityshutdown" );
36 
37  ‪vehicle::wait_for_DObj( localClientNum );
38 
39  PlayFxOnTag( localClientNum, ‪RAPS_HELI_DEATH_TRAIL_FX, self, ‪RAPS_HELI_DEATH_TRAIL_FX_TAG_B );
40 }
41 
42 function ‪heli_extra_low_health_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
43 {
44  if ( newVal == 0 )
45  return;
46 
47  self endon( "entityshutdown" );
48 
49  ‪vehicle::wait_for_DObj( localClientNum );
50 
51  PlayFxOnTag( localClientNum, ‪RAPS_HELI_DEATH_TRAIL_FX, self, ‪RAPS_HELI_DEATH_TRAIL_FX_TAG_C );
52 }
53 
54 function ‪monitor__drop_landing_changed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
55 {
56  if ( !newVal )
57  return;
58 
59  self thread ‪monitor_drop_landing( localClientNum );
60 }
61 
62 function ‪monitor_drop_landing( localClientNum )
63 {
64  self endon( "entityshutdown" );
65 
66  self notify( "monitor_drop_landing_entity_singleton" );
67  self endon( "monitor_drop_landing_entity_singleton" );
68 
69  a_trace = BulletTrace( self.origin + ( 0, 0, -200 ), self.origin + ( 0, 0, -5000 ), false, self, true );
70  v_ground = a_trace[ "position" ];
71 
72  wait 0.5; // gain some speed
73  whoosh_distance = 0;
74 
75  if( isdefined( v_ground ) )
76  {
77  // there is a "whoosh" sound just before the actual impact, so we need to detect the distance
78  not_close_enough_to_ground = true;
79 
80  while( not_close_enough_to_ground )
81  {
82  velocity = self GetVelocity();
83  whoosh_distance = max( whoosh_distance, ( Abs( velocity[2] ) * ‪RAPS_WHOOSH_BEFORE_IMPACT_TIME ) + ‪RAPS_HALF_GRAVITY * ‪RAPS_WHOOSH_BEFORE_IMPACT_TIME * ‪RAPS_WHOOSH_BEFORE_IMPACT_TIME );
84  whoosh_distance_squared = whoosh_distance * whoosh_distance;
85 
86  distance_squared = DistanceSquared( self.origin, v_ground );
87 
88  not_close_enough_to_ground = ( distance_squared > whoosh_distance_squared );
89 
90  if ( not_close_enough_to_ground )
91  {
92  wait ( ( distance_squared > whoosh_distance_squared * 4 ) ? 0.1 : 0.05 );
93  }
94  }
95 
96  self playsound( localClientNum, "veh_raps_first_land" );
97  }
98 
99  // wait close enough to play fx, and rumble ( or z velocity hits zero )
100  while( ( DistanceSquared( self.origin, v_ground ) > 24 * 24 ) || ( velocity[2] <= 0.0 ) )
101  {
102  velocity = self GetVelocity();
104  }
105 
106  bundle = ‪struct::get_script_bundle( "killstreak", "killstreak_" + ‪RAPS_NAME );
107 
108  if ( isdefined( bundle ) && isdefined( bundle.ksDropDeployLandSurfaceFxTable ) && isdefined( a_trace[ "surfacetype" ] ) )
109  {
110  fx_to_play = GetFXFromSurfaceTable( bundle.ksDropDeployLandSurfaceFxTable, a_trace[ "surfacetype" ] );
111  if ( isdefined( fx_to_play ) )
112  {
113  PlayFX( localClientNum, fx_to_play, self.origin );
114  }
115  }
116 
117  if ( isdefined( bundle ) && isdefined( bundle.ksDropDeployLandFx ) )
118  PlayFX( localClientNum, bundle.ksDropDeployLandFx, self.origin );
119 
120  PlayRumbleOnPosition( localClientNum, "raps_land", self.origin );
121 }
‪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
‪RAPS_WHOOSH_BEFORE_IMPACT_TIME
‪#define RAPS_WHOOSH_BEFORE_IMPACT_TIME
Definition: _raps.csc:17
‪RAPS_HELI_DEATH_TRAIL_FX
‪#define RAPS_HELI_DEATH_TRAIL_FX
Definition: _killstreaks.gsh:188
‪wait_for_DObj
‪function wait_for_DObj(localClientNum)
Definition: vehicle_shared.csc:387
‪__init__
‪function __init__()
Definition: _raps.csc:22
‪heli_extra_low_health_fx
‪function heli_extra_low_health_fx(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _raps.csc:42
‪RAPS_HALF_GRAVITY
‪#define RAPS_HALF_GRAVITY
Definition: _raps.csc:18
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪RAPS_HELI_DEATH_TRAIL_FX_TAG_B
‪#define RAPS_HELI_DEATH_TRAIL_FX_TAG_B
Definition: _killstreaks.gsh:190
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪heli_low_health_fx
‪function heli_low_health_fx(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _raps.csc:30
‪monitor_drop_landing
‪function monitor_drop_landing(localClientNum)
Definition: _raps.csc:62
‪monitor__drop_landing_changed
‪function monitor__drop_landing_changed(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _raps.csc:54
‪RAPS_NAME
‪#define RAPS_NAME
Definition: _killstreaks.gsh:108
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪get_script_bundle
‪function get_script_bundle(str_type, str_name)
Definition: struct.csc:45
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266
‪RAPS_HELI_DEATH_TRAIL_FX_TAG_C
‪#define RAPS_HELI_DEATH_TRAIL_FX_TAG_C
Definition: _killstreaks.gsh:191