‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_traps.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\system_shared;
4 #using scripts\shared\visionset_mgr_shared;
5 
6 #insert scripts\shared\shared.gsh;
7 #insert scripts\shared\version.gsh;
8 
9 #insert scripts\zm\_zm_traps.gsh;
10 
11 #namespace zm_traps;
12 
13 ‪REGISTER_SYSTEM( "zm_traps", &‪__init__, undefined )
14 //TODO T7 - break out trap types into their own files to support p&p
15 
16 function ‪__init__()
17 {
18  //This requires a struct to be placed in the map with the following data:
19  //targetname = "zm_traps"
20  //script_noteworthy = this string should match that of the server side, ie. "electric"
21  s_traps_array = ‪struct::get_array( "zm_traps", "targetname" );
22  a_registered_traps = [];
23 
24  //Check to see if a trap type has been registered yet and if not, add it to the array to get registered
25  //We want to make sure each type is only registered once
26  foreach( trap in s_traps_array )
27  {
28  if( isdefined( trap.script_noteworthy ) )
29  {
30  if( !trap ‪is_trap_registered( a_registered_traps ) )
31  {
32  a_registered_traps[ trap.script_noteworthy ] = 1;
33  }
34  }
35  }
36 }
37 
38 function ‪is_trap_registered( a_registered_traps )//self = struct
39 {
40  return isdefined( a_registered_traps[ self.script_noteworthy ] );
41 }
‪get_array
‪function get_array(kvp_value, kvp_key="targetname")
Definition: struct.csc:34
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪__init__
‪function __init__()
Definition: _zm_traps.csc:16
‪is_trap_registered
‪function is_trap_registered(a_registered_traps)
Definition: _zm_traps.csc:38