‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_net.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\util_shared;
4 
5 #insert scripts\shared\shared.gsh;
6 
7 #namespace zm_net;
8 
9 function ‪network_choke_init( id, max )
10 {
11  if ( !isdefined( level.zombie_network_choke_ids_max ) )
12  {
13  level.zombie_network_choke_ids_max = [];
14  level.zombie_network_choke_ids_count = [];
15  }
16 
17  level.zombie_network_choke_ids_max[ id ] = max;
18  level.zombie_network_choke_ids_count[ id ] = 0;
19 
20  level thread ‪network_choke_thread( id );
21 }
22 
24 {
25  while( 1 )
26  {
29  level.zombie_network_choke_ids_count[ id ] = 0;
30  }
31 }
32 
33 function ‪network_choke_safe( id )
34 {
35  return( level.zombie_network_choke_ids_count[ id ] < level.zombie_network_choke_ids_max[ id ] );
36 }
37 
38 function ‪network_choke_action( id, choke_action, arg1, arg2, arg3 )
39 {
40  Assert( isdefined( level.zombie_network_choke_ids_max[ id ] ), "Network Choke: " + id + " undefined" );
41 
42  while( !‪network_choke_safe( id ) )
43  {
45  }
46 
47  level.zombie_network_choke_ids_count[ id ]++;
48 
49  if ( !isdefined( arg1 ) )
50  {
51  return ( [[choke_action]]() );
52  }
53 
54  if ( !isdefined( arg2 ) )
55  {
56  return ( [[choke_action]]( arg1 ) );
57  }
58 
59  if ( !isdefined( arg3 ) )
60  {
61  return ( [[choke_action]]( arg1, arg2 ) );
62  }
63 
64  return ( [[choke_action]]( arg1, arg2, arg3 ) );
65 }
66 
67 function ‪network_entity_valid( entity )
68 {
69  if( !isdefined( entity ) )
70  {
71  return false;
72  }
73 
74  return true;
75 }
76 
77 function ‪network_safe_init( id, max )
78 {
79  if ( !isdefined( level.zombie_network_choke_ids_max ) || !isdefined( level.zombie_network_choke_ids_max[ id ] ) )
80  {
81  ‪network_choke_init( id, max );
82  }
83 
84  assert( max == level.zombie_network_choke_ids_max[ id ] );
85 }
86 
87 // SPAWNING
88 function ‪_network_safe_spawn( classname, origin )
89 {
90  return ‪spawn( classname, origin );
91 }
92 
93 function ‪network_safe_spawn( id, max, classname, origin )
94 {
95  ‪network_safe_init( id, max );
96  return ( ‪network_choke_action( id,&‪_network_safe_spawn, classname, origin ) );
97 }
98 
99 // FX
100 function ‪_network_safe_play_fx_on_tag( fx, entity, tag )
101 {
102  if ( ‪network_entity_valid( entity ) )
103  {
104  PlayFxOnTag( fx, entity, tag );
105  }
106 }
107 
108 function ‪network_safe_play_fx_on_tag( id, max, fx, entity, tag )
109 {
110  ‪network_safe_init( id, max );
112 }
‪_network_safe_spawn
‪function _network_safe_spawn(classname, origin)
Definition: _zm_net.gsc:88
‪network_choke_action
‪function network_choke_action(id, choke_action, arg1, arg2, arg3)
Definition: _zm_net.gsc:38
‪spawn
‪function spawn(v_origin=(0, 0, 0), v_angles=(0, 0, 0))
Definition: struct.csc:23
‪network_safe_init
‪function network_safe_init(id, max)
Definition: _zm_net.gsc:77
‪network_choke_init
‪function network_choke_init(id, max)
Definition: _zm_net.gsc:9
‪_network_safe_play_fx_on_tag
‪function _network_safe_play_fx_on_tag(fx, entity, tag)
Definition: _zm_net.gsc:100
‪wait_network_frame
‪function wait_network_frame(n_count=1)
Definition: util_shared.gsc:64
‪network_choke_thread
‪function network_choke_thread(id)
Definition: _zm_net.gsc:23
‪network_safe_play_fx_on_tag
‪function network_safe_play_fx_on_tag(id, max, fx, entity, tag)
Definition: _zm_net.gsc:108
‪network_entity_valid
‪function network_entity_valid(entity)
Definition: _zm_net.gsc:67
‪network_safe_spawn
‪function network_safe_spawn(id, max, classname, origin)
Definition: _zm_net.gsc:93
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265
‪network_choke_safe
‪function network_choke_safe(id)
Definition: _zm_net.gsc:33