‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_callbacks.csc
Go to the documentation of this file.
1 #using scripts\shared\audio_shared;
2 #using scripts\shared\callbacks_shared;
3 #using scripts\shared\exploder_shared;
4 #using scripts\shared\filter_shared;
5 #using scripts\shared\footsteps_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\vehicle_shared;
9 #using scripts\shared\vehicles\_driving_fx;
10 #using scripts\shared\abilities\gadgets\_gadget_vision_pulse;
11 
12 #insert scripts\shared\shared.gsh;
13 
14 #using scripts\shared\weapons\_sticky_grenade;
15 
16 #using scripts\mp\killstreaks\_ai_tank;
17 #using scripts\mp\killstreaks\_airsupport;
18 #using scripts\mp\killstreaks\_helicopter;
19 #using scripts\mp\killstreaks\_qrdrone;
20 #using scripts\mp\killstreaks\_rcbomb;
21 #using scripts\shared\_burnplayer;
22 #using scripts\mp\_callbacks;
23 #using scripts\mp\_util;
24 #using scripts\mp\_vehicle;
25 
26 #using scripts\mp\gametypes\_globallogic;
27 #using scripts\mp\gametypes\_globallogic_actor;
28 
29 #namespace callback;
30 
31 ‪REGISTER_SYSTEM( "callback", &‪__init__, undefined )
32 
33 // Callback set up, clientside.
34 function ‪__init__()
35 {
36  level thread ‪set_default_callbacks();
37 }
38 
40 {
41  level.callbackPlayerSpawned = &‪playerspawned;
42  level.callbackLocalClientConnect = &‪localclientconnect;
43  level.callbackCreatingCorpse = &‪creating_corpse;
44  level.callbackEntitySpawned = &‪entityspawned;
45  level.callbackAirSupport = &‪airsupport;
46  //level.callbackDogSoundNotify = &dogs::play_dog_sound;
47  level.callbackPlayAIFootstep = &footsteps::playaifootstep;
48  level.callbackPlayLightLoopExploder = &exploder::playlightloopexploder;
49 
50  level._custom_weapon_CB_Func = &‪callback::spawned_weapon_type;
51 
52  level.gadgetVisionPulse_reveal_func = &‪gadget_vision_pulse::gadget_visionpulse_reveal;
53 }
54 
55 function ‪localclientconnect( localClientNum )
56 {
57  /# println( "*** Client script VM : Local client connect " + localClientNum ); #/
58 
59  if ( isdefined( level.characterCustomizationSetup ) )
60  {
61  [[ level.characterCustomizationSetup ]]( localclientnum );
62  }
63 
64  ‪callback::callback( #"on_localclient_connect", localClientNum );
65 }
66 
67 function ‪playerspawned(localClientNum)
68 {
69  self endon( "entityshutdown" );
70  self notify( "playerspawned_callback" );
71  self endon( "playerspawned_callback" );
72 
73  player = GetLocalPlayer(localClientNum);
74 
75  if ( isdefined( level.infraredVisionset ) )
76  {
77  player SetInfraredVisionset( level.infraredVisionset );
78  }
79 
80  if ( isdefined( level._playerspawned_override ) )
81  {
82  self thread [[level._playerspawned_override]]( localClientNum );
83  return;
84  }
85 
86 /# PrintLn( "Player spawned" ); #/
87  if ( self isLocalPlayer() )
88  ‪callback::callback( #"on_localplayer_spawned", localClientNum );
89 
90  ‪callback::callback( #"on_player_spawned", localClientNum );
91 }
92 
93 function ‪entityspawned(localClientNum)
94 {
95  self endon( "entityshutdown" );
96 
97  if( self IsPlayer() )
98  {
99  if( isdefined( level._clientFaceAnimOnPlayerSpawned ) )
100  {
101  self thread [[level._clientFaceAnimOnPlayerSpawned]](localClientNum);
102  }
103  }
104 
105  if ( isdefined( level._entityspawned_override ) )
106  {
107  self thread [[level._entityspawned_override]]( localClientNum );
108  return;
109  }
110 
111  if ( !isdefined( self.type ) )
112  {
113  /# println( "Entity type undefined!" ); #/
114  return;
115  }
116 
117  if ( self.type == "missile" )
118  {
119  if( isdefined( level._custom_weapon_CB_Func ) )
120  {
121  self thread [[level._custom_weapon_CB_Func]]( localClientNum );
122  }
123  }
124  else if ( self.type == "vehicle" || self.type == "helicopter" || self.type == "plane" )
125  {
126  if( isdefined(level._customVehicleCBFunc) )
127  {
128  self thread [[level._customVehicleCBFunc]](localClientNum);
129  }
130 
131  self thread ‪vehicle::field_toggle_exhaustfx_handler( localClientNum, undefined, false, true );
132  self thread ‪vehicle::field_toggle_lights_handler( localClientNum, undefined, false, true );
133 
134  if ( self.type == "plane" || self.type == "helicopter" )
135  {
136  self thread ‪vehicle::aircraft_dustkick();
137  }
138  else
139  {
140  self thread ‪driving_fx::play_driving_fx(localClientNum);
141  self thread ‪vehicle::vehicle_rumble(localClientNum);
142  }
143 
144  if( self.type == "helicopter" )
145  {
146  self thread ‪helicopter::startfx_loop( localClientNum );
147  }
148  }
149 
150 
151  if ( self.type == "actor" )
152  {
153  if( isdefined(level._customActorCBFunc) )
154  {
155  self thread [[level._customActorCBFunc]](localClientNum);
156  }
157  }
158 }
159 
160 function ‪airsupport( localClientNum, x, y, z, type, yaw, team, teamfaction, owner, exittype, time, height )
161 {
162  pos = ( x, y, z );
163  switch( teamFaction )
164  {
165  case "v":
166  teamfaction = "vietcong";
167  break;
168  case "n":
169  case "nva":
170  teamfaction = "nva";
171  break;
172  case "j":
173  teamfaction = "japanese";
174  break;
175  case "m":
176  teamfaction = "marines";
177  break;
178  case "s":
179  teamfaction = "specops";
180  break;
181  case "r":
182  teamfaction = "russian";
183  break;
184  default:
185  /# println( "Warning: Invalid team char provided, defaulted to marines" ); #/
186  /# println( "Teamfaction received: " + teamFaction + "\n" ); #/
187  teamfaction = "marines";
188  break;
189  }
190 
191  switch( team )
192  {
193  case "x":
194  team = "axis";
195  break;
196  case "l":
197  team = "allies";
198  break;
199  case "r":
200  team = "free";
201  break;
202  default:
203  /# println( "Invalid team used with playclientAirstike/napalm: " + team + "\n"); #/
204  team = "allies";
205  break;
206  }
207 
208  data = spawnstruct();
209 
210  data.team = team;
211  data.owner = owner;
212  data.bombsite = pos;
213  data.yaw = yaw;
214  direction = ( 0, yaw, 0 );
215  data.direction = direction;
216  data.flyHeight = height;
217 
218  if ( type == "a" )
219  {
220  planeHalfDistance = 12000;
221  data.planeHalfDistance = planeHalfDistance;
222  data.startPoint = pos + VectorScale( anglestoforward( direction ), -1 * planeHalfDistance );
223  data.endPoint = pos + VectorScale( anglestoforward( direction ), planeHalfDistance );
224  data.planeModel = "t5_veh_air_b52";
225  data.flyBySound = "null";
226  data.washSound = "veh_b52_flyby_wash";
227  data.apexTime = 6145;
228  data.exitType = -1;
229  data.flySpeed = 2000;
230  data.flyTime = ( ( planeHalfDistance * 2 ) / data.flySpeed );
231  planeType = "airstrike";
232  //_airstrike::addPlaneEvent( localClientNum, planeType, data, time );
233  }
234  else if ( type == "n" )
235  {
236  planeHalfDistance = 24000;
237  data.planeHalfDistance = planeHalfDistance;
238  data.startPoint = pos + VectorScale( anglestoforward( direction ), -1 * planeHalfDistance );
239  data.endPoint = pos + VectorScale( anglestoforward( direction ), planeHalfDistance );
240  data.planeModel = ‪airsupport::getPlaneModel( teamFaction );
241  data.flyBySound = "null";
242  data.washSound = "evt_us_napalm_wash";
243  data.apexTime = 2362;
244  data.exitType = exitType;
245  data.flySpeed = 7000;
246  data.flyTime = ( ( planeHalfDistance * 2 ) / data.flySpeed );
247  planeType = "napalm";
248  //_plane::addPlaneEvent( localClientNum, planeType, data, time );
249  }
250  else
251  {
252  /#
253  println( "" );
254  println( "Unhandled airsupport type, only A (airstrike) and N (napalm) supported" );
255  println( type );
256  println( "" );
257  #/
258  return;
259  }
260 }
261 
262 function ‪creating_corpse(localClientNum, player )
263 {
264 }
265 
266 function ‪callback_stunned( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
267 {
268  self.stunned = newVal;
269 
270 /# PrintLn("stunned_callback"); #/
271 
272  if ( newVal )
273  {
274  self notify("stunned");
275  }
276  else
277  {
278  self notify("not_stunned");
279  }
280 }
281 
282 function ‪callback_emp( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
283 {
284  self.emp = newVal;
285 
286 /# PrintLn("emp_callback"); #/
287 
288  if ( newVal )
289  {
290  self notify("emp");
291  }
292  else
293  {
294  self notify("not_emp");
295  }
296 }
297 
298 function ‪callback_proximity( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
299 {
300  self.enemyInProximity = newVal;
301 }
‪callback
‪function callback(event, localclientnum, params)
Definition: callbacks_shared.csc:13
‪field_toggle_lights_handler
‪function field_toggle_lights_handler(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: vehicle_shared.csc:1131
‪field_toggle_exhaustfx_handler
‪function field_toggle_exhaustfx_handler(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: vehicle_shared.csc:1074
‪set_default_callbacks
‪function set_default_callbacks()
Definition: _callbacks.csc:39
‪getPlaneModel
‪function getPlaneModel(teamFaction)
Definition: _airsupport.csc:24
‪gadget_visionpulse_reveal
‪function gadget_visionpulse_reveal(localClientNum, bReveal)
Definition: _gadget_vision_pulse.csc:272
‪callback_emp
‪function callback_emp(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _callbacks.csc:282
‪entityspawned
‪function entityspawned(localClientNum)
Definition: _callbacks.csc:93
‪vehicle_rumble
‪function vehicle_rumble(localClientNum)
Definition: _vehicle.csc:30
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪play_driving_fx
‪function play_driving_fx(localClientNum)
Definition: _driving_fx.csc:291
‪creating_corpse
‪function creating_corpse(localClientNum, player)
Definition: _callbacks.csc:262
‪aircraft_dustkick
‪function aircraft_dustkick(localClientNum)
Definition: _helicopter_sounds.csc:679
‪startfx_loop
‪function startfx_loop(localClientNum)
Definition: _helicopter.csc:385
‪__init__
‪function __init__()
Definition: _callbacks.csc:34
‪airsupport
‪function airsupport(localClientNum, x, y, z, type, yaw, team, teamfaction, owner, exittype, time, height)
Definition: _callbacks.csc:160
‪localclientconnect
‪function localclientconnect(localClientNum)
Definition: _callbacks.csc:55
‪playerspawned
‪function playerspawned(localClientNum)
Definition: _callbacks.csc:67
‪spawned_weapon_type
‪function spawned_weapon_type(localClientNum)
Definition: callbacks_shared.csc:795
‪callback_stunned
‪function callback_stunned(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _callbacks.csc:266
‪callback_proximity
‪function callback_proximity(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _callbacks.csc:298