‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
ai_shared.csc
Go to the documentation of this file.
1 #insert scripts\shared\shared.gsh;
2 
3 function autoexec ‪main()
4 {
5  level._customActorCBFunc = &‪ai::spawned_callback;
6 }
7 
8 #namespace ai;
9 
10 function ‪add_ai_spawn_function( spawn_func )
11 {
12  if ( !IsDefined( level.spawn_ai_func ) )
13  {
14  level.spawn_ai_func = [];
15  }
16 
17  func = [];
18  func[ "function" ] = spawn_func;
19 
20  level.spawn_ai_func[ level.spawn_ai_func.size ] = func;
21 }
22 
23 function ‪add_archetype_spawn_function( archetype, spawn_func )
24 {
25  if ( !IsDefined( level.spawn_funcs ) )
26  {
27  level.spawn_funcs = [];
28  }
29 
30  if ( !IsDefined( level.spawn_funcs[archetype] ) )
31  {
32  level.spawn_funcs[archetype] = [];
33  }
34 
35  func = [];
36  func[ "function" ] = spawn_func;
37 
38  ‪ARRAY_ADD( level.spawn_funcs[ archetype ], func );
39 }
40 
41 function ‪spawned_callback( localClientNum )
42 {
43  if ( IsDefined( level.spawn_ai_func ) )
44  {
45  for ( index = 0; index < level.spawn_ai_func.size; index++ )
46  {
47  func = level.spawn_ai_func[ index ];
48  self thread [[ func[ "function" ] ]]( localClientNum );
49  }
50  }
51 
52  if ( IsDefined( level.spawn_funcs ) && IsDefined( level.spawn_funcs[ self.archetype ] ) )
53  {
54  for ( index = 0; index < level.spawn_funcs[ self.archetype ].size; index++ )
55  {
56  func = level.spawn_funcs[ self.archetype ][ index ];
57 
58  self thread [[ func[ "function" ] ]]( localClientNum );
59  }
60  }
61 }
62 
73 {
74  if( ‪IS_TRUE( level.clientFieldAICheck ) && !IsArchetypeLoaded( archetype ) )
75  return false;
76 
77  return true;
78 }
‪spawned_callback
‪function spawned_callback(localClientNum)
Definition: ai_shared.csc:41
‪main
‪function autoexec main()
Definition: ai_shared.csc:3
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪ARRAY_ADD
‪#define ARRAY_ADD(__array, __item)
Definition: shared.gsh:304
‪add_archetype_spawn_function
‪function add_archetype_spawn_function(archetype, spawn_func)
Definition: ai_shared.csc:23
‪shouldRegisterClientFieldForArchetype
‪function shouldRegisterClientFieldForArchetype(archetype)
Definition: ai_shared.csc:72
‪add_ai_spawn_function
‪function add_ai_spawn_function(spawn_func)
Definition: ai_shared.csc:10