‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_gadget_heat_wave.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\duplicaterender_mgr;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\postfx_shared;
9 #using scripts\shared\visionset_mgr_shared;
10 
11 #using scripts\shared\abilities\_ability_player;
12 #using scripts\shared\abilities\_ability_power;
13 #using scripts\shared\abilities\_ability_util;
14 
15 #using scripts\shared\_burnplayer;
16 
17 #insert scripts\shared\duplicaterender.gsh;
18 #insert scripts\shared\shared.gsh;
19 #insert scripts\shared\version.gsh;
20 #insert scripts\shared\abilities\_ability_util.gsh;
21 #insert scripts\shared\abilities\gadgets\_gadget_heat_wave.gsh;
22 
23 #define VICTIM_FX_PUMP_DURATION 1
24 #define HEATWAVE_EXPLOSION_FX "player/fx_plyr_heat_wave"
25 #define HEATWAVE_EXPLOSION_1P_FX "player/fx_plyr_heat_wave_1p"
26 #define HEATWAVE_EXPLOSION_DISTORTION_VOLUME_FX "player/fx_plyr_heat_wave_distortion_volume"
27 #define HEATWAVE_EXPLOSION_DISTORTION_VOLUME_AIR_FX "player/fx_plyr_heat_wave_distortion_volume_air"
28 #define HEATWAVE_VICTIM_TAGFXSET "ability_hero_heat_wave_player_impact"
29 
30 #define HEATWAVE_ACTIVATE_POSTFX "pstfx_heat_pulse"
31 
32 #define EXPLOSION_RADIUS 400
33 #define CENTER_OFFSET_Z 30
34 #define FX_PER_FRAME 2 // This does more traces accordingly.
35 
36 #precache( "client_fx", HEATWAVE_EXPLOSION_FX );
37 #precache( "client_fx", HEATWAVE_EXPLOSION_1P_FX );
38 #precache( "client_fx", HEATWAVE_EXPLOSION_DISTORTION_VOLUME_FX );
39 #precache( "client_fx", HEATWAVE_EXPLOSION_DISTORTION_VOLUME_AIR_FX );
40 #precache( "client_tagfxset", HEATWAVE_VICTIM_TAGFXSET );
41 
42 ‪REGISTER_SYSTEM( "gadget_heat_wave", &‪__init__, undefined )
43 
44 function ‪__init__()
45 {
49 
50  level.debug_heat_wave_traces = GetDvarInt( "scr_debug_heat_wave_traces", 0 );
51 
54 
55 }
56 
57 
58 function ‪update_activate( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
59 {
60  if( newVal )
61  {
62  self thread postfx::PlayPostfxBundle( ‪HEATWAVE_ACTIVATE_POSTFX );
63  }
64 }
65 
66 function ‪update_victim( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
67 {
68  if( newVal )
69  {
70  self endon( "entityshutdown" );
71  self ‪util::waittill_dobj( localClientNum );
72 
73  self PlayRumbleOnEntity( localClientNum, "heat_wave_damage" );
74  PlayTagFXSet( localClientNum, ‪HEATWAVE_VICTIM_TAGFXSET, self );
75  }
76 }
77 
78 function ‪set_heatwave_fx( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
79 {
80  self ‪clear_heat_wave_fx( localClientNum );
81  if( newVal )
82  {
83  self.heatWaveFx = [];
84  self thread ‪aoe_fx( localClientNum );
85  }
86 }
87 
88 function ‪clear_heat_wave_fx( localClientNum )
89 {
90  if( !isDefined( self.heatWaveFx ) )
91  {
92  return;
93  }
94 
95  foreach( fx in self.heatWaveFx )
96  {
97  StopFx( localClientNum, fx );
98  }
99 }
100 
101 function ‪aoe_fx( localClientNum )
102 {
103  self endon ( "entityshutdown" );
104 
105  center = self.origin + ( 0, 0, ‪CENTER_OFFSET_Z );
106 
107  startPitch = -90;
108  yaw_count = [];
109  yaw_count[ 0 ] = 1;
110  yaw_count[ 1 ] = 4;
111  yaw_count[ 2 ] = 6;
112  yaw_count[ 3 ] = 8;
113  yaw_count[ 4 ] = 6;
114  yaw_count[ 5 ] = 4;
115  yaw_count[ 6 ] = 1;
116 
117  pitch_vals = [];
118  pitch_vals[0] = 90;
119  pitch_vals[3] = 0;
120  pitch_vals[6] = -90;
121 
122  ‪trace = bullettrace( center, center + ( 0, 0, -1 ) * ‪EXPLOSION_RADIUS, false, self );
123  if ( ‪trace["fraction"] < 1.0 )
124  {
125  pitch_vals[1] = 90 - atan( 150 / ( ‪trace["fraction"] * ‪EXPLOSION_RADIUS ) ); // evenly spaced 200 units away
126  pitch_vals[2] = 90 - atan( 300 / ( ‪trace["fraction"] * ‪EXPLOSION_RADIUS ) );
127  }
128  else
129  {
130  pitch_vals[1] = 60;
131  pitch_vals[2] = 30;
132  }
133 
134  ‪trace = bullettrace( center, center + ( 0, 0, 1 ) * ‪EXPLOSION_RADIUS, false, self );
135  if ( ‪trace["fraction"] < 1.0 )
136  {
137  pitch_vals[5] = -90 + atan( 150 / ( ‪trace["fraction"] * ‪EXPLOSION_RADIUS ) ); // evenly spaced 200 units away
138  pitch_vals[4] = -90 + atan( 300 / ( ‪trace["fraction"] * ‪EXPLOSION_RADIUS ) );
139  }
140  else
141  {
142  pitch_vals[5] = -60;
143  pitch_vals[4] = -30;
144  }
145 
146  currentPitch = startPitch;
147  for ( yaw_level = 0; yaw_level < yaw_count.size; yaw_level++ )
148  {
149  currentPitch = pitch_vals[yaw_level];
150  ‪do_fx( localClientNum, center, yaw_count[yaw_level], currentPitch );
151  }
152 }
153 
154 function ‪do_fx( localClientNum, center, yaw_count, pitch )
155 {
156  currentYaw = RandomInt( 360 );
157  for( fxCount = 0; fxCount < yaw_count; fxCount++ )
158  {
159  randomOffsetPitch = RandomInt( 5 ) - 2.5;
160  randomOffsetYaw = RandomInt( 30 ) - 15;
161  angles = ( pitch + randomOffsetPitch, currentYaw + randomOffsetYaw, 0 );
162  traceDir = AnglesToForward( angles );
163  currentYaw += 360 / yaw_count;
164  fx_position = center + traceDir * ‪EXPLOSION_RADIUS;
165  ‪trace = bullettrace( center, fx_position, false, self );
166  sphere_size = 5;
167  angles = ( 0, RandomInt( 360 ), 0 );
168  forward = AnglesToForward( angles );
169 
170  if ( ‪trace["fraction"] < 1.0 )
171  {
172  fx_position = center + traceDir * ‪EXPLOSION_RADIUS * ‪trace["fraction"];
173 
174  normal = ‪trace["normal"];
175  if ( LengthSquared( normal ) == 0 )
176  {
177  normal = -1 * traceDir;
178  }
179  right = ( normal[2] * -1, normal[1] * -1, normal[0] );
180  if( LengthSquared( VectorCross( forward, normal ) ) == 0 )
181  {
182  forward = VectorCross( right, forward );
183  }
184  self.heatWaveFx[self.heatWaveFx.size] = ‪PlayFx( localClientNum, ‪HEATWAVE_EXPLOSION_DISTORTION_VOLUME_FX, ‪trace["position"], normal, forward );
185  }
186  else
187  {
188  if( LengthSquared( VectorCross( forward, traceDir * -1 ) ) == 0 )
189  {
190  forward = VectorCross( right, forward );
191  }
192  self.heatWaveFx[self.heatWaveFx.size] = ‪PlayFx( localClientNum, ‪HEATWAVE_EXPLOSION_DISTORTION_VOLUME_AIR_FX, fx_position, traceDir * -1, forward );
193  }
194 
195  if( fxCount % ‪FX_PER_FRAME )
196  {
198  }
199  }
200 }
201 
202 
‪EXPLOSION_RADIUS
‪#define EXPLOSION_RADIUS
Definition: _gadget_heat_wave.csc:32
‪FX_PER_FRAME
‪#define FX_PER_FRAME
Definition: _gadget_heat_wave.csc:34
‪do_fx
‪function do_fx(localClientNum, center, yaw_count, pitch)
Definition: _gadget_heat_wave.csc:154
‪HEATWAVE_EXPLOSION_DISTORTION_VOLUME_AIR_FX
‪#define HEATWAVE_EXPLOSION_DISTORTION_VOLUME_AIR_FX
Definition: _gadget_heat_wave.csc:27
‪HEATWAVE_ACTIVATE_VISIONSET_ALIAS
‪#define HEATWAVE_ACTIVATE_VISIONSET_ALIAS
Definition: _gadget_heat_wave.gsh:2
‪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
‪update_victim
‪function update_victim(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_heat_wave.csc:66
‪clear_heat_wave_fx
‪function clear_heat_wave_fx(localClientNum)
Definition: _gadget_heat_wave.csc:88
‪trace
‪function trace(from, to, target)
Definition: grapple.gsc:369
‪register_visionset_info
‪function register_visionset_info(name, version, lerp_step_count, visionset_from, visionset_to, visionset_type=VSMGR_VISIONSET_TYPE_NAKED)
Definition: visionset_mgr_shared.csc:50
‪HEATWAVE_CHARRED_VISIONSET
‪#define HEATWAVE_CHARRED_VISIONSET
Definition: _gadget_heat_wave.gsh:9
‪set_heatwave_fx
‪function set_heatwave_fx(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_heat_wave.csc:78
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪aoe_fx
‪function aoe_fx(localClientNum)
Definition: _gadget_heat_wave.csc:101
‪update_activate
‪function update_activate(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_heat_wave.csc:58
‪CENTER_OFFSET_Z
‪#define CENTER_OFFSET_Z
Definition: _gadget_heat_wave.csc:33
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪__init__
‪function __init__()
Definition: _gadget_heat_wave.csc:44
‪HEATWAVE_CHARRED_VISIONSET_STEPS
‪#define HEATWAVE_CHARRED_VISIONSET_STEPS
Definition: _gadget_heat_wave.gsh:12
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪HEATWAVE_ACTIVATE_POSTFX
‪#define HEATWAVE_ACTIVATE_POSTFX
Definition: _gadget_heat_wave.csc:30
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪HEATWAVE_EXPLOSION_DISTORTION_VOLUME_FX
‪#define HEATWAVE_EXPLOSION_DISTORTION_VOLUME_FX
Definition: _gadget_heat_wave.csc:26
‪HEATWAVE_ACTIVATE_VISIONSET
‪#define HEATWAVE_ACTIVATE_VISIONSET
Definition: _gadget_heat_wave.gsh:1
‪HEATWAVE_VICTIM_TAGFXSET
‪#define HEATWAVE_VICTIM_TAGFXSET
Definition: _gadget_heat_wave.csc:28
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266
‪HEATWAVE_ACTIVATE_VISIONSET_STEPS
‪#define HEATWAVE_ACTIVATE_VISIONSET_STEPS
Definition: _gadget_heat_wave.gsh:4
‪HEATWAVE_CHARRED_VISIONSET_ALIAS
‪#define HEATWAVE_CHARRED_VISIONSET_ALIAS
Definition: _gadget_heat_wave.gsh:10
‪PlayFx
‪function PlayFx(name)
Definition: _counteruav.gsc:390