‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
callbacks_shared.csc
Go to the documentation of this file.
1 #using scripts\shared\array_shared;
2 #using scripts\shared\audio_shared;
3 #using scripts\shared\exploder_shared;
4 #using scripts\shared\footsteps_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\scene_shared;
7 #using scripts\shared\util_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 
11 #namespace callback;
12 
13 function ‪callback( event, localclientnum, params )
14 {
15  if ( isdefined( level._callbacks ) && isdefined( level._callbacks[event] ) )
16  {
17  for ( i = 0; i < level._callbacks[event].size; i++ )
18  {
19  ‪callback = level._callbacks[event][i][0];
20  obj = level._callbacks[event][i][1];
21 
22  if ( !isdefined( ‪callback ) )
23  {
24  continue;
25  }
26 
27  if ( isdefined( obj ) )
28  {
29  if ( isdefined( params ) )
30  {
31  obj thread [[‪callback]]( localclientnum, self, params );
32  }
33  else
34  {
35  obj thread [[‪callback]]( localclientnum, self );
36  }
37  }
38  else
39  {
40  if ( isdefined( params ) )
41  {
42  self thread [[‪callback]]( localclientnum, params );
43  }
44  else
45  {
46  self thread [[‪callback]]( localclientnum );
47  }
48  }
49  }
50  }
51 }
52 
53 function ‪entity_callback( event, localclientnum, params )
54 {
55  if ( isdefined( self._callbacks ) && isdefined( self._callbacks[event] ) )
56  {
57  for ( i = 0; i < self._callbacks[event].size; i++ )
58  {
59  ‪callback = self._callbacks[event][i][0];
60  obj = self._callbacks[event][i][1];
61 
62  if ( !isdefined( ‪callback ) )
63  {
64  continue;
65  }
66 
67  if ( isdefined( obj ) )
68  {
69  if ( isdefined( params ) )
70  {
71  obj thread [[‪callback]]( localclientnum, self, params );
72  }
73  else
74  {
75  obj thread [[‪callback]]( localclientnum, self );
76  }
77  }
78  else
79  {
80  if ( isdefined( params ) )
81  {
82  self thread [[‪callback]]( localclientnum, params );
83  }
84  else
85  {
86  self thread [[‪callback]]( localclientnum );
87  }
88  }
89  }
90  }
91 }
92 
93 function ‪add_callback( event, func, obj )
94 {
95  assert( isdefined( event ), "Trying to set a callback on an undefined event." );
96 
97  if ( !isdefined( level._callbacks ) || !isdefined( level._callbacks[event] ) )
98  {
99  level._callbacks[event] = [];
100  }
101 
102  foreach( ‪callback in level._callbacks[event] )
103  {
104  if( ‪callback[0] == func )
105  {
106  if( !isdefined( obj ) || ‪callback[1] == obj )
107  {
108  return;
109  }
110  }
111  }
112 
113  ‪array::add( level._callbacks[event], ‪array( func, obj ), false );
114 
115  if ( isdefined( obj ) )
116  {
117  obj thread ‪remove_callback_on_death( event, func );
118  }
119 }
120 
121 function ‪add_entity_callback( event, func, obj )
122 {
123  assert( isdefined( event ), "Trying to set a callback on an undefined event." );
124 
125  if ( !isdefined( self._callbacks ) || !isdefined( self._callbacks[event] ) )
126  {
127  self._callbacks[event] = [];
128  }
129 
130  foreach( ‪callback in self._callbacks[event] )
131  {
132  if( ‪callback[0] == func )
133  {
134  if( !isdefined( obj ) || ‪callback[1] == obj )
135  {
136  return;
137  }
138  }
139  }
140 
141  ‪array::add( self._callbacks[event], ‪array( func, obj ), false );
142 }
143 
144 function ‪remove_callback_on_death( event, func )
145 {
146  self waittill( "death" );
147  ‪remove_callback( event, func, self );
148 }
149 
150 function ‪remove_callback( event, func, obj )
151 {
152  assert( isdefined( event ), "Trying to remove a callback on an undefined event." );
153  assert( isdefined( level._callbacks[event] ), "Trying to remove callback for unknown event." );
154 
155  foreach ( index, func_group in level._callbacks[event] )
156  {
157  if ( func_group[0] == func )
158  {
159  if ( ‪IS_EQUAL( func_group[1], obj ) )
160  {
161  ArrayRemoveIndex( level._callbacks[event], index, false );
162  }
163  }
164  }
165 }
166 
176 function ‪on_localclient_connect( func, obj )
177 {
178  ‪add_callback( #"on_localclient_connect", func, obj );
179 }
180 
190 function ‪on_localclient_shutdown( func, obj )
191 {
192  ‪add_callback( #"on_localclient_shutdown", func, obj );
193 }
194 
203 function ‪on_finalize_initialization( func, obj )
204 {
205  ‪add_callback( #"on_finalize_initialization", func, obj );
206 }
207 
208 
217 function ‪on_localplayer_spawned( func, obj )
218 {
219  ‪add_callback( #"on_localplayer_spawned", func, obj );
220 }
221 
222 
231 function ‪remove_on_localplayer_spawned( func, obj )
232 {
233  ‪remove_callback( #"on_localplayer_spawned", func, obj );
234 }
235 
236 
245 function ‪on_spawned( func, obj )
246 {
247  ‪add_callback( #"on_player_spawned", func, obj );
248 }
249 
250 
259 function ‪remove_on_spawned( func, obj )
260 {
261  ‪remove_callback( #"on_player_spawned", func, obj );
262 }
263 
272 function ‪on_shutdown( func, obj )
273 {
274  ‪add_entity_callback( #"on_entity_shutdown", func, obj );
275 }
276 
285 function ‪on_start_gametype( func, obj )
286 {
287  ‪add_callback( #"on_start_gametype", func, obj );
288 }
289 
290 
291 /*================
292 Called by code before level main but after autoexecs
293 ================*/
295 {
296  ‪callback::callback( #"on_pre_initialization" );
298 }
299 
300 /*================
301 Called by code as the final step of initialization
302 ================*/
304 {
306  ‪callback::callback( #"on_finalize_initialization" );
307 }
308 
310 // Files moved from _callbacks.csc
312 
313 function ‪CodeCallback_StateChange(clientNum, system, newState)
314 {
315 
316  if(!isdefined(level._systemStates))
317  {
318  level._systemStates = [];
319  }
320 
321  if(!isdefined(level._systemStates[system]))
322  {
323  level._systemStates[system] = spawnstruct();
324  }
325 
326  //level._systemStates[system].oldState = oldState;
327  level._systemStates[system].state = newState;
328 
329  if(isdefined(level._systemStates[system].callback))
330  {
331  [[level._systemStates[system].callback]](clientNum, newState);
332  }
333  else
334  {
335  /# println("*** Unhandled client system state change - " + system + " - has no registered callback function."); #/
336  }
337 }
338 
340 {
341 /# println("*** Client script VM map restart."); #/
342 
343  // This really needs to be in a loop over 0 -> num local clients.
344  // syncsystemstates(0);
346  level thread ‪util::init_utility();
347 }
348 
349 function ‪CodeCallback_LocalClientConnect( localClientNum )
350 {
351 /# println("*** Client script VM : Local client connect " + localClientNum); #/
352  [[level.callbackLocalClientConnect]]( localClientNum );
353 }
354 
356 {
357 /# println("*** Client script VM : Local client disconnect " + clientNum); #/
358 }
359 
360 function ‪CodeCallback_GlassSmash(org, dir)
361 {
362  level notify("glass_smash", org, dir);
363 }
364 
365 function ‪CodeCallback_SoundSetAmbientState(ambientRoom, ambientPackage, roomColliderCent, packageColliderCent, defaultRoom)
366 {
367  ‪audio::setCurrentAmbientState(ambientRoom, ambientPackage, roomColliderCent, packageColliderCent, defaultRoom);
368 }
369 
370 function ‪CodeCallback_SoundSetAiAmbientState(triggers, actors, numTriggers)
371 {
372 }
373 
374 function ‪CodeCallback_SoundPlayUiDecodeLoop(decodeString, playTimeMs)
375 {
376  self thread ‪audio::soundplayuidecodeloop(decodeString, playTimeMs);
377 }
378 
379 function ‪CodeCallback_PlayerSpawned(localClientNum)
380 {
381  /# PrintLn("****CodeCallback_PlayerSpawned****"); #/
382  [[level.callbackPlayerSpawned]]( localClientNum );
383 }
384 
385 
386 function ‪CodeCallback_GibEvent( localClientNum, type, locations )
387 {
388  if ( isdefined( level._gibEventCBFunc ) )
389  {
390  self thread [[level._gibEventCBFunc]]( localClientNum, type, locations );
391  }
392 }
393 
394 /*================
395 function Called by code after the level's main script function has run - only called from CG_Init() - not from CG_MapRestart()
396 ================*/
397 
399 {
400  if(isdefined(level.callbackPrecacheGameType))
401  {
402  [[level.callbackPrecacheGameType]]();
403  }
404 }
405 
406 /*================
407 Called by code after the level's main script function has run.
408 ================*/
410 {
411  // If the gametype has not beed started, run the startup
412  if(isdefined(level.callbackStartGameType) && (!isdefined(level.gametypestarted) || !level.gametypestarted))
413  {
414  [[level.callbackStartGameType]]();
415 
416  level.gametypestarted = true; // so we know that the gametype has been started up
417  }
418 }
419 
420 function ‪CodeCallback_EntitySpawned(localClientNum)
421 {
422  [[level.callbackEntitySpawned]]( localClientNum );
423 }
424 
425 function ‪CodeCallback_SoundNotify( localClientNum, entity, note )
426 {
427  switch( note )
428  {
429  case "scr_bomb_beep":
430  // tagTMR<NOTE>: add custom game mode override for silencing 3p bomb beep
431  if ( GetGametypeSetting( "silentPlant" ) == 0 )
432  {
433  entity PlaySound( localClientNum, "fly_bomb_buttons_npc" );
434  }
435  break;
436  }
437 }
438 
439 function ‪CodeCallback_EntityShutdown( localClientNum, entity )
440 {
441  if( isdefined( level.callbackEntityShutdown ) )
442  {
443  [[level.callbackEntityShutdown]]( localClientNum, entity );
444  }
445 
446  entity ‪callback::entity_callback( #"on_entity_shutdown", localClientNum );
447 }
448 
449 function ‪CodeCallback_LocalClientShutdown( localClientNum, entity )
450 {
451  level.localPlayers = getLocalPlayers();
452  entity ‪callback::callback( #"on_localclient_shutdown", localClientNum );
453 }
454 
455 function ‪CodeCallback_LocalClientChanged( localClientNum, entity )
456 {
457  // localClientChanged need to get updated players
458  level.localPlayers = getLocalPlayers();
459 }
460 
461 function ‪CodeCallback_AirSupport( localClientNum, x, y, z, type, yaw, team, teamfaction, owner, exittype, time, height )
462 {
463  if( isdefined( level.callbackAirSupport ) )
464  {
465  [[level.callbackAirSupport]]( localClientNum, x, y, z, type, yaw, team, teamfaction, owner, exittype, time, height );
466  }
467 }
468 
469 function ‪CodeCallback_DemoJump( localClientNum, time )
470 {
471  level notify( "demo_jump", time );
472  level notify( "demo_jump" + localClientNum, time );
473 }
474 
475 function ‪CodeCallback_DemoPlayerSwitch( localClientNum )
476 {
477  level notify( "demo_player_switch" );
478  level notify( "demo_player_switch" + localClientNum );
479 }
480 
481 function ‪CodeCallback_PlayerSwitch( localClientNum )
482 {
483  level notify( "player_switch" );
484  level notify( "player_switch" + localClientNum );
485 }
486 
487 function ‪CodeCallback_KillcamBegin( localClientNum, time )
488 {
489  level notify( "killcam_begin", time );
490  level notify( "killcam_begin" + localClientNum, time );
491 }
492 
493 function ‪CodeCallback_KillcamEnd( localClientNum, time )
494 {
495  level notify( "killcam_end", time );
496  level notify( "killcam_end" + localClientNum, time );
497 }
498 
499 function ‪CodeCallback_CreatingCorpse(localClientNum, player )
500 {
501  if( isdefined( level.callbackCreatingCorpse ) )
502  {
503  [[level.callbackCreatingCorpse]]( localClientNum, player );
504  }
505 }
506 
507 function ‪CodeCallback_PlayerFoliage(client_num, player, firstperson, quiet)
508 {
509  ‪footsteps::playerFoliage(client_num, player, firstperson, quiet);
510 }
511 
512 function ‪CodeCallback_ActivateExploder(exploder_id)
513 {
514  if(!isdefined(level._exploder_ids))
515  {
516  //PrintLn("No exploder_ids");
517  return;
518  }
519 
520  keys = getarraykeys(level._exploder_ids);
521 
522  ‪exploder = undefined;
523 
524  for(i = 0; i < keys.size; i ++)
525  {
526  if(level._exploder_ids[keys[i]] == exploder_id)
527  {
528  ‪exploder = keys[i];
529  break;
530  }
531  }
532 
533  if(!isdefined(‪exploder))
534  {
535  //PrintLn("*** Client : Exploder id " + exploder_id + " unknown.");
536  return;
537  }
538 
539  //PrintLn("*** Client callback - activate exploder " + exploder_id + " : " + exploder);
540 
542 }
543 
545 {
546  if(!isdefined(level._exploder_ids))
547  return;
548 
549  keys = getarraykeys(level._exploder_ids);
550 
551  ‪exploder = undefined;
552 
553  for(i = 0; i < keys.size; i ++)
554  {
555  if(level._exploder_ids[keys[i]] == exploder_id)
556  {
557  ‪exploder = keys[i];
558  break;
559  }
560  }
561 
562  if(!isdefined(‪exploder))
563  {
564  //println("*** Client : Exploder id " + exploder_id + " unknown.");
565  return;
566  }
567 
568  //println("*** Client callback - deactivate exploder " + exploder_id + " : " + exploder);
569 
571 }
572 
573 function ‪CodeCallback_ChargesHotWeaponSoundNotify( localClientNum, weapon, chargeShotLevel )
574 {
575  if( isdefined( level.sndChargeShot_Func ) )
576  {
577  self [[level.sndChargeShot_Func]]( localClientNum, weapon, chargeShotLevel );
578  }
579 }
580 
581 function ‪CodeCallback_HostMigration( localClientNum )
582 {
583  /# println("*** Client: CodeCallback_HostMigration()"); #/
584  if( isdefined( level.callbackHostMigration ) )
585  {
586  [[level.callbackHostMigration]]( localClientNum );
587  }
588 }
589 
590 function ‪CodeCallback_DogSoundNotify(client_num, entity, note )
591 {
592  if( isdefined( level.callbackDogSoundNotify ) )
593  {
594  [[level.callbackDogSoundNotify]]( client_num, entity, note );
595  }
596 }
597 
598 function ‪CodeCallback_PlayAIFootstep(client_num, pos, surface, notetrack, bone)
599 {
600  [[level.callbackPlayAIFootstep]]( client_num, pos, surface, notetrack, bone );
601 }
602 
603 function ‪CodeCallback_PlayLightLoopExploder( exploderIndex )
604 {
605  [[level.callbackPlayLightLoopExploder]]( exploderIndex );
606 }
607 
608 function ‪CodeCallback_StopLightLoopExploder( exploderIndex )
609 {
610  num = Int(exploderIndex);
611 
612  if(isdefined(level.createFXexploders[num]))
613  {
614  for(i = 0; i < level.createFXexploders[num].size; i ++)
615  {
616  ent = level.createFXexploders[num][i];
617 
618  if ( !isdefined( ent.looperFX ) )
619  {
620  ent.looperFX = [];
621  }
622 
623  for( clientNum = 0; clientNum < level.max_local_clients; clientNum++ )
624  {
625  if( localClientActive( clientNum ) )
626  {
627  if ( isdefined( ent.looperFX[clientNum] ) )
628  {
629  for( looperFXCount = 0; looperFXCount < ent.looperFX[clientNum].size; looperFXCount++ )
630  {
631  deletefx( clientNum, ent.looperFX[clientNum][looperFXCount] );
632  }
633  }
634  }
635 
636  ent.looperFX[clientNum] = [];
637  }
638 
639  ent.looperFX = [];
640  }
641  }
642 }
643 
644 function ‪CodeCallback_ClientFlag( localClientNum, flag, ‪set )
645 {
646  if( isdefined( level.callbackClientFlag ) )
647  {
648  [[level.callbackClientFlag]]( localClientNum, flag, ‪set );
649  }
650 }
651 
652 function ‪CodeCallback_ClientFlagAsVal(localClientNum, val)
653 {
654  if(isdefined(level._client_flagasval_callbacks) && isdefined(level._client_flagasval_callbacks[self.type]))
655  {
656  self thread [[level._client_flagasval_callbacks[self.type]]](localClientNum, val);
657  }
658 }
659 
660 function ‪CodeCallback_ExtraCamRenderHero( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex )
661 {
662  if ( isdefined( level.extra_cam_render_hero_func_callback ) )
663  {
664  [[level.extra_cam_render_hero_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex );
665  }
666 }
667 
668 function ‪CodeCallback_ExtraCamRenderLobbyClientHero( localClientNum, jobIndex, extraCamIndex, sessionMode )
669 {
670  if ( isdefined( level.extra_cam_render_lobby_client_hero_func_callback ) )
671  {
672  [[level.extra_cam_render_lobby_client_hero_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode );
673  }
674 }
675 
676 function ‪CodeCallback_ExtraCamRenderCurrentHeroHeadshot( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, isDefaultHero )
677 {
678  if ( isdefined( level.extra_cam_render_current_hero_headshot_func_callback ) )
679  {
680  [[level.extra_cam_render_current_hero_headshot_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, isDefaultHero );
681  }
682 }
683 
684 #if XFILE_VERSION >= 553
685 function ‪CodeCallback_ExtraCamRenderCharacterBodyItem( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex, defaultItemRender )
686 {
687 #else // #if XFILE_VERSION >= 553
688 function ‪CodeCallback_ExtraCamRenderCharacterBodyItem( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex )
689 {
690  defaultItemRender = false;
691 #endif // #else // #if XFILE_VERSION >= 553
692 
693  if ( isdefined( level.extra_cam_render_character_body_item_func_callback ) )
694  {
695  [[level.extra_cam_render_character_body_item_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex, defaultItemRender );
696  }
697 }
698 
699 #if XFILE_VERSION >= 553
700 function ‪CodeCallback_ExtraCamRenderCharacterHelmetItem( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex, defaultItemRender )
701 {
702 #else // #if XFILE_VERSION >= 553
703 function ‪CodeCallback_ExtraCamRenderCharacterHelmetItem( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex )
704 {
705  defaultItemRender = false;
706 #endif // #else // #if XFILE_VERSION >= 553
707 
708  if ( isdefined( level.extra_cam_render_character_helmet_item_func_callback ) )
709  {
710  [[level.extra_cam_render_character_helmet_item_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex, defaultItemRender );
711  }
712 }
713 
714 #if XFILE_VERSION >= 553
715 function ‪CodeCallback_ExtraCamRenderCharacterHeadItem( localClientNum, jobIndex, extraCamIndex, sessionMode, headIndex, defaultItemRender )
716 {
717 #else // #if XFILE_VERSION >= 553
718 function ‪CodeCallback_ExtraCamRenderCharacterHeadItem( localClientNum, jobIndex, extraCamIndex, sessionMode, headIndex )
719 {
720  defaultItemRender = false;
721 #endif // #else // #if XFILE_VERSION >= 553
722 
723  if ( isdefined( level.extra_cam_render_character_head_item_func_callback ) )
724  {
725  [[level.extra_cam_render_character_head_item_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, headIndex, defaultItemRender );
726  }
727 }
728 
729 function ‪CodeCallback_ExtraCamRenderOutfitPreview( localClientNum, jobIndex, extraCamIndex, sessionMode, outfitIndex )
730 {
731  if ( isdefined( level.extra_cam_render_outfit_preview_func_callback ) )
732  {
733  [[level.extra_cam_render_outfit_preview_func_callback]]( localClientNum, jobIndex, extraCamIndex, sessionMode, outfitIndex );
734  }
735 }
736 
737 #if XFILE_VERSION >= 568
738 function ‪CodeCallback_ExtraCamRenderWCPaintjobIcon( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot, isFilesharePreview )
739 {
740 #else //#if XFILE_VERSION >= 568
741 function ‪CodeCallback_ExtraCamRenderWCPaintjobIcon( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot )
742 {
743 #endif //#else //#if XFILE_VERSION >= 568
744  if ( isdefined( level.extra_cam_render_wc_paintjobicon_func_callback ) )
745  {
746 #if XFILE_VERSION >= 568
747  [[level.extra_cam_render_wc_paintjobicon_func_callback]]( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot, isFilesharePreview );
748 #else //#if XFILE_VERSION >= 568
749  [[level.extra_cam_render_wc_paintjobicon_func_callback]]( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot );
750 #endif //#else //#if XFILE_VERSION >= 568
751  }
752 }
753 
754 #if XFILE_VERSION >= 568
755 function ‪CodeCallback_ExtraCamRenderWCVariantIcon( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot, isFilesharePreview )
756 {
757 #else //#if XFILE_VERSION >= 568
758 function ‪CodeCallback_ExtraCamRenderWCVariantIcon( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot )
759 {
760 #endif //#else //#if XFILE_VERSION >= 568
761 
762  if ( isdefined( level.extra_cam_render_wc_varianticon_func_callback ) )
763  {
764 #if XFILE_VERSION >= 568
765  [[level.extra_cam_render_wc_varianticon_func_callback]]( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot, isFilesharePreview );
766 #else //#if XFILE_VERSION >= 568
767  [[level.extra_cam_render_wc_varianticon_func_callback]]( localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot );
768 #endif //#else //#if XFILE_VERSION >= 568
769  }
770 }
771 
772 function ‪CodeCallback_CollectiblesChanged( changedClient, collectiblesArray, localClientNum )
773 {
774  if ( isdefined( level.on_collectibles_change ) )
775  {
776  [[level.on_collectibles_change]]( changedClient, collectiblesArray, localClientNum );
777  }
778 }
779 
780 function ‪add_weapon_type( weapontype, ‪callback )
781 {
782  if ( !isdefined( level.weapon_type_callback_array ) )
783  {
784  level.weapon_type_callback_array = [];
785  }
786 
787  if ( IsString(weapontype) )
788  {
789  weapontype = GetWeapon(weapontype);
790  }
791 
792  level.weapon_type_callback_array[weapontype] = ‪callback;
793 }
794 
795 function ‪spawned_weapon_type( localClientNum )
796 {
797  weapontype = self.weapon.rootweapon;
798  if( isdefined( level.weapon_type_callback_array ) && isdefined( level.weapon_type_callback_array[weapontype] ) )
799  {
800  self thread [[level.weapon_type_callback_array[weapontype]]]( localClientNum );
801  }
802 }
803 
804 /*================
805 Called when an animation notetrack for calling a script function is encountered.
806 pSelf is the entity playing the animation that is executing the notetrack
807 label is the label set for the function to be called
808 param is a string containing all parameters passed through the notetrack
809 ================*/
810 function ‪CodeCallback_CallClientScript( pSelf, label, param )
811 {
812  if ( !IsDefined( level._animnotifyfuncs ) )
813  return;
814 
815  if ( IsDefined( level._animnotifyfuncs[ label ] ) )
816  {
817  pSelf [[ level._animnotifyfuncs[ label ] ]]( param );
818  }
819 }
820 
822 {
823  if ( !IsDefined( level._animnotifyfuncs ) )
824  return;
825 
826  if ( IsDefined( level._animnotifyfuncs[ label ] ) )
827  {
828  level [[ level._animnotifyfuncs[ label ] ]]( param );
829  }
830 }
831 
832 function ‪CodeCallback_ServerSceneInit( scene_name )
833 {
834  if( IsDefined( level.server_scenes[ scene_name ] ) )
835  {
836  level thread ‪scene::init( scene_name );
837  }
838 }
839 
840 function ‪CodeCallback_ServerScenePlay( scene_name )
841 {
842  level thread ‪scene_black_screen();
843 
844  if( isdefined( level.server_scenes[ scene_name ] ) )
845  {
846  level thread ‪scene::play( scene_name );
847  }
848 }
849 
850 function ‪CodeCallback_ServerSceneStop( scene_name )
851 {
852  level thread ‪scene_black_screen();
853 
854  if( isdefined( level.server_scenes[ scene_name ] ) )
855  {
856  level thread ‪scene::stop( scene_name, undefined, undefined, undefined, true );
857  }
858 }
859 
861 {
862  foreach ( i, player in level.localplayers )
863  {
864  if ( !isdefined( player.lui_black ) )
865  {
866  player.lui_black = CreateLUIMenu( i, "FullScreenBlack" );
867  OpenLUIMenu( i, player.lui_black );
868  }
869  }
870 
872 
873  foreach ( i, player in level.localplayers )
874  {
875  if ( isdefined( player.lui_black ) )
876  {
877  CloseLUIMenu( i, player.lui_black );
878  player.lui_black = undefined;
879  }
880  }
881 }
882 
883 function ‪CodeCallback_GadgetVisionPulse_Reveal(local_client_num, entity, bReveal )
884 {
885  if( isdefined( level.gadgetVisionPulse_reveal_func ) )
886  {
887  entity [[level.gadgetVisionPulse_reveal_func]](local_client_num, bReveal );
888  }
889 }
‪waitforclient
‪function waitforclient(client)
Definition: util_shared.csc:60
‪CodeCallback_PrecacheGameType
‪function CodeCallback_PrecacheGameType()
Definition: callbacks_shared.csc:398
‪callback
‪function callback(event, localclientnum, params)
Definition: callbacks_shared.csc:13
‪exploder
‪function exploder(exploder_id, n_localclientnumber)
Definition: exploder_shared.csc:297
‪CodeCallback_PlayAIFootstep
‪function CodeCallback_PlayAIFootstep(client_num, pos, surface, notetrack, bone)
Definition: callbacks_shared.csc:598
‪stop_exploder
‪function stop_exploder(exploder_id, n_localclientnumber)
Definition: exploder_shared.csc:368
‪CodeCallback_StateChange
‪function CodeCallback_StateChange(clientNum, system, newState)
Definition: callbacks_shared.csc:313
‪soundplayuidecodeloop
‪function soundplayuidecodeloop(decodeString, playTimeMs)
Definition: audio_shared.csc:1037
‪on_finalize_initialization
‪function on_finalize_initialization(func, obj)
Definition: callbacks_shared.csc:203
‪CodeCallback_ExtraCamRenderWCVariantIcon
‪function CodeCallback_ExtraCamRenderWCVariantIcon(localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot)
Definition: callbacks_shared.csc:758
‪remove_callback
‪function remove_callback(event, func, obj)
Definition: callbacks_shared.csc:150
‪CodeCallback_DemoPlayerSwitch
‪function CodeCallback_DemoPlayerSwitch(localClientNum)
Definition: callbacks_shared.csc:475
‪CodeCallback_ExtraCamRenderLobbyClientHero
‪function CodeCallback_ExtraCamRenderLobbyClientHero(localClientNum, jobIndex, extraCamIndex, sessionMode)
Definition: callbacks_shared.csc:668
‪CodeCallback_SoundPlayUiDecodeLoop
‪function CodeCallback_SoundPlayUiDecodeLoop(decodeString, playTimeMs)
Definition: callbacks_shared.csc:374
‪CodeCallback_ActivateExploder
‪function CodeCallback_ActivateExploder(exploder_id)
Definition: callbacks_shared.csc:512
‪CodeCallback_KillcamEnd
‪function CodeCallback_KillcamEnd(localClientNum, time)
Definition: callbacks_shared.csc:493
‪CodeCallback_StopLightLoopExploder
‪function CodeCallback_StopLightLoopExploder(exploderIndex)
Definition: callbacks_shared.csc:608
‪entity_callback
‪function entity_callback(event, localclientnum, params)
Definition: callbacks_shared.csc:53
‪add_entity_callback
‪function add_entity_callback(event, func, obj)
Definition: callbacks_shared.csc:121
‪CodeCallback_FinalizeInitialization
‪function CodeCallback_FinalizeInitialization()
Definition: callbacks_shared.csc:303
‪CodeCallback_PlayerSpawned
‪function CodeCallback_PlayerSpawned(localClientNum)
Definition: callbacks_shared.csc:379
‪on_start_gametype
‪function on_start_gametype(func, obj)
Definition: callbacks_shared.csc:285
‪play
‪function play(animation, v_origin_or_ent, v_angles_or_tag, n_rate=1, n_blend_in=.2, n_blend_out=.2, n_lerp, b_link=false)
Definition: animation_shared.csc:44
‪on_localclient_shutdown
‪function on_localclient_shutdown(func, obj)
Definition: callbacks_shared.csc:190
‪CodeCallback_ClientFlagAsVal
‪function CodeCallback_ClientFlagAsVal(localClientNum, val)
Definition: callbacks_shared.csc:652
‪CodeCallback_EntitySpawned
‪function CodeCallback_EntitySpawned(localClientNum)
Definition: callbacks_shared.csc:420
‪CodeCallback_ServerScenePlay
‪function CodeCallback_ServerScenePlay(scene_name)
Definition: callbacks_shared.csc:840
‪CodeCallback_GibEvent
‪function CodeCallback_GibEvent(localClientNum, type, locations)
Definition: callbacks_shared.csc:386
‪CodeCallback_CallClientScriptOnLevel
‪function CodeCallback_CallClientScriptOnLevel(label, param)
Definition: callbacks_shared.csc:821
‪CodeCallback_CollectiblesChanged
‪function CodeCallback_CollectiblesChanged(changedClient, collectiblesArray, localClientNum)
Definition: callbacks_shared.csc:772
‪CodeCallback_PreInitialization
‪function CodeCallback_PreInitialization()
Definition: callbacks_shared.csc:294
‪on_localclient_connect
‪function on_localclient_connect(func, obj)
Definition: callbacks_shared.csc:176
‪CodeCallback_DogSoundNotify
‪function CodeCallback_DogSoundNotify(client_num, entity, note)
Definition: callbacks_shared.csc:590
‪CodeCallback_EntityShutdown
‪function CodeCallback_EntityShutdown(localClientNum, entity)
Definition: callbacks_shared.csc:439
‪CodeCallback_ExtraCamRenderCharacterHelmetItem
‪function CodeCallback_ExtraCamRenderCharacterHelmetItem(localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex)
Definition: callbacks_shared.csc:703
‪add
‪function add(entity, dyingplayer, team, timeout)
Definition: _deathicons.gsc:43
‪CodeCallback_PlayLightLoopExploder
‪function CodeCallback_PlayLightLoopExploder(exploderIndex)
Definition: callbacks_shared.csc:603
‪CodeCallback_DemoJump
‪function CodeCallback_DemoJump(localClientNum, time)
Definition: callbacks_shared.csc:469
‪CodeCallback_ServerSceneStop
‪function CodeCallback_ServerSceneStop(scene_name)
Definition: callbacks_shared.csc:850
‪CodeCallback_LocalClientDisconnect
‪function CodeCallback_LocalClientDisconnect(clientNum)
Definition: callbacks_shared.csc:355
‪CodeCallback_ExtraCamRenderCurrentHeroHeadshot
‪function CodeCallback_ExtraCamRenderCurrentHeroHeadshot(localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, isDefaultHero)
Definition: callbacks_shared.csc:676
‪CodeCallback_ExtraCamRenderOutfitPreview
‪function CodeCallback_ExtraCamRenderOutfitPreview(localClientNum, jobIndex, extraCamIndex, sessionMode, outfitIndex)
Definition: callbacks_shared.csc:729
‪CodeCallback_ExtraCamRenderWCPaintjobIcon
‪function CodeCallback_ExtraCamRenderWCPaintjobIcon(localClientNum, extraCamIndex, jobIndex, attachmentVariantString, weaponOptions, weaponPlusAttachments, loadoutSlot, paintjobIndex, paintjobSlot)
Definition: callbacks_shared.csc:741
‪on_localplayer_spawned
‪function on_localplayer_spawned(func, obj)
Definition: callbacks_shared.csc:217
‪on_spawned
‪function on_spawned(func, obj)
Definition: callbacks_shared.csc:245
‪CodeCallback_PlayerFoliage
‪function CodeCallback_PlayerFoliage(client_num, player, firstperson, quiet)
Definition: callbacks_shared.csc:507
‪init_utility
‪function init_utility()
Definition: util_shared.csc:1259
‪CodeCallback_ServerSceneInit
‪function CodeCallback_ServerSceneInit(scene_name)
Definition: callbacks_shared.csc:832
‪CodeCallback_ExtraCamRenderHero
‪function CodeCallback_ExtraCamRenderHero(localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex)
Definition: callbacks_shared.csc:660
‪CodeCallback_ClientFlag
‪function CodeCallback_ClientFlag(localClientNum, flag, set)
Definition: callbacks_shared.csc:644
‪remove_on_localplayer_spawned
‪function remove_on_localplayer_spawned(func, obj)
Definition: callbacks_shared.csc:231
‪setCurrentAmbientState
‪function setCurrentAmbientState(ambientRoom, ambientPackage, roomColliderCent, packageColliderCent, defaultRoom)
Definition: audio_shared.csc:1055
‪activate_exploder
‪function activate_exploder(num)
Definition: exploder_shared.csc:309
‪add_weapon_type
‪function add_weapon_type(weapontype, callback)
Definition: callbacks_shared.csc:780
‪CodeCallback_CallClientScript
‪function CodeCallback_CallClientScript(pSelf, label, param)
Definition: callbacks_shared.csc:810
‪scene_black_screen
‪function scene_black_screen()
Definition: callbacks_shared.csc:860
‪CodeCallback_GadgetVisionPulse_Reveal
‪function CodeCallback_GadgetVisionPulse_Reveal(local_client_num, entity, bReveal)
Definition: callbacks_shared.csc:883
‪CodeCallback_PlayerSwitch
‪function CodeCallback_PlayerSwitch(localClientNum)
Definition: callbacks_shared.csc:481
‪CodeCallback_LocalClientConnect
‪function CodeCallback_LocalClientConnect(localClientNum)
Definition: callbacks_shared.csc:349
‪array
‪function filter array
Definition: array_shared.csc:16
‪CodeCallback_AirSupport
‪function CodeCallback_AirSupport(localClientNum, x, y, z, type, yaw, team, teamfaction, owner, exittype, time, height)
Definition: callbacks_shared.csc:461
‪playerFoliage
‪function playerFoliage(client_num, player, firstperson, quiet)
Definition: footsteps_shared.csc:106
‪CodeCallback_DeactivateExploder
‪function CodeCallback_DeactivateExploder(exploder_id)
Definition: callbacks_shared.csc:544
‪stop
‪function stop(n_blend=0.2)
Definition: animation_shared.gsc:97
‪CodeCallback_SoundSetAiAmbientState
‪function CodeCallback_SoundSetAiAmbientState(triggers, actors, numTriggers)
Definition: callbacks_shared.csc:370
‪init
‪function init()
Definition: struct.csc:1
‪run_pre_systems
‪function run_pre_systems()
Definition: system_shared.csc:128
‪add_callback
‪function add_callback(event, func, obj)
Definition: callbacks_shared.csc:93
‪CodeCallback_LocalClientChanged
‪function CodeCallback_LocalClientChanged(localClientNum, entity)
Definition: callbacks_shared.csc:455
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪IS_EQUAL
‪#define IS_EQUAL(__a, __b)
Definition: shared.gsh:250
‪CodeCallback_MapRestart
‪function CodeCallback_MapRestart()
Definition: callbacks_shared.csc:339
‪CodeCallback_StartGameType
‪function CodeCallback_StartGameType()
Definition: callbacks_shared.csc:409
‪CodeCallback_SoundSetAmbientState
‪function CodeCallback_SoundSetAmbientState(ambientRoom, ambientPackage, roomColliderCent, packageColliderCent, defaultRoom)
Definition: callbacks_shared.csc:365
‪CodeCallback_GlassSmash
‪function CodeCallback_GlassSmash(org, dir)
Definition: callbacks_shared.csc:360
‪CodeCallback_ExtraCamRenderCharacterHeadItem
‪function CodeCallback_ExtraCamRenderCharacterHeadItem(localClientNum, jobIndex, extraCamIndex, sessionMode, headIndex)
Definition: callbacks_shared.csc:718
‪run_post_systems
‪function run_post_systems()
Definition: system_shared.csc:82
‪remove_on_spawned
‪function remove_on_spawned(func, obj)
Definition: callbacks_shared.csc:259
‪remove_callback_on_death
‪function remove_callback_on_death(event, func)
Definition: callbacks_shared.csc:144
‪CodeCallback_ExtraCamRenderCharacterBodyItem
‪function CodeCallback_ExtraCamRenderCharacterBodyItem(localClientNum, jobIndex, extraCamIndex, sessionMode, characterIndex, itemIndex)
Definition: callbacks_shared.csc:688
‪CodeCallback_SoundNotify
‪function CodeCallback_SoundNotify(localClientNum, entity, note)
Definition: callbacks_shared.csc:425
‪on_shutdown
‪function on_shutdown(func, obj)
Definition: callbacks_shared.csc:272
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266
‪spawned_weapon_type
‪function spawned_weapon_type(localClientNum)
Definition: callbacks_shared.csc:795
‪CodeCallback_CreatingCorpse
‪function CodeCallback_CreatingCorpse(localClientNum, player)
Definition: callbacks_shared.csc:499
‪CodeCallback_KillcamBegin
‪function CodeCallback_KillcamBegin(localClientNum, time)
Definition: callbacks_shared.csc:487
‪CodeCallback_HostMigration
‪function CodeCallback_HostMigration(localClientNum)
Definition: callbacks_shared.csc:581
‪CodeCallback_LocalClientShutdown
‪function CodeCallback_LocalClientShutdown(localClientNum, entity)
Definition: callbacks_shared.csc:449
‪CodeCallback_ChargesHotWeaponSoundNotify
‪function CodeCallback_ChargesHotWeaponSoundNotify(localClientNum, weapon, chargeShotLevel)
Definition: callbacks_shared.csc:573