‪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\codescripts\struct;
2 
3 #using scripts\shared\audio_shared;
4 #using scripts\shared\callbacks_shared;
5 #using scripts\shared\exploder_shared;
6 #using scripts\shared\filter_shared;
7 #using scripts\shared\footsteps_shared;
8 #using scripts\shared\system_shared;
9 #using scripts\shared\util_shared;
10 #using scripts\shared\vehicle_shared;
11 #using scripts\shared\vehicles\_driving_fx;
12 
13 #insert scripts\shared\shared.gsh;
14 
15 #using scripts\zm\_filter;
16 #using scripts\zm\_sticky_grenade;
17 #using scripts\shared\util_shared;
18 
19 #namespace callback;
20 
21 ‪REGISTER_SYSTEM( "callback", &‪__init__, undefined )
22 
23 // Callback set up, clientside.
24 
25 function ‪__init__()
26 {
27  level thread ‪set_default_callbacks();
28 }
29 
31 {
32  level.callbackPlayerSpawned = &‪playerspawned;
33  level.callbackLocalClientConnect = &‪localclientconnect;
34  level.callbackEntitySpawned = &‪entityspawned;
35  level.callbackHostMigration = &‪host_migration;
36  level.callbackPlayAIFootstep = &footsteps::playaifootstep;
37  level.callbackPlayLightLoopExploder = &exploder::playlightloopexploder;
38 
39  level._custom_weapon_CB_Func = &‪callback::spawned_weapon_type;
40 }
41 
42 function ‪localclientconnect( localClientNum )
43 {
44  ‪callback::callback( #"on_localclient_connect", localClientNum );
45 
46  if ( isdefined( level.characterCustomizationSetup ) )
47  {
48  [[ level.characterCustomizationSetup ]]( localclientnum );
49  }
50 }
51 
52 function ‪playerspawned(localClientNum)
53 {
54  self endon( "entityshutdown" );
55 
56  if ( isdefined( level._playerspawned_override ) )
57  {
58  self thread [[level._playerspawned_override]]( localClientNum );
59  return;
60  }
61 
62  if ( self isLocalPlayer() )
63  ‪callback::callback( #"on_localplayer_spawned", localClientNum );
64  ‪callback::callback( #"on_player_spawned", localClientNum );
65 
66  // localClientChanged need to get updated players
67  level.localPlayers = getLocalPlayers();
68 }
69 
70 function ‪entityspawned(localClientNum)
71 {
72  self endon( "entityshutdown" );
73 
74  if( self IsPlayer() )
75  {
76  if( isdefined( level._clientFaceAnimOnPlayerSpawned ) )
77  {
78  self thread [[level._clientFaceAnimOnPlayerSpawned]](localClientNum);
79  }
80  }
81 
82  if ( isdefined( level._entityspawned_override ) )
83  {
84  self thread [[level._entityspawned_override]]( localClientNum );
85  return;
86  }
87 
88  if ( !isdefined( self.type ) )
89  {
90  return;
91  }
92 
93  //PrintLn( "entity spawned: type = " + self.type + "\n" );
94  if ( self.type == "missile" )
95  {
96  if( isdefined( level._custom_weapon_CB_Func ) )
97  {
98  self thread [[level._custom_weapon_CB_Func]]( localClientNum );
99  }
100 
101  //PrintLn( "entity spawned: weapon = " + self.weapon.name + "\n" );
102  switch( self.weapon.name )
103  {
104  /* case "explosive_bolt":
105  local_players_entity_thread( self, _explosive_bolt::spawned, true, true );
106  break;
107  case "explosive_bolt_upgraded":
108  local_players_entity_thread( self, _explosive_bolt::spawned, true, false );
109  break;
110  case "crossbow_explosive":
111  local_players_entity_thread( self, _explosive_bolt::spawned, false, true );
112  break;
113  case "crossbow_explosive_upgraded":
114  local_players_entity_thread( self, _explosive_bolt::spawned, false, false );
115  break;*/
116  case "sticky_grenade":
117  self thread ‪_sticky_grenade::spawned( localClientNum );
118  break;
119 
120  }
121  }
122  else if( self.type == "vehicle" || self.type == "helicopter" || self.type == "plane" )
123  {
124  if( isdefined(level._customVehicleCBFunc) )
125  {
126  self thread [[level._customVehicleCBFunc]](localClientNum);
127  }
128 
129  self thread ‪vehicle::field_toggle_exhaustfx_handler( localClientNum, undefined, false, true );
130  self thread ‪vehicle::field_toggle_lights_handler( localClientNum, undefined, false, true );
131 
132  if ( self.type == "plane" || self.type == "helicopter" )
133  {
134  self thread ‪vehicle::aircraft_dustkick();
135  }
136  else //if ( level.usetreadfx == 1 )
137  {
138  self thread ‪driving_fx::play_driving_fx(localClientNum);
139  //self thread vehicle::vehicle_rumble(localClientNum);
140  }
141 
142  if( self.type == "helicopter" )
143  {
144  //self thread helicopter::startfx_loop( localClientNum );
145  }
146  }
147  else if ( self.type == "actor" )
148  {
149  if( isdefined(level._customActorCBFunc) )
150  {
151  self thread [[level._customActorCBFunc]](localClientNum);
152  }
153  }
154 }
155 
156 function ‪host_migration( localClientNum )
157 {
158  level thread ‪prevent_round_switch_animation();
159 }
160 
162 {
163  // SJC: this code function doesn't do anything anymore
164  // TODO find another way to implement this if it's still needed
165 
166  //AllowRoundAnimation(0);
167 
168  wait(3);
169 
170  //AllowRoundAnimation(1);
171 }
‪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
‪host_migration
‪function host_migration(localClientNum)
Definition: _callbacks.csc:156
‪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
‪entityspawned
‪function entityspawned(localClientNum)
Definition: _callbacks.csc:93
‪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
‪aircraft_dustkick
‪function aircraft_dustkick(localClientNum)
Definition: _helicopter_sounds.csc:679
‪spawned
‪function spawned(localClientNum)
Definition: _claymore.csc:24
‪__init__
‪function __init__()
Definition: _callbacks.csc:34
‪prevent_round_switch_animation
‪function prevent_round_switch_animation()
Definition: _callbacks.csc:161
‪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