‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
util_shared.gsc
Go to the documentation of this file.
1 #using scripts\shared\array_shared;
2 #using scripts\shared\clientfield_shared;
3 #using scripts\shared\flag_shared;
4 #using scripts\shared\flagsys_shared;
5 #using scripts\shared\lui_shared;
6 #using scripts\shared\math_shared;
7 #using scripts\shared\scene_shared;
8 #using scripts\shared\spawner_shared;
9 
10 #insert scripts\shared\shared.gsh;
11 #insert scripts\shared\statstable_shared.gsh;
12 
13 /*
14  util.gsc
15 
16  This is a utility script common to all game modes. Don't add anything with calls to game type
17  specific script API calls.
18 */
19 
20 
21 #precache( "lui_menu", "CPChyron" );
22 #precache( "lui_menu_data", "line1full" );
23 #precache( "lui_menu_data", "line1short" );
24 #precache( "lui_menu_data", "line2full" );
25 #precache( "lui_menu_data", "line2short" );
26 #precache( "lui_menu_data", "line3full" );
27 #precache( "lui_menu_data", "line3short" );
28 #precache( "lui_menu_data", "line4full" );
29 #precache( "lui_menu_data", "line4short" );
30 #precache( "lui_menu_data", "line5full" );
31 #precache( "lui_menu_data", "line5short" );
32 #precache( "lui_menu_data", "close_current_menu" );
33 
34 
35 #namespace util;
36 
37 
52 function ‪empty( ‪a, b, c, d, e )
53 {
54 }
55 
64 function ‪wait_network_frame( n_count = 1 )
65 {
66  if ( NumRemoteClients() )
67  {
68  for ( i = 0; i < n_count; i++ )
69  {
70  snapshot_ids = GetSnapShotIndexArray();
71 
72  acked = undefined;
73  while ( !isdefined( acked ) )
74  {
75  level waittill( "snapacknowledged" );
76  acked = SnapShotAcknowledged( snapshot_ids );
77  }
78  }
79  }
80  else
81  {
82  wait ( 0.1 * n_count );
83  }
84 }
85 
86 function ‪streamer_wait( n_stream_request_id, n_wait_frames = 0, n_timeout = 0, b_bonuszm_streamer_fallback = true )
87 {
88  level endon( "loading_movie_done" ); // If loading movie finishes, we can't wait any longer
89 
90  //extra network frames to wait before checking the streamer
91  if( n_wait_frames > 0 )
92  {
93  ‪util::wait_network_frame( n_wait_frames );
94  }
95 
96  // sjakatdar (10/07/2015) - Added a default timeout in the case of campaign zombies
97  // We load additional assets which are not part of the streamer hints and can cause long delay
98  if( ‪IS_BONUSZM && ‪IS_TRUE(b_bonuszm_streamer_fallback) )
99  {
100  if( !n_timeout )
101  n_timeout = 7;
102  }
103 
104  ‪timeout = GetTime() + ( n_timeout * 1000 );
105 
106  if ( self == level )
107  {
108  n_num_streamers_ready = 0;
109 
110  do
111  {
113 
114  n_num_streamers_ready = 0;
115 
116  foreach ( player in GetPlayers() )
117  {
118  if ( ( isdefined( n_stream_request_id ) ? player IsStreamerReady( n_stream_request_id ) : player IsStreamerReady() ) )
119  {
120  n_num_streamers_ready++;
121  }
122  }
123 
124  if( n_timeout > 0 && GetTime() > ‪timeout )
125  {
126  break;
127  }
128  }
129  while ( n_num_streamers_ready < Max( 1, GetPlayers().size ) );
130  }
131  else
132  {
133  self endon( "disconnect" );
134 
135  do
136  {
138 
139  if( n_timeout > 0 && GetTime() > ‪timeout )
140  {
141  break;
142  }
143  }
144  while ( !( isdefined( n_stream_request_id ) ? self IsStreamerReady( n_stream_request_id ) : self IsStreamerReady() ) );
145  }
146 }
147 
148 //-- Other / Unsorted --//
149 /#
151 {
152  for (i=0;i<‪timer*20;i++)
153  {
154  line (start, ‪end, (1,1,0.5));
156  }
157 }
158 
159 function ‪debug_line( start, ‪end, color, alpha, depthTest, duration )
160 {
161  if ( !isdefined( color ) )
162  {
163  color = (1, 1, 1 );
164  }
165 
166  if ( !isdefined( alpha ) )
167  {
168  alpha = 1;
169  }
170 
171  if ( !isdefined( depthTest ) )
172  {
173  depthTest = 0;
174  }
175 
176  if ( !isdefined( duration ) )
177  {
178  duration = 100;
179  }
180 
181  line(start, ‪end, color, alpha, depthTest, duration );
182 }
183 
184 
185 function ‪debug_spherical_cone( origin, domeApex, angle, slices, color, alpha, depthTest, duration )
186 {
187  if ( !isdefined( slices ) )
188  {
189  slices = 10;
190  }
191 
192  if ( !isdefined( color ) )
193  {
194  color = ( 1, 1, 1 );
195  }
196 
197  if ( !isdefined( alpha ) )
198  {
199  alpha = 1;
200  }
201 
202  if ( !isdefined( depthTest ) )
203  {
204  depthTest = 0;
205  }
206 
207  if ( !isdefined( duration ) )
208  {
209  duration = 100;
210  }
211 
212  sphericalcone( origin, domeApex, angle, slices, color, alpha, depthTest, duration );
213 }
214 
215 function ‪debug_sphere( origin, radius, color, alpha, time )
216 {
217 
218  if ( !isdefined(time) )
219  {
220  time = 1000;
221  }
222  if ( !isdefined(color) )
223  {
224  color = (1,1,1);
225  }
226 
227  sides = Int(10 * ( 1 + Int(radius) % 100 ));
228  sphere( origin, radius, color, alpha, true, sides, time );
229 
230 }
231 #/
232 
233 function ‪waittillend(msg)
234 {
235  self waittillmatch (msg, "end");
236 }
237 
238 function ‪track(spot_to_track)
239 {
240  if(isdefined(self.current_target))
241  {
242  if(spot_to_track == self.current_target)
243  return;
244  }
245  self.current_target = spot_to_track;
246 }
247 
248 function ‪waittill_string( msg, ent )
249 {
250  if ( msg != "death" )
251  {
252  self endon ("death");
253  }
254 
255  ent endon( "die" );
256  self waittill( msg );
257  ent notify( "returned", msg );
258 }
259 
260 function ‪waittill_level_string( msg, ent, otherEnt )
261 {
262  otherEnt endon ("death");
263  ent endon( "die" );
264 
265  level waittill( msg );
266  ent notify( "returned", msg );
267 }
268 
276 function ‪waittill_multiple( ... )
277 {
278  s_tracker = SpawnStruct();
279  s_tracker._wait_count = 0;
280 
281  for ( i = 0; i < vararg.size; i++ )
282  {
283  self thread ‪_waitlogic( s_tracker, vararg[ i ] );
284  }
285 
286  if ( s_tracker._wait_count > 0 )
287  {
288  s_tracker waittill( "waitlogic_finished" );
289  }
290 }
291 
303 function ‪waittill_either( msg1, msg2 )
304 {
305  self endon( msg1 );
306  self waittill( msg2 );
307 }
308 
319 function ‪break_glass( n_radius = 50 )
320 {
321  const N_MIN_DAMAGE = 500;
322  const N_MAX_DAMAGE = 500;
323 
324  //if passed as a notetrack param, convert to a float
325  n_radius = Float( n_radius );
326 
327  // if n_radius is set to -1, remove the offset for the damage
328  // Used when we have an AI dropping through a pane of glass instead of jumping through a glass window
329  if( n_radius == -1 )
330  {
331  v_origin_offset = ( 0, 0, 0 );
332  n_radius = 100;
333  }
334  //offset the damage from the origin of the AI
335  else
336  {
337  v_origin_offset = ( 0, 0, 40 );
338  }
339 
340  GlassRadiusDamage( self.origin + v_origin_offset, n_radius, N_MAX_DAMAGE, N_MIN_DAMAGE );
341 }
342 
351 {
352  ‪a_ents = [];
353  a_notifies = [];
354 
355  for ( i = 0; i < vararg.size; i++ )
356  {
357  if ( i % 2 )
358  {
359  ‪ARRAY_ADD( a_notifies, vararg[ i ] );
360  }
361  else
362  {
363  ‪ARRAY_ADD( ‪a_ents, vararg[ i ] );
364  }
365  }
366 
367  s_tracker = SpawnStruct();
368  s_tracker._wait_count = 0;
369 
370  for ( i = 0; i < ‪a_ents.size; i++ )
371  {
372  ent = ‪a_ents[ i ];
373 
374  if ( isdefined( ent ) )
375  {
376  ent thread ‪_waitlogic( s_tracker, a_notifies[ i ] );
377  }
378  }
379 
380  if ( s_tracker._wait_count > 0 )
381  {
382  s_tracker waittill( "waitlogic_finished" );
383  }
384 }
385 
386 function ‪_waitlogic( s_tracker, notifies )
387 {
388  s_tracker._wait_count++;
389 
390  ‪ARRAY_ADD( notifies, "death" );
391  ‪waittill_any_array( notifies );
392 
393  s_tracker._wait_count--;
394  if ( s_tracker._wait_count == 0 )
395  {
396  s_tracker notify( "waitlogic_finished" );
397  }
398 }
399 
416 function ‪waittill_any_return( string1, string2, string3, string4, string5, string6, string7 )
417 {
418  if ((!isdefined (string1) || string1 != "death") &&
419  (!isdefined (string2) || string2 != "death") &&
420  (!isdefined (string3) || string3 != "death") &&
421  (!isdefined (string4) || string4 != "death") &&
422  (!isdefined (string5) || string5 != "death") &&
423  (!isdefined (string6) || string6 != "death") &&
424  (!isdefined (string7) || string7 != "death"))
425  self endon ("death");
426 
427  ent = SpawnStruct();
428 
429  if (isdefined (string1))
430  self thread ‪waittill_string (string1, ent);
431 
432  if (isdefined (string2))
433  self thread ‪waittill_string (string2, ent);
434 
435  if (isdefined (string3))
436  self thread ‪waittill_string (string3, ent);
437 
438  if (isdefined (string4))
439  self thread ‪waittill_string (string4, ent);
440 
441  if (isdefined (string5))
442  self thread ‪waittill_string (string5, ent);
443 
444  if (isdefined (string6))
445  self thread ‪waittill_string (string6, ent);
446 
447  if (isdefined (string7))
448  self thread ‪waittill_string (string7, ent);
449 
450  ent waittill ("returned", msg);
451  ent notify ("die");
452  return msg;
453 }
454 
455 
474 function ‪waittill_any_ex( ... )
475 {
476  s_common = SpawnStruct();
477 
478  // You can run on an ent if you like instead of passing in an ent as the first argument.
479  e_current = self;
480 
481  // if the first parameter is a number, it's a timeout value
482  n_arg_index = 0;
483  if ( StrIsNumber( vararg[ 0 ] ) )
484  {
485  n_timeout = vararg[ 0 ];
486  n_arg_index++;
487 
488  if ( n_timeout > 0 )
489  {
490  s_common thread ‪_timeout( n_timeout );
491  }
492  }
493 
494  // If we have an array, use that as the argument list
495  if ( IsArray( vararg[ n_arg_index ] ) )
496  {
497  a_params = vararg[ n_arg_index ];
498  n_start_index = 0;
499  }
500  // Otherwise use the full parameter list.
501  else
502  {
503  a_params = vararg;
504  n_start_index = n_arg_index;
505  }
506 
507  // Run through the parameter list.
508  // If the parameter is a string, assume it's for the last specified ent
509  // If the paramter is not a string, assume it's a new ent specification.
510  for( i=n_start_index; i<a_params.size; i++ )
511  {
512  if ( !IsString( a_params[i] ) )
513  {
514  // Non string parameter == ent specification. All strings that follow are notifies to wait for on this ent.
515  e_current = a_params[i];
516  }
517  else
518  {
519  // string parameter == notify to check for
520  if ( isdefined( e_current ) )
521  {
522  e_current thread ‪waittill_string ( a_params[i], s_common );
523  }
524  }
525  }
526 
527  s_common waittill ( "returned", str_notify );
528  s_common notify ( "die" );
529 
530  return str_notify;
531 }
532 
533 
544 function ‪waittill_any_array_return( a_notifies )
545 {
546  if ( IsInArray( a_notifies, "death" ) )
547  {
548  self endon("death");
549  }
550 
551  s_tracker = SpawnStruct();
552 
553  foreach ( str_notify in a_notifies )
554  {
555  if ( isdefined( str_notify ) )
556  {
557  self thread ‪waittill_string( str_notify, s_tracker );
558  }
559  }
560 
561  s_tracker waittill( "returned", msg );
562  s_tracker notify( "die" );
563  return msg;
564 }
565 
581 function ‪waittill_any( str_notify1, str_notify2, str_notify3, str_notify4, str_notify5, str_notify6 )
582 {
583  Assert( isdefined( str_notify1 ) );
584 
585  ‪waittill_any_array( ‪array( str_notify1, str_notify2, str_notify3, str_notify4, str_notify5, str_notify6 ) );
586 }
587 
598 function ‪waittill_any_array( a_notifies )
599 {
600  ‪MAKE_ARRAY( a_notifies );
601 
602  assert( isdefined( a_notifies[0] ),
603  "At least the first element has to be defined for waittill_any_array." );
604 
605  for ( i = 1; i < a_notifies.size; i++ )
606  {
607  if ( isdefined( a_notifies[i] ) )
608  {
609  self endon( a_notifies[i] );
610  }
611  }
612 
613  self waittill( a_notifies[0] );
614 }
615 
631 function ‪waittill_any_timeout( n_timeout, string1, string2, string3, string4, string5 )
632 {
633  if ( ( !isdefined( string1 ) || string1 != "death" ) &&
634  ( !isdefined( string2 ) || string2 != "death" ) &&
635  ( !isdefined( string3 ) || string3 != "death" ) &&
636  ( !isdefined( string4 ) || string4 != "death" ) &&
637  ( !isdefined( string5 ) || string5 != "death" ) )
638  self endon( "death" );
639 
640  ent = spawnstruct();
641 
642  if ( isdefined( string1 ) )
643  self thread ‪waittill_string( string1, ent );
644 
645  if ( isdefined( string2 ) )
646  self thread ‪waittill_string( string2, ent );
647 
648  if ( isdefined( string3 ) )
649  self thread ‪waittill_string( string3, ent );
650 
651  if ( isdefined( string4 ) )
652  self thread ‪waittill_string( string4, ent );
653 
654  if ( isdefined( string5 ) )
655  self thread ‪waittill_string( string5, ent );
656 
657  ent thread ‪_timeout( n_timeout );
658 
659  ent waittill( "returned", msg );
660  ent notify( "die" );
661  return msg;
662 }
663 
680 function ‪waittill_level_any_timeout( n_timeout, otherEnt, string1, string2, string3, string4, string5 )
681 {
682  otherEnt endon( "death" );
683 
684  ent = spawnstruct();
685 
686  if ( isdefined( string1 ) )
687  level thread ‪waittill_level_string( string1, ent, otherEnt );
688 
689  if ( isdefined( string2 ) )
690  level thread ‪waittill_level_string( string2, ent, otherEnt );
691 
692  if ( isdefined( string3 ) )
693  level thread ‪waittill_level_string( string3, ent, otherEnt );
694 
695  if ( isdefined( string4 ) )
696  level thread ‪waittill_level_string( string4, ent, otherEnt );
697 
698  if ( isdefined( string5 ) )
699  level thread ‪waittill_level_string( string5, ent, otherEnt );
700 
701  if ( isdefined( otherEnt ) )
702  otherEnt thread ‪waittill_string( "death", ent );
703 
704  ent thread ‪_timeout( n_timeout );
705 
706  ent waittill( "returned", msg );
707  ent notify( "die" );
708  return msg;
709 }
710 
712 {
713  self endon( "die" );
714 
715  wait( ‪delay );
716  self notify( "returned", "timeout" );
717 }
718 
719 
737 function ‪waittill_any_ents( ent1, string1, ent2, string2, ent3, string3, ent4, string4, ent5, string5, ent6, string6,ent7, string7 )
738 {
739  assert( isdefined( ent1 ) );
740  assert( isdefined( string1 ) );
741 
742  if ( ( isdefined( ent2 ) ) && ( isdefined( string2 ) ) )
743  ent2 endon( string2 );
744 
745  if ( ( isdefined( ent3 ) ) && ( isdefined( string3 ) ) )
746  ent3 endon( string3 );
747 
748  if ( ( isdefined( ent4 ) ) && ( isdefined( string4 ) ) )
749  ent4 endon( string4 );
750 
751  if ( ( isdefined( ent5 ) ) && ( isdefined( string5 ) ) )
752  ent5 endon( string5 );
753 
754  if ( ( isdefined( ent6 ) ) && ( isdefined( string6 ) ) )
755  ent6 endon( string6 );
756 
757  if ( ( isdefined( ent7 ) ) && ( isdefined( string7 ) ) )
758  ent7 endon( string7 );
759 
760  ent1 waittill( string1 );
761 }
762 
776 function ‪waittill_any_ents_two( ent1, string1, ent2, string2 )
777 {
778  assert( isdefined( ent1 ) );
779  assert( isdefined( string1 ) );
780 
781  if ( ( isdefined( ent2 ) ) && ( isdefined( string2 ) ) )
782  ent2 endon( string2 );
783 
784  ent1 waittill( string1 );
785 }
786 
796 function ‪isFlashed()
797 {
798  if ( !isdefined( self.flashEndTime ) )
799  return false;
800 
801  return GetTime() < self.flashEndTime;
802 }
803 
813 function ‪isStunned()
814 {
815  if ( !isdefined( self.flashEndTime ) )
816  return false;
817 
818  return GetTime() < self.flashEndTime;
819 }
820 
838 function ‪single_func( entity, func, arg1, arg2, arg3, arg4, arg5, arg6 )
839 {
840  if ( !isdefined( entity ) )
841  {
842  entity = level;
843  }
844 
845  if ( isdefined( arg6 ) )
846  {
847  return entity [[ func ]]( arg1, arg2, arg3, arg4, arg5, arg6 );
848  }
849  else if ( isdefined( arg5 ) )
850  {
851  return entity [[ func ]]( arg1, arg2, arg3, arg4, arg5 );
852  }
853  else if ( isdefined( arg4 ) )
854  {
855  return entity [[ func ]]( arg1, arg2, arg3, arg4 );
856  }
857  else if ( isdefined( arg3 ) )
858  {
859  return entity [[ func ]]( arg1, arg2, arg3 );
860  }
861  else if ( isdefined( arg2 ) )
862  {
863  return entity [[ func ]]( arg1, arg2 );
864  }
865  else if ( isdefined( arg1 ) )
866  {
867  return entity [[ func ]]( arg1 );
868  }
869  else
870  {
871  return entity [[ func ]]();
872  }
873 }
874 
891 function ‪new_func( func, arg1, arg2, arg3, arg4, arg5, arg6 )
892 {
893  s_func = SpawnStruct();
894  s_func.func = func;
895  s_func.arg1 = arg1;
896  s_func.arg2 = arg2;
897  s_func.arg3 = arg3;
898  s_func.arg4 = arg4;
899  s_func.arg5 = arg5;
900  s_func.arg6 = arg6;
901  return s_func;
902 }
903 
914 function ‪call_func( s_func )
915 {
916  return ‪single_func( self, s_func.func, s_func.arg1, s_func.arg2, s_func.arg3, s_func.arg4, s_func.arg5, s_func.arg6 );
917 }
918 
936 function ‪single_thread(entity, func, arg1, arg2, arg3, arg4, arg5, arg6 )
937 {
938  Assert( isdefined( entity ), "Undefined entity passed to util::single_thread()" );
939 
940  if ( isdefined( arg6 ) )
941  {
942  entity thread [[ func ]]( arg1, arg2, arg3, arg4, arg5, arg6 );
943  }
944  else if ( isdefined( arg5 ) )
945  {
946  entity thread [[ func ]](arg1, arg2, arg3, arg4, arg5);
947  }
948  else if ( isdefined( arg4 ) )
949  {
950  entity thread [[ func ]]( arg1, arg2, arg3, arg4 );
951  }
952  else if ( isdefined( arg3 ) )
953  {
954  entity thread [[ func ]]( arg1, arg2, arg3 );
955  }
956  else if ( isdefined( arg2 ) )
957  {
958  entity thread [[ func ]]( arg1, arg2 );
959  }
960  else if ( isdefined( arg1 ) )
961  {
962  entity thread [[ func ]]( arg1 );
963  }
964  else
965  {
966  entity thread [[ func ]]();
967  }
968 }
969 
970 function ‪script_delay()
971 {
972  if ( isdefined( self.‪script_delay ) )
973  {
974  wait self.script_delay;
975  return true;
976  }
977  else if ( isdefined( self.script_delay_min ) && isdefined( self.script_delay_max ) )
978  {
979  if ( self.script_delay_max > self.script_delay_min )
980  {
981  wait RandomFloatrange( self.script_delay_min, self.script_delay_max );
982  }
983  else
984  {
985  wait self.script_delay_min;
986  }
987 
988  return true;
989  }
990 
991  return false;
992 }
993 
1011 function ‪timeout( n_time, func, arg1, arg2, arg3, arg4, arg5, arg6 )
1012 {
1013  ‪TIMEOUT( n_time );
1014  ‪single_func( self, func, arg1, arg2, arg3, arg4, arg5, arg6 );
1015 }
1016 
1018 {
1019  tokens = strtok( flags, " " );
1020 
1021  // create the flag if level script does not
1022  for( i=0; i < tokens.size; i++ )
1023  {
1024  if ( !level ‪flag::exists( tokens[ i ] ) )
1025  {
1026  level ‪flag::init( tokens[ i ], undefined, true );
1027  }
1028  }
1029 
1030  return tokens;
1031 }
1032 
1033 function ‪fileprint_start( file )
1034 {
1035 }
1036 
1037 function ‪fileprint_map_start( file )
1038 {
1039 }
1040 
1041 function ‪fileprint_chk( file , str )
1042 {
1043 }
1044 
1045 function ‪fileprint_map_header( bInclude_blank_worldspawn )
1046 {
1047 }
1048 
1049 function ‪fileprint_map_keypairprint( key1, key2 )
1050 {
1051 }
1052 
1054 {
1055 }
1056 
1058 {
1059 }
1060 
1062 {
1063 }
1064 
1065 function ‪fileprint_radiant_vec( vector )
1066 {
1067 }
1068 
1069 // Facial animation event notify wrappers
1070 function ‪death_notify_wrapper( attacker, damageType )
1071 {
1072  level notify( "face", "death", self );
1073  self notify( "death", attacker, damageType );
1074 }
1075 
1076 function ‪damage_notify_wrapper( ‪damage, attacker, direction_vec, point, type, modelName, tagName, partName, iDFlags )
1077 {
1078  level notify( "face", "damage", self );
1079  self notify( "damage", ‪damage, attacker, direction_vec, point, type, modelName, tagName, partName, iDFlags );
1080 }
1081 
1083 {
1084  level notify( "face", "explode", self );
1085  self notify( "explode" );
1086 }
1087 
1089 {
1090  level notify( "face", "alert", self );
1091  self notify( "alert" );
1092 }
1093 
1095 {
1096  level notify( "face", "shoot", self );
1097  self notify( "shoot" );
1098 }
1099 
1101 {
1102  level notify( "face", "melee", self );
1103  self notify( "melee" );
1104 }
1105 
1107 {
1108  return ( !self.disabledUsability );
1109 }
1110 
1111 
1113 {
1114  self.disabledUsability++;
1115  self DisableUsability();
1116 }
1117 
1118 
1120 {
1121  self.disabledUsability--;
1122 
1123  assert( self.disabledUsability >= 0 );
1124 
1125  if ( !self.disabledUsability )
1126  self EnableUsability();
1127 }
1128 
1129 
1131 {
1132  self.disabledUsability = 0;
1133  self EnableUsability();
1134 }
1135 
1136 
1138 {
1139  ‪DEFAULT( self.disabledWeapon, 0 );
1140 
1141  self.disabledWeapon++;
1142  self DisableWeapons();
1143 }
1144 
1146 {
1147  if ( self.disabledWeapon > 0 )
1148  {
1149  self.disabledWeapon--;
1150 
1151  if ( !self.disabledWeapon )
1152  {
1153  self EnableWeapons();
1154  }
1155  }
1156 }
1157 
1159 {
1160  return ( !self.disabledWeapon );
1161 }
1162 
1163 function ‪orient_to_normal( normal )
1164 {
1165  hor_normal = ( normal[ 0 ], normal[ 1 ], 0 );
1166  hor_length = Length( hor_normal );
1167 
1168  if ( !hor_length )
1169  {
1170  return ( 0, 0, 0 );
1171  }
1172 
1173  hor_dir = VectorNormalize( hor_normal );
1174  neg_height = normal[ 2 ] * -1;
1175  tangent = ( hor_dir[ 0 ] * neg_height, hor_dir[ 1 ] * neg_height, hor_length );
1176  plant_angle = VectorToAngles( tangent );
1177 
1178  //println("^6hor_normal is ", hor_normal);
1179  //println("^6hor_length is ", hor_length);
1180  //println("^6hor_dir is ", hor_dir);
1181  //println("^6neg_height is ", neg_height);
1182  //println("^6tangent is ", tangent);
1183  //println("^6plant_angle is ", plant_angle);
1184 
1185  return plant_angle;
1186 }
1187 
1202 function ‪delay( time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 )
1203 {
1204  self thread ‪_delay( time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 );
1205 }
1206 
1207 function ‪_delay( time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 )
1208 {
1209  self endon( "death" );
1210 
1211  if ( isdefined( str_endon ) )
1212  {
1213  self endon( str_endon );
1214  }
1215 
1216  if ( IsString( time_or_notify ) )
1217  {
1218  self waittill( time_or_notify );
1219  }
1220  else
1221  {
1222  wait time_or_notify;
1223  }
1224 
1225  ‪single_func( self, func, arg1, arg2, arg3, arg4, arg5, arg6 );
1226 }
1227 
1242 function ‪delay_network_frames( n_frames, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 )
1243 {
1244  self thread ‪_delay_network_frames( n_frames, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 );
1245 }
1246 
1247 function ‪_delay_network_frames( n_frames, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6 )
1248 {
1249  self endon( "entityshutdown" );
1250 
1251  if ( isdefined( str_endon ) )
1252  {
1253  self endon( str_endon );
1254  }
1255 
1256  ‪util::wait_network_frame( n_frames );
1257 
1258  ‪single_func( self, func, arg1, arg2, arg3, arg4, arg5, arg6 );
1259 }
1260 
1278 function ‪delay_notify( time_or_notify, str_notify, str_endon, arg1, arg2, arg3, arg4, arg5 )
1279 {
1280  self thread ‪_delay_notify( time_or_notify, str_notify, str_endon, arg1, arg2, arg3, arg4, arg5 );
1281 }
1282 
1283 function ‪_delay_notify( time_or_notify, str_notify, str_endon, arg1, arg2, arg3, arg4, arg5 )
1284 {
1285  self endon( "death" );
1286 
1287  if ( isdefined( str_endon ) )
1288  {
1289  self endon( str_endon );
1290  }
1291 
1292  if ( IsString( time_or_notify ) )
1293  {
1294  self waittill( time_or_notify );
1295  }
1296  else
1297  {
1298  wait time_or_notify;
1299  }
1300 
1301  self notify( str_notify, arg1, arg2, arg3, arg4, arg5 );
1302 }
1303 
1304 /*
1305 =============
1307 "Function Name: ter_op( <statement> , <true_value> , <false_value> )"
1308 <br/>"Summary: Functon that serves as a tertiary operator in C/C++"
1309 "Module: Utility"
1310 "CallOn: "
1311 <br/>"Mandatory Argument(s): <statement>: The statement to evaluate"
1312 <br/>"Mandatory Argument(s): <true_value>: The value that is returned when the statement evaluates to true"
1313 <br/>"Mandatory Argument(s): <false_value>: That value that is returned when the statement evaluates to false"
1314 <br/>"Example:x = ter_op( x > 5, 2, 7 );"
1315 <br/>"Single Player / Multi Player: both"
1317 =============
1318 */
1319 /* DEAD CODE REMOVAL
1320 function ter_op( statement, true_value, false_value )
1321 {
1322  if ( statement )
1323  return true_value;
1324  return false_value;
1325 }
1326 */
1327 
1338 function ‪get_closest_player( org, str_team )
1339 {
1340  players = GetPlayers( str_team );
1341  return ArraySort( players, org, true, 1 )[0];
1342 }
1343 
1344 function ‪registerClientSys(sSysName)
1345 {
1346  if(!isdefined(level._clientSys))
1347  {
1348  level._clientSys = [];
1349  }
1350 
1351  if(level._clientSys.size >= 32)
1352  {
1353  /#AssertMsg("Max num client systems exceeded.");#/
1354  return;
1355  }
1356 
1357  if(isdefined(level._clientSys[sSysName]))
1358  {
1359  /#AssertMsg("Attempt to re-register client system : " + sSysName);#/
1360  return;
1361  }
1362  else
1363  {
1364  level._clientSys[sSysName] = spawnstruct();
1365  level._clientSys[sSysName].sysID = ClientSysRegister(sSysName);
1366  }
1367 }
1368 
1369 function ‪setClientSysState(sSysName, sSysState, player)
1370 {
1371  if(!isdefined(level._clientSys))
1372  {
1373  /#AssertMsg("setClientSysState called before registration of any systems.");#/
1374  return;
1375  }
1376 
1377  if(!isdefined(level._clientSys[sSysName]))
1378  {
1379  /#AssertMsg("setClientSysState called on unregistered system " + sSysName);#/
1380  return;
1381  }
1382 
1383  if(isdefined(player))
1384  {
1385  player ClientSysSetState(level._clientSys[sSysName].sysID, sSysState);
1386  }
1387  else
1388  {
1389  ClientSysSetState(level._clientSys[sSysName].sysID, sSysState);
1390  level._clientSys[sSysName].sysState = sSysState;
1391  }
1392 }
1393 
1394 function ‪getClientSysState(sSysName)
1395 {
1396  if(!isdefined(level._clientSys))
1397  {
1398  /#AssertMsg("Cannot getClientSysState before registering any client systems.");#/
1399  return "";
1400  }
1401 
1402  if(!isdefined(level._clientSys[sSysName]))
1403  {
1404  /#AssertMsg("Client system " + sSysName + " cannot return state, as it is unregistered.");#/
1405  return "";
1406  }
1407 
1408  if(isdefined(level._clientSys[sSysName].sysState))
1409  {
1410  return level._clientSys[sSysName].sysState;
1411  }
1412 
1413  return "";
1414 }
1415 
1416 function ‪clientNotify(event)
1417 {
1418  if(level.clientscripts)
1419  {
1420  if(IsPlayer(self))
1421  {
1422  ‪setClientSysState("levelNotify", event, self);
1423  }
1424  else
1425  {
1426  ‪setClientSysState("levelNotify", event);
1427  }
1428  }
1429 }
1430 
1431 function ‪coopGame()
1432 {
1433  return ( SessionModeIsSystemlink() || ( SessionModeIsOnlineGame() || IsSplitScreen() ) );
1434 }
1435 
1448 function ‪is_looking_at( ent_or_org, n_dot_range = 0.67, do_trace = false, v_offset )
1449 {
1450  Assert( isdefined( ent_or_org ), "ent_or_org is required parameter for is_facing function" );
1451 
1452  v_point = ( IsVec( ent_or_org ) ? ent_or_org : ent_or_org.origin );
1453 
1454  if ( IsVec( v_offset ) )
1455  {
1456  v_point += v_offset;
1457  }
1458 
1459  b_can_see = false;
1460  b_use_tag_eye = false;
1461 
1462  if ( IsPlayer( self ) || IsAI( self ) )
1463  {
1464  b_use_tag_eye = true;
1465  }
1466 
1467  n_dot = self ‪math::get_dot_direction( v_point, false, true, "forward", b_use_tag_eye );
1468 
1469  if ( n_dot > n_dot_range )
1470  {
1471  if ( do_trace )
1472  {
1473  v_eye = self ‪get_eye();
1474  b_can_see = SightTracePassed( v_eye, v_point, false, ent_or_org );
1475  }
1476  else
1477  {
1478  b_can_see = true;
1479  }
1480  }
1481 
1482  return b_can_see;
1483 }
1484 
1494 function ‪get_eye()
1495 {
1496  if ( IsPlayer( self ) )
1497  {
1498  linked_ent = self GetLinkedEnt();
1499  if ( isdefined( linked_ent ) && ( GetDvarint( "cg_cameraUseTagCamera" ) > 0 ) )
1500  {
1501  camera = linked_ent GetTagOrigin( "tag_camera" );
1502  if ( isdefined( camera ) )
1503  {
1504  return camera;
1505  }
1506  }
1507  }
1508 
1509  pos = self GetEye();
1510  return pos;
1511 }
1512 
1521 function ‪is_ads()
1522 {
1523  return ( self playerADS() > 0.5 );
1524 }
1525 
1538 function ‪spawn_model( model_name, origin, angles, n_spawnflags = 0, b_throttle = false )
1539 {
1540  if ( b_throttle )
1541  {
1543  }
1544 
1545  if ( !isdefined( origin ) )
1546  {
1547  origin = ( 0, 0, 0 );
1548  }
1549 
1550  model = ‪Spawn( "script_model", origin, n_spawnflags );
1551  model SetModel( model_name );
1552 
1553  if ( isdefined( angles ) )
1554  {
1555  model.angles = angles;
1556  }
1557 
1558  return model;
1559 }
1560 
1561 #using_animtree( "generic" );
1562 
1575 function ‪spawn_anim_model( model_name, origin, angles, n_spawnflags = 0, b_throttle )
1576 {
1577  model = ‪spawn_model( model_name, origin, angles, n_spawnflags, b_throttle );
1578  model UseAnimTree( #animtree );
1579  model.animtree = "generic";
1580  return model;
1581 }
1582 
1583 #using_animtree( "all_player" );
1584 
1595 function ‪spawn_anim_player_model( model_name, origin, angles, n_spawnflags = 0 )
1596 {
1597  model = ‪spawn_model( model_name, origin, angles, n_spawnflags );
1598  model UseAnimTree( #animtree );
1599  model.animtree = "all_player";
1600  return model;
1601 }
1602 
1616 function ‪waittill_player_looking_at( origin, arc_angle_degrees = 90, do_trace, e_ignore )
1617 {
1618  self endon( "death" );
1619 
1620  arc_angle_degrees = AbsAngleClamp360( arc_angle_degrees );
1621  dot = cos( arc_angle_degrees * 0.5 );
1622 
1623  while ( !‪is_player_looking_at( origin, dot, do_trace, e_ignore ) )
1624  {
1625  wait .05;
1626  }
1627 }
1628 
1641 function ‪waittill_player_not_looking_at( origin, dot, do_trace )
1642 {
1643  self endon( "death" );
1644 
1645  while ( ‪is_player_looking_at( origin, dot, do_trace ) )
1646  {
1647  wait .05;
1648  }
1649 }
1650 
1664 function ‪is_player_looking_at(origin, dot, do_trace, ignore_ent)
1665 {
1666  assert(IsPlayer(self), "player_looking_at must be called on a player.");
1667 
1668  if (!isdefined(dot))
1669  {
1670  dot = .7;
1671  }
1672 
1673  if (!isdefined(do_trace))
1674  {
1675  do_trace = true;
1676  }
1677 
1678  eye = self ‪get_eye();
1679 
1680  delta_vec = VectorNormalize(origin - eye);
1681  view_vec = AnglesToForward(self GetPlayerAngles());
1682 
1683  new_dot = VectorDot( delta_vec, view_vec );
1684  if ( new_dot >= dot )
1685  {
1686  if (do_trace)
1687  {
1688  return BulletTracePassed( origin, eye, false, ignore_ent );
1689  }
1690  else
1691  {
1692  return true;
1693  }
1694  }
1695 
1696  return false;
1697 }
1698 
1699 function ‪wait_endon( waitTime, endOnString, endonString2, endonString3, endonString4 )
1700 {
1701  self endon ( endOnString );
1702  if ( isdefined( endonString2 ) )
1703  self endon ( endonString2 );
1704  if ( isdefined( endonString3 ) )
1705  self endon ( endonString3 );
1706  if ( isdefined( endonString4 ) )
1707  self endon ( endonString4 );
1708 
1709  wait ( waitTime );
1710  return true;
1711 }
1712 
1713 function ‪WaitTillEndOnThreaded( waitCondition, ‪callback, endCondition1, endCondition2, endCondition3 )
1714 {
1715  if( isdefined( endCondition1 ) )
1716  self endon( endCondition1 );
1717  if( isdefined( endCondition2 ) )
1718  self endon( endCondition2 );
1719  if( isdefined( endCondition3 ) )
1720  self endon( endCondition3 );
1721 
1722  self waittill( waitCondition );
1723 
1724  if( isdefined( ‪callback ) )
1725  {
1726  [[ ‪callback ]]( waitCondition );
1727  }
1728 }
1729 
1730 // TIME
1731 
1732 function ‪new_timer( n_timer_length )
1733 {
1734  s_timer = SpawnStruct();
1735  s_timer.n_time_created = GetTime();
1736  s_timer.n_length = n_timer_length;
1737  return s_timer;
1738 }
1739 
1740 function ‪get_time()
1741 {
1742  t_now = GetTime();
1743  return t_now - self.n_time_created;
1744 }
1745 
1747 {
1748  return ‪get_time() / 1000;
1749 }
1750 
1751 function ‪get_time_frac( n_end_time )
1752 {
1753  ‪DEFAULT( n_end_time, self.n_length );
1754  return ( LerpFloat( 0, 1, ‪get_time_in_seconds() / n_end_time ) );
1755 }
1756 
1758 {
1759  if ( isdefined( self.n_length ) )
1760  {
1761  n_current_time = ‪get_time_in_seconds();
1762  return ( Max( self.n_length - n_current_time, 0 ) );
1763  }
1764 
1765  return -1;
1766 }
1767 
1769 {
1770  return ( ‪get_time_left() != 0 );
1771 }
1772 
1773 function ‪timer_wait( n_wait )
1774 {
1775  if ( isdefined( self.n_length ) )
1776  {
1777  n_wait = Min( n_wait, ‪get_time_left() );
1778  }
1779 
1780  wait n_wait;
1781 
1782  n_current_time = ‪get_time_in_seconds();
1783 
1784  return n_current_time;
1785 }
1786 
1787 // if primary weapon damage
1788 function ‪is_primary_damage( meansofdeath )
1789 {
1790  // including pistols as well since sometimes they share ammo
1791  if( meansofdeath == "MOD_RIFLE_BULLET" || meansofdeath == "MOD_PISTOL_BULLET" )
1792  return true;
1793  return false;
1794 }
1795 
1796 function ‪delete_on_death( ent )
1797 {
1798  ent endon( "death" );
1799  self waittill( "death" );
1800  if( isdefined( ent ) )
1801  {
1802  ent delete();
1803  }
1804 }
1805 
1817 function ‪delete_on_death_or_notify( e_to_delete, str_notify, str_clientfield = undefined )
1818 {
1819  e_to_delete endon( "death" );
1820 
1821  self ‪util::waittill_either( "death", str_notify );
1822 
1823  if( isdefined( e_to_delete ) )
1824  {
1825  if( isdefined( str_clientfield ) )
1826  {
1827  e_to_delete ‪clientfield::set( str_clientfield, 0 );
1828 
1829  wait 0.1; // Let clientfield get processed
1830  }
1831 
1832  e_to_delete Delete();
1833  }
1834 }
1835 
1846 function ‪wait_till_not_touching( e_to_check, e_to_touch )
1847 {
1848  Assert( isdefined( e_to_check ), "Undefined check entity passed to util::wait_till_not_touching" );
1849  Assert( isdefined( e_to_touch ), "Undefined touch entity passed to util::wait_till_not_touching" );
1850 
1851  e_to_check endon( "death" );
1852  e_to_touch endon( "death" );
1853 
1854  while( e_to_check IsTouching( e_to_touch ) )
1855  {
1857  }
1858 }
1859 
1868 function ‪any_player_is_touching( ent, str_team )
1869 {
1870  foreach ( player in GetPlayers( str_team ) )
1871  {
1872  if ( IsAlive( player ) && player IsTouching( ent ) )
1873  {
1874  return true;
1875  }
1876  }
1877 
1878  return false;
1879 }
1880 
1893 {
1894  self endon( msg );
1895  wait( ‪timer );
1896  return true;
1897 }
1898 
1900 {
1901  if ( !isdefined( level.Console ) )
1902  {
1903  level.Console = GetDvarString( "consoleGame" ) == "true";
1904  }
1905  else
1906  {
1907  assert( level.Console == ( GetDvarString( "consoleGame" ) == "true" ), "Level.console got set incorrectly." );
1908  }
1909 
1910  if ( !isdefined( level.Consolexenon ) )
1911  {
1912  level.xenon = GetDvarString( "xenonGame" ) == "true";
1913  }
1914  else
1915  {
1916  assert( level.xenon == ( GetDvarString( "xenonGame" ) == "true" ), "Level.xenon got set incorrectly." );
1917  }
1918 }
1919 
1920 //TODO T7 - remove this if gumps get cut
1921 function ‪waittill_asset_loaded( str_type, str_name )
1922 {
1923  //TODO T7 - need IsAssetLoaded moved to unified
1924  /*while ( !IsAssetLoaded( str_type, str_name ) )
1925  {
1926  level waittill( "gump_loaded" );
1927  }*/
1928 }
1929 
1930 function ‪script_wait( called_from_spawner = false )
1931 {
1932  // co-op scaling should only affect calls from spawning functions
1933 
1934  // set to 1 as default, decease scalar as more players join
1935  coop_scalar = 1;
1936  if ( called_from_spawner )
1937  {
1938  players = GetPlayers();
1939 
1940  if (players.size == 2)
1941  {
1942  coop_scalar = 0.7;
1943  }
1944  else if (players.size == 3)
1945  {
1946  coop_scalar = 0.4;
1947  }
1948  else if (players.size == 4)
1949  {
1950  coop_scalar = 0.1;
1951  }
1952  }
1953 
1954  ‪startTime = GetTime();
1955  if( isdefined( self.‪script_wait ) )
1956  {
1957  wait( self.‪script_wait * coop_scalar);
1958 
1959  if( isdefined( self.script_wait_add ) )
1960  {
1961  self.script_wait += self.script_wait_add;
1962  }
1963  }
1964  else if( isdefined( self.script_wait_min ) && isdefined( self.script_wait_max ) )
1965  {
1966  wait( RandomFloatrange( self.script_wait_min, self.script_wait_max ) * coop_scalar);
1967 
1968  if( isdefined( self.script_wait_add ) )
1969  {
1970  self.script_wait_min += self.script_wait_add;
1971  self.script_wait_max += self.script_wait_add;
1972  }
1973  }
1974 
1975  return( GetTime() - ‪startTime );
1976 }
1977 
1979 {
1980  return isdefined( level.killstreaksenabled ) && level.killstreaksenabled;
1981 }
1982 
1984 {
1985  return isdefined( self.flashEndTime ) && gettime() < self.flashEndTime;
1986 }
1987 
1997 function ‪magic_bullet_shield( ent )
1998 {
1999  ‪DEFAULT( ent, self );
2000 
2001  ent.allowdeath = false;
2002  ent.magic_bullet_shield = true;
2003 
2004  /#
2005  ent notify("_stop_magic_bullet_shield_debug");
2006  level thread ‪debug_magic_bullet_shield_death( ent );
2007  #/
2008 
2009  assert( IsAlive( ent ), "Tried to do magic_bullet_shield on a dead or undefined guy." );
2010 
2011  if ( IsAI( ent ) )
2012  {
2013  if ( IsActor( ent ) )
2014  {
2015  ent BloodImpact( "hero" );
2016  }
2017 
2018  ent.attackerAccuracy = 0.1;
2019  }
2020 }
2021 
2023 {
2024  targetname = "none";
2025  if ( isdefined( guy.targetname ) )
2026  {
2027  targetname = guy.targetname;
2028  }
2029 
2030  guy endon( "stop_magic_bullet_shield" );
2031  guy endon( "_stop_magic_bullet_shield_debug" );
2032  guy waittill( "death" );
2033  Assert( !isdefined( guy ), "Guy died with magic bullet shield on with targetname: " + targetname );
2034 }
2035 
2036 #using_animtree( "all_player" );
2037 
2049 function ‪spawn_player_clone( player, animname )
2050 {
2051  playerClone = ‪Spawn( "script_model", player.origin );
2052  playerClone.angles = player.angles;
2053 
2054  //set the body model
2055  bodyModel = player GetCharacterBodyModel();
2056  playerClone SetModel( bodyModel );
2057 
2058  //set the head
2059  headModel = player GetCharacterHeadModel();
2060  if( IsDefined( headModel ) )
2061  {
2062  playerClone Attach( headModel, "" );
2063  }
2064 
2065  //set the helmet model
2066  helmetModel = player GetCharacterHelmetModel();
2067  if( IsDefined( helmetModel ) )
2068  {
2069  playerClone Attach( helmetModel, "" );
2070  }
2071 
2072  //set the render options
2073  bodyRenderOptions = player GetCharacterBodyRenderOptions();
2074  playerClone SetBodyRenderOptions( bodyRenderOptions, bodyRenderOptions, bodyRenderOptions );
2075 
2076  //setup the animations
2077  playerClone UseAnimTree( #animtree );
2078  if( IsDefined( animname ) )
2079  {
2080  playerClone AnimScripted( "clone_anim", playerClone.origin, playerClone.angles, animname );
2081  }
2082 
2083  playerClone.health = 100;
2084  playerClone SetOwner( player );
2085  playerClone.team = player.team;
2086  playerClone Solid();
2087 
2088  return playerClone;
2089 }
2090 
2101 {
2102  ‪DEFAULT( ent, self );
2103 
2104  ent.allowdeath = true;
2105  ent.magic_bullet_shield = undefined;
2106 
2107  if ( IsAI( ent ) )
2108  {
2109  if ( IsActor( ent ) )
2110  {
2111  ent BloodImpact( "normal" );
2112  }
2113 
2114  ent.attackerAccuracy = 1; // TODO: restore old value if we need it.
2115  }
2116 
2117  ent notify("stop_magic_bullet_shield");
2118 }
2119 
2120 //Round Functions
2122 {
2123  if ( level.roundLimit == 1 )
2124  return true;
2125 
2126  return false;
2127 }
2128 
2130 {
2131  if ( level.roundLimit > 1 && game[ "roundsplayed" ] == 0 )
2132  return true;
2133 
2134  return false;
2135 }
2136 
2138 {
2139  if ( level.roundLimit > 1 && game[ "roundsplayed" ] >= ( level.roundLimit - 1 ) )
2140  return true;
2141 
2142  return false;
2143 }
2144 
2145 function ‪get_rounds_won( team )
2146 {
2147  return game["roundswon"][team];
2148 }
2149 
2150 function ‪get_other_teams_rounds_won( skip_team )
2151 {
2152  roundswon = 0;
2153 
2154  foreach ( team in level.teams )
2155  {
2156  if ( team == skip_team )
2157  continue;
2158 
2159  roundswon += game["roundswon"][team];
2160  }
2161  return roundswon;
2162 }
2163 
2165 {
2166  return game["roundsplayed"];
2167 }
2168 
2170 {
2171  if ( level.roundLimit != 1 && level.roundWinLimit != 1 )
2172  return true;
2173 
2174  return false;
2175 }
2176 
2190 function ‪within_fov( start_origin, start_angles, end_origin, fov )
2191 {
2192  normal = VectorNormalize( end_origin - start_origin );
2193  forward = AnglesToForward( start_angles );
2194  dot = VectorDot( forward, normal );
2195 
2196  return dot >= fov;
2197 }
2198 
2199 function ‪button_held_think( which_button )
2200 {
2201  self endon( "disconnect" );
2202 
2203  ‪DEFAULT( self._holding_button, [] );
2204 
2205  self._holding_button[ which_button ] = false;
2206 
2207  time_started = 0;
2208  const use_time = 250; // GetDvarInt("g_useholdtime");
2209 
2210  while ( true )
2211  {
2212  if ( self._holding_button[ which_button ] )
2213  {
2214  if ( !self [[ level._button_funcs[ which_button ]]]() )
2215  {
2216  self._holding_button[ which_button ] = false;
2217  }
2218  }
2219  else
2220  {
2221  if ( self [[ level._button_funcs[ which_button ]]]() )
2222  {
2223  if ( time_started == 0 )
2224  {
2225  time_started = GetTime();
2226  }
2227 
2228  if ( ( GetTime() - time_started ) > use_time )
2229  {
2230  self._holding_button[ which_button ] = true;
2231  }
2232  }
2233  else
2234  {
2235  if ( time_started != 0 )
2236  {
2237  time_started = 0;
2238  }
2239  }
2240  }
2241 
2243  }
2244 }
2245 
2254 {
2256 
2257  if ( !isdefined( self._use_button_think_threaded ) )
2258  {
2259  self thread ‪button_held_think( ‪BUTTON_USE );
2260  self._use_button_think_threaded = true;
2261  }
2262 
2263  return self._holding_button[ ‪BUTTON_USE ];
2264 }
2265 
2274 {
2276 
2277  if ( !isdefined( self._stance_button_think_threaded ) )
2278  {
2279  self thread ‪button_held_think( ‪BUTTON_STANCE );
2280  self._stance_button_think_threaded = true;
2281  }
2282 
2283  return self._holding_button[ ‪BUTTON_STANCE ];
2284 }
2285 
2294 {
2296 
2297  if ( !isdefined( self._ads_button_think_threaded ) )
2298  {
2299  self thread ‪button_held_think( ‪BUTTON_ADS );
2300  self._ads_button_think_threaded = true;
2301  }
2302 
2303  return self._holding_button[ ‪BUTTON_ADS ];
2304 }
2305 
2314 {
2316 
2317  if ( !isdefined( self._attack_button_think_threaded ) )
2318  {
2319  self thread ‪button_held_think( ‪BUTTON_ATTACK );
2320  self._attack_button_think_threaded = true;
2321  }
2322 
2323  return self._holding_button[ ‪BUTTON_ATTACK ];
2324 }
2325 
2334 {
2336 
2337  if ( !isdefined( self._dpad_right_button_think_threaded ) )
2338  {
2339  self thread ‪button_held_think( ‪BUTTON_RIGHT );
2340  self._dpad_right_button_think_threaded = true;
2341  }
2342 
2343  return self._holding_button[ ‪BUTTON_RIGHT ];
2344 }
2345 
2354 {
2355  while ( !self UseButtonPressed() )
2356  {
2358  }
2359 }
2360 
2369 {
2370  while ( !self ‪use_button_held() )
2371  {
2373  }
2374 }
2375 
2384 {
2385  while ( !self StanceButtonPressed() )
2386  {
2388  }
2389 }
2390 
2399 {
2400  while ( !self ‪stance_button_held() )
2401  {
2403  }
2404 }
2405 
2414 {
2415  while ( !self AttackButtonPressed() )
2416  {
2418  }
2419 }
2420 
2429 {
2430  while ( !self AdsButtonPressed() )
2431  {
2433  }
2434 }
2435 
2444 {
2445  while ( !self VehicleMoveUpButtonPressed() )
2446  {
2448  }
2449 }
2450 
2452 {
2453  if ( !isdefined( level._button_funcs ) )
2454  {
2455  level._button_funcs[ ‪BUTTON_USE ] = &UseButtonPressed;
2456  level._button_funcs[ ‪BUTTON_ADS ] = &AdsButtonPressed;
2457  level._button_funcs[ ‪BUTTON_ATTACK ] = &AttackButtonPressed;
2458  level._button_funcs[ ‪BUTTON_STANCE ] = &StanceButtonPressed;
2459  level._button_funcs[ ‪BUTTON_RIGHT ] = &ActionSlotFourButtonPressed;
2460 
2461  }
2462 }
2463 
2474 function ‪freeze_player_controls( b_frozen = true )
2475 {
2476  if ( isdefined( level.hostMigrationTimer ) )
2477  {
2478  b_frozen = true;
2479  }
2480 
2481  if( b_frozen || !level.gameEnded )
2482  {
2483  self FreezeControls( b_frozen );
2484 
2485  }
2486 }
2487 
2488 function ‪is_bot()
2489 {
2490  return ( IsPlayer( self ) && isdefined ( self.pers["isBot"] ) && self.pers["isBot"] != 0 );
2491 }
2492 
2493 function ‪isHacked()
2494 {
2495  return ( isdefined( self.hacked ) && self.hacked );
2496 }
2497 
2499 {
2500  last_weapon = undefined;
2501 
2502  if( isdefined( self.lastNonKillstreakWeapon ) && self hasWeapon(self.lastNonKillstreakWeapon) )
2503  last_weapon = self.lastNonKillstreakWeapon;
2504  else if( isdefined( self.lastDroppableWeapon ) && self hasWeapon(self.lastDroppableWeapon) )
2505  last_weapon = self.lastDroppableWeapon;
2506 
2507  return last_weapon;
2508 }
2509 
2510 function ‪IsEnemyPlayer( player )
2511 {
2512  assert( isdefined( player ) );
2513 
2514  if ( !isplayer( player ) )
2515  return false;
2516 
2517  if ( level.teambased )
2518  {
2519  if ( player.team == self.team )
2520  {
2521  return false;
2522  }
2523  }
2524  else
2525  {
2526  if ( player == self )
2527  {
2528  return false;
2529  }
2530  }
2531  return true;
2532 }
2533 
2534 // to be used with things that are slow.
2535 // unfortunately, it can only be used with things that aren't time critical.
2537 {
2538  while ( level.lastSlowProcessFrame == gettime() )
2539  wait .05;
2540 
2541  level.lastSlowProcessFrame = gettime();
2542 }
2543 
2550 function ‪get_start_time() // in microseconds
2551 {
2552  return GetMicrosecondsRaw();
2553 }
2554 
2567 function ‪note_elapsed_time( start_time, label = "unknown" ) // in microseconds
2568 {
2569 
2570 /# // note: this line may be commented out locally, but never submit it commented out
2571 
2572  elapsed_time = ‪get_elapsed_time( start_time, GetMicrosecondsRaw() );
2573 
2574  if ( !isdefined( start_time ) )
2575  return;
2576 
2577  elapsed_time = elapsed_time * 0.001; // display in milliseconds
2578  // elapsed_time -= 0.005; // approximate time it takes to note the elapsed time just after using get_start_time()
2579 
2580  if ( !level.orbis )
2581  elapsed_time = int( elapsed_time );
2582 
2583  msg = label + " elapsed time: " + elapsed_time + " ms";
2584 
2585  IPrintLn( msg );
2586 
2587 #/ // note: this line may be commented out locally, but never submit it commented out
2588 
2589 }
2590 
2598 function ‪get_elapsed_time( start_time, end_time )
2599 {
2600  if ( !isdefined( end_time ) )
2601  end_time = GetMicrosecondsRaw();
2602 
2603  if ( !isdefined( start_time ) )
2604  return undefined;
2605 
2606  elapsed_time = ( end_time - start_time );
2607  if ( elapsed_time < 0 )
2608  elapsed_time += 2147483648; // 31 bits of microseconds is ~35.79 minutes, so negative elapsed times may occur. Correct by adding 2^31.
2609 
2610  return elapsed_time;
2611 }
2612 
2614 {
2615  assert( isdefined( self ) );
2616  assert( IsPlayer( self ) );
2617 
2618  return ( !isdefined( self.viewlockedentity ) );
2619 }
2620 
2622 {
2623  if ( self ‪isHacked() )
2624  {
2626  return;
2627  }
2628 
2629  if ( self.classname == "grenade" )
2630  {
2631  self waittill("stationary");
2632  }
2633  else
2634  {
2635  prevorigin = self.origin;
2636  while(1)
2637  {
2638  wait .15;
2639  if ( self.origin == prevorigin )
2640  break;
2641  prevorigin = self.origin;
2642  }
2643  }
2644 }
2645 
2646 
2648 {
2649  if ( self ‪util::isHacked() )
2650  {
2652  return "stationary";
2653  }
2654 
2655  moveState = self ‪util::waittill_any_return("stationary", "rolling");
2656  return moveState;
2657 }
2658 
2659 
2661 {
2662  if ( SessionModeIsCampaignGame() )
2663  {
2664  return ‪STATS_TABLE_CP;
2665  }
2666  else if ( SessionModeIsZombiesGame() )
2667  {
2668  return ‪STATS_TABLE_ZM;
2669  }
2670  else
2671  {
2672  return ‪STATS_TABLE_MP;
2673  }
2674 }
2675 
2676 function ‪getWeaponClass( weapon )
2677 {
2678  if( weapon == level.weaponNone )
2679  {
2680  return undefined;
2681  }
2682 
2683  if ( !weapon.isValid )
2684  {
2685  return undefined;
2686  }
2687 
2688  if ( !isdefined ( level.weaponClassArray ) )
2689  {
2690  level.weaponClassArray = [];
2691  }
2692 
2693  if ( isdefined( level.weaponClassArray[weapon] ) )
2694  {
2695  return level.weaponClassArray[weapon];
2696  }
2697 
2698  baseWeaponParam = [[ level.get_base_weapon_param ]]( weapon );
2699  baseWeaponIndex = GetBaseWeaponItemIndex( baseWeaponParam );
2700  weaponClass = tableLookup( ‪util::getStatsTableName(), 0, baseWeaponIndex, ‪STATS_TABLE_COL_GROUP );
2701  level.weaponClassArray[weapon] = weaponClass;
2702  return weaponClass;
2703 }
2704 
2706 {
2707  return( isdefined( self.usingRemote ) );
2708 }
2709 
2710 function ‪deleteAfterTime( time )
2711 {
2712  assert( isdefined( self ) );
2713  assert( isdefined( time ) );
2714  assert( time >= 0.05 );
2715 
2716  self thread ‪deleteAfterTimeThread( time );
2717 }
2718 
2720 {
2721  self endon ( "death" );
2722  wait ( time );
2723 
2724  self delete();
2725 }
2726 
2727 function ‪waitForTime( time )
2728 {
2729  if ( !isdefined( time ) )
2730  {
2731  time = 0.0;
2732  }
2733 
2734  if ( time > 0.0 )
2735  {
2736  wait ( time );
2737  }
2738 }
2739 
2740 // waits for specified time and one acknowledged network frame
2742 {
2743  if ( !isdefined( time ) )
2744  {
2745  time = 0.0;
2746  }
2747 
2748  start_time_ms = GetTime();
2750  elapsed_time = (GetTime() - start_time_ms) * 0.001;
2751  remaining_time = time - elapsed_time;
2752 
2753  if ( remaining_time > 0 )
2754  {
2755  wait ( remaining_time );
2756  }
2757 }
2758 
2759 
2760 // deletes entity after specified time has passed and one network frame has been acknowledged
2762 {
2763  assert( isdefined( self ) );
2765  self delete();
2766 }
2767 
2768 function ‪drawcylinder( pos, rad, height, duration, stop_notify, color, alpha )
2769 {
2770 /#
2771  if ( !isdefined( duration ) )
2772  {
2773  duration = 0;
2774  }
2775 
2776  level thread ‪drawcylinder_think( pos, rad, height, duration, stop_notify, color, alpha );
2777 #/
2778 }
2779 
2780 function ‪drawcylinder_think( pos, rad, height, seconds, stop_notify, color, alpha )
2781 {
2782 /#
2783  if ( isdefined( stop_notify ) )
2784  {
2785  level endon( stop_notify );
2786  }
2787 
2788  stop_time = GetTime() + ( seconds * 1000 );
2789 
2790  currad = rad;
2791  curheight = height;
2792 
2793  if ( !isdefined( color ) )
2794  color = ( 1, 1, 1 );
2795 
2796  if ( !isdefined( alpha ) )
2797  alpha = 1;
2798 
2799  for ( ;; )
2800  {
2801  if ( seconds > 0 && stop_time <= GetTime() )
2802  {
2803  return;
2804  }
2805 
2806  for( r = 0; r < 20; r++ )
2807  {
2808  theta = r / 20 * 360;
2809  theta2 = ( r + 1 ) / 20 * 360;
2810 
2811  line( pos +( cos( theta ) * currad, sin( theta ) * currad, 0 ), pos +( cos( theta2 ) * currad, sin( theta2 ) * currad, 0 ), color, alpha );
2812  line( pos +( cos( theta ) * currad, sin( theta ) * currad, curheight ), pos +( cos( theta2 ) * currad, sin( theta2 ) * currad, curheight ), color, alpha );
2813  line( pos +( cos( theta ) * currad, sin( theta ) * currad, 0 ), pos +( cos( theta ) * currad, sin( theta ) * currad, curheight ), color, alpha );
2814  }
2815 
2817  }
2818 #/
2819 }
2820 
2821 //entities_s.a[]
2822 function ‪get_team_alive_players_s( teamName )
2823 {
2824  teamPlayers_s = ‪spawn_array_struct();
2825 
2826  if (isdefined(teamName) &&
2827  isdefined( level.alivePlayers ) &&
2828  isdefined( level.alivePlayers[ teamName ] ) )
2829  {
2830  for ( i= 0; i < level.alivePlayers[ teamName ].size; i++ )
2831  {
2832  teamPlayers_s.a[ teamPlayers_s.a.size ]= level.alivePlayers[ teamName ][ i ];
2833  }
2834  }
2835 
2836  return teamPlayers_s;
2837 }
2838 
2839 function ‪get_other_teams_alive_players_s( teamNameToIgnore )
2840 {
2841  teamPlayers_s = ‪spawn_array_struct();
2842 
2843  if (isdefined(teamNameToIgnore) &&isdefined( level.alivePlayers ) )
2844  {
2845  foreach( team in level.teams )
2846  {
2847  if ( team == teamNameToIgnore )
2848  {
2849  continue;
2850  }
2851 
2852  foreach ( player in level.alivePlayers[ team ] )
2853  {
2854  teamPlayers_s.a[ teamPlayers_s.a.size ] = player;
2855  }
2856  }
2857  }
2858 
2859  return teamPlayers_s;
2860 }
2861 
2862 
2863 
2864 //entities_s.a[]
2866 {
2867  allPlayers_s = ‪spawn_array_struct();
2868 
2869  if ( isdefined( level.alivePlayers ) )
2870  {
2871  keys = GetArrayKeys( level.alivePlayers );
2872 
2873  for ( i = 0; i < keys.size; i++ )
2874  {
2875  team = keys[ i ];
2876 
2877  for ( j = 0; j < level.alivePlayers[ team ].size; j++ )
2878  {
2879  allPlayers_s.a[ allPlayers_s.a.size ] = level.alivePlayers[ team ][ j ];
2880  }
2881  }
2882  }
2883 
2884  return allPlayers_s;
2885 }
2886 
2897 {
2898  s= SpawnStruct();
2899  s.a= [];
2900  return s;
2901 }
2902 
2903 
2905 {
2906  players = GetPlayers();
2907 
2908  for ( index = 0; index < players.size; index++ )
2909  {
2910  if ( players[index] IsHost() )
2911  return players[index];
2912  }
2913 }
2914 
2915 
2917 {
2918  players = GetPlayers();
2919 
2920  for ( index = 0; index < players.size; index++ )
2921  {
2922  if ( players[index] IsHostForBots() )
2923  return players[index];
2924  }
2925 }
2926 
2927 
2928 
2943 function ‪get_array_of_closest( org, ‪array, excluders, max, maxdist )
2944 {
2945  // pass an array of entities to this function and it will return them in the order of closest
2946  // to the origin you pass, you can also set max to limit how many ents get returned
2947 
2948  ‪DEFAULT( max, ‪array.size );
2949  ‪DEFAULT( excluders, [] );
2950 
2951  maxdists2rd = undefined;
2952  if ( isdefined( maxdist ) )
2953  {
2954  maxdists2rd = maxdist * maxdist;
2955  }
2956 
2957  // return the array, reordered from closest to farthest
2958  dist = [];
2959  index = [];
2960  for ( i = 0; i < ‪array.size; i++ )
2961  {
2962  if ( !isdefined( ‪array[ i ] ) )
2963  {
2964  continue;
2965  }
2966 
2967  if ( IsInArray( excluders, ‪array[ i ] ) )
2968  {
2969  continue;
2970  }
2971 
2972  if ( IsVec( ‪array[i] ) )
2973  {
2974  length = DistanceSquared( org, ‪array[ i ] );
2975  }
2976  else
2977  {
2978  length = DistanceSquared( org, ‪array[ i ].origin );
2979  }
2980 
2981  if ( isdefined( maxdists2rd ) && maxdists2rd < length )
2982  {
2983  continue;
2984  }
2985 
2986  dist[ dist.size ] = length;
2987  index[ index.size ] = i;
2988  }
2989 
2990  for ( ;; )
2991  {
2992  ‪change = false;
2993  for ( i = 0; i < dist.size - 1; i++ )
2994  {
2995  if ( dist[ i ] <= dist[ i + 1 ] )
2996  {
2997  continue;
2998  }
2999 
3000  ‪change = true;
3001  temp = dist[ i ];
3002  dist[ i ] = dist[ i + 1 ];
3003  dist[ i + 1 ] = temp;
3004  temp = index[ i ];
3005  index[ i ] = index[ i + 1 ];
3006  index[ i + 1 ] = temp;
3007  }
3008 
3009  if ( !‪change )
3010  {
3011  break;
3012  }
3013  }
3014 
3015  newArray = [];
3016  if ( max > dist.size )
3017  {
3018  max = dist.size;
3019  }
3020 
3021  for ( i = 0; i < max; i++ )
3022  {
3023  newArray[ i ] = ‪array[ index[ i ] ];
3024  }
3025 
3026  return newArray;
3027 }
3028 
3037 function ‪set_lighting_state( n_state )
3038 {
3039  if ( isdefined( n_state ) )
3040  {
3041  self.lighting_state = n_state;
3042  }
3043  else
3044  {
3045  self.lighting_state = level.lighting_state;
3046  }
3047 
3048  if ( isdefined( self.lighting_state ) )
3049  {
3050  if ( self == level )
3051  {
3052  if ( isdefined( level.activePlayers ) )
3053  {
3054  foreach( player in level.activePlayers )
3055  {
3056  player ‪set_lighting_state( level.lighting_state );
3057  }
3058  }
3059  }
3060  else if ( IsPlayer( self ) )
3061  {
3062  self SetLightingState( self.lighting_state );
3063  }
3064  else
3065  {
3066  AssertMsg( "Can only set lighting state on level or a player." );
3067  }
3068  }
3069 }
3070 
3079 function ‪set_sun_shadow_split_distance( f_distance )
3080 {
3081  if ( isdefined( f_distance ) )
3082  {
3083  self.sun_shadow_split_distance = f_distance;
3084  }
3085  else
3086  {
3087  self.sun_shadow_split_distance = level.sun_shadow_split_distance;
3088  }
3089 
3090  if ( isdefined( self.sun_shadow_split_distance ) )
3091  {
3092  if ( self == level )
3093  {
3094  if ( isdefined( level.activePlayers ) )
3095  {
3096  foreach( player in level.activePlayers )
3097  {
3098  player ‪set_sun_shadow_split_distance( level.sun_shadow_split_distance );
3099  }
3100  }
3101  }
3102  else if ( IsPlayer( self ) )
3103  {
3104  self SetSunShadowSplitDistance( self.sun_shadow_split_distance );
3105  }
3106  else
3107  {
3108  AssertMsg( "Can only set_sun_shadow_split_distance on level or a player." );
3109  }
3110  }
3111 }
3112 
3113 
3132 function ‪auto_delete( n_mode = ‪DELETE_SAFE, n_min_time_alive = 0, n_dist_horizontal = 0, n_dist_vertical = 0 )
3133 {
3134  self endon( "death" );
3135 
3136  self notify( "__auto_delete__" );
3137  self endon( "__auto_delete__" );
3138 
3139  level ‪flag::wait_till( "all_players_spawned" );
3140 
3141  if ( isdefined( level.heroes ) && IsInArray( level.heroes, self ) )
3142  {
3143  return;
3144  }
3145 
3146  if ( n_mode & ‪DELETE_AGGRESSIVE || n_mode == ‪DELETE_SAFE || n_mode == ‪DELETE_BOTH )
3147  {
3148  // In all of these modes, we need to potentially check both conditions
3149  // Setting these bits helps simplify the logic
3150 
3151  n_mode |= ‪DELETE_BEHIND;
3152  n_mode |= ‪DELETE_BLOCKED;
3153  }
3154 
3155  n_think_time = 1;
3156  n_tests_to_do = 2;
3157  n_dot_check = 0;
3158 
3159  if ( n_mode & ‪DELETE_AGGRESSIVE )
3160  {
3161  n_think_time = .2;
3162  n_tests_to_do = 1;
3163  n_dot_check = .4;
3164  }
3165 
3166  n_test_count = 0;
3167 
3168  while ( true )
3169  {
3170  do
3171  {
3172  ‪WAIT_ABOUT( n_think_time );
3173  }
3174  while ( isdefined( self.birthtime ) && ( ( GetTime() - self.birthtime ) / 1000 ) < n_min_time_alive );
3175 
3176  n_tests_passed = 0;
3177 
3178  foreach ( player in level.players )
3179  {
3180  if ( n_dist_horizontal && ( Distance2DSquared( self.origin, player.origin ) < n_dist_horizontal ) )
3181  {
3182  continue;
3183  }
3184 
3185  if ( n_dist_vertical && ( abs( self.origin[2] - player.origin[2] ) < n_dist_vertical ) )
3186  {
3187  continue;
3188  }
3189 
3190  v_eye = player GetEye();
3191 
3192  b_behind = false;
3193 
3194  if ( n_mode & ‪DELETE_BEHIND )
3195  {
3196  v_facing = AnglesToForward( player GetPlayerAngles() );
3197 
3198  v_to_ent = VectorNormalize( self.origin - v_eye );
3199  n_dot = VectorDot( v_facing, v_to_ent );
3200 
3201  if ( n_dot < n_dot_check )
3202  {
3203  b_behind = true;
3204 
3205  if ( !( n_mode & ‪DELETE_SAFE ) )
3206  {
3207  n_tests_passed++;
3208  continue;
3209  }
3210  }
3211  }
3212 
3213  if ( n_mode & ‪DELETE_BLOCKED )
3214  {
3215  if ( !self SightConeTrace( v_eye, player ) )
3216  {
3217  if ( b_behind || !( n_mode & ‪DELETE_SAFE ) )
3218  n_tests_passed++;
3219  }
3220  }
3221  }
3222 
3223  if ( n_tests_passed == level.players.size )
3224  {
3225  n_test_count++;
3226  if ( n_test_count < n_tests_to_do )
3227  {
3228  continue;
3229  }
3230 
3231  self notify( "_disable_reinforcement" );
3232  self Delete();
3233  }
3234  else
3235  {
3236  n_test_count = 0;
3237  }
3238  }
3239 }
3240 
3261 function query_ents( &‪a_kvps_match, b_match_all = true, &a_kvps_ingnore, b_ignore_spawners = false, b_match_substrings = false )
3263  ‪a_ret = [];
3264 
3265  if ( b_match_substrings )
3266  {
3267  a_all_ents = GetEntArray();
3268 
3269  b_first = true;
3270  foreach ( k, v in ‪a_kvps_match )
3271  {
3272  ‪a_ents = _query_ents_by_substring_helper( a_all_ents, v, k, b_ignore_spawners );
3273 
3274  if ( b_first )
3275  {
3276  ‪a_ret = ‪a_ents;
3277  b_first = false;
3278  }
3279  else if ( b_match_all )
3280  {
3281  ‪a_ret = ArrayIntersect( ‪a_ret, ‪a_ents );
3282  }
3283  else
3284  {
3285  ‪a_ret = ArrayCombine( ‪a_ret, ‪a_ents, false, false );
3286  }
3287  }
3288 
3289  if ( isdefined( a_kvps_ingnore ) )
3290  {
3291  foreach ( k, v in a_kvps_ingnore )
3292  {
3293  ‪a_ents = _query_ents_by_substring_helper( a_all_ents, v, k, b_ignore_spawners );
3294  ‪a_ret = array::exclude( ‪a_ret, ‪a_ents );
3295  }
3296  }
3297  }
3298  else
3299  {
3300  b_first = true;
3301  foreach ( k, v in ‪a_kvps_match )
3302  {
3303  ‪a_ents = GetEntArray( v, k );
3304 
3305  if ( b_first )
3306  {
3307  ‪a_ret = ‪a_ents;
3308  b_first = false;
3309  }
3310  else if ( b_match_all )
3311  {
3312  ‪a_ret = ArrayIntersect( ‪a_ret, ‪a_ents );
3313  }
3314  else
3315  {
3316  ‪a_ret = ArrayCombine( ‪a_ret, ‪a_ents, false, false );
3317  }
3318  }
3319 
3320  if ( isdefined( a_kvps_ingnore ) )
3321  {
3322  foreach ( k, v in a_kvps_ingnore )
3323  {
3324  ‪a_ents = GetEntArray( v, k );
3325  ‪a_ret = array::exclude( ‪a_ret, ‪a_ents );
3326  }
3327  }
3328  }
3329 
3330  return ‪a_ret;
3331 }
3332 
3333 function _query_ents_by_substring_helper( &‪a_ents, str_value, str_key = "targetname", b_ignore_spawners = false )
3335  ‪a_ret = [];
3336 
3337  foreach ( ent in ‪a_ents )
3338  {
3339  if ( b_ignore_spawners && IsSpawner( ent ) )
3340  {
3341  continue;
3342  }
3343 
3344  switch ( str_key )
3345  {
3346  case "targetname":
3347 
3348  if ( IsString( ent.targetname ) && IsSubStr( ent.targetname, str_value ) )
3349  {
3350  ‪ARRAY_ADD( ‪a_ret, ent );
3351  }
3352  break;
3353 
3354  case "script_noteworthy":
3355 
3356  if ( IsString( ent.script_noteworthy ) && IsSubStr( ent.script_noteworthy, str_value ) )
3357  {
3358  ‪ARRAY_ADD( ‪a_ret, ent );
3359  }
3360  break;
3361 
3362  case "classname":
3363 
3364  if ( IsString( ent.classname ) && IsSubStr( ent.classname, str_value ) )
3365  {
3366  ‪ARRAY_ADD( ‪a_ret, ent );
3367  }
3368  break;
3369 
3370  case "vehicletype":
3371 
3372  if ( IsString( ent.vehicletype ) && IsSubStr( ent.vehicletype, str_value ) )
3373  {
3374  ‪ARRAY_ADD( ‪a_ret, ent );
3375  }
3376  break;
3377 
3378  case "script_string":
3379 
3380  if ( IsString( ent.script_string ) && IsSubStr( ent.script_string, str_value ) )
3381  {
3382  ‪ARRAY_ADD( ‪a_ret, ent );
3383  }
3384  break;
3385 
3386  case "script_color_axis":
3387 
3388  if ( IsString( ent.script_color_axis ) && IsSubStr( ent.script_color_axis, str_value ) )
3389  {
3390  ‪ARRAY_ADD( ‪a_ret, ent );
3391  }
3392  break;
3393 
3394  case "script_color_allies":
3395 
3396  if ( IsString( ent.script_color_axis ) && IsSubStr( ent.script_color_axis, str_value ) )
3397  {
3398  ‪ARRAY_ADD( ‪a_ret, ent );
3399  }
3400  break;
3401 
3402  default: Assert( "Unsupported key: '" + str_key + "' use in util::query_ents()." );
3403  }
3404  }
3405 
3406  return ‪a_ret;
3407 }
3408 
3409 function ‪get_weapon_by_name( weapon_name )
3410 {
3411  split = StrTok( weapon_name, "+" );
3412  switch ( split.size )
3413  {
3414  default:
3415  case 1:
3416  weapon = GetWeapon( split[0] );
3417  break;
3418  case 2:
3419  weapon = GetWeapon( split[0], split[1] );
3420  break;
3421  case 3:
3422  weapon = GetWeapon( split[0], split[1], split[2] );
3423  break;
3424  case 4:
3425  weapon = GetWeapon( split[0], split[1], split[2], split[3] );
3426  break;
3427  case 5:
3428  weapon = GetWeapon( split[0], split[1], split[2], split[3], split[4] );
3429  break;
3430  case 6:
3431  weapon = GetWeapon( split[0], split[1], split[2], split[3], split[4], split[5] );
3432  break;
3433  case 7:
3434  weapon = GetWeapon( split[0], split[1], split[2], split[3], split[4], split[5], split[6] );
3435  break;
3436  case 8:
3437  weapon = GetWeapon( split[0], split[1], split[2], split[3], split[4], split[5], split[6], split[7] );
3438  break;
3439  case 9:
3440  weapon = GetWeapon( split[0], split[1], split[2], split[3], split[4], split[5], split[6], split[7], split[8] );
3441  break;
3442  }
3443  return weapon;
3444 }
3445 
3446 //TU1: if the player's gender gets returned as undefined, set them to "false" (or male)
3447 // edits made to make sure we do not pass back undefined into other script
3448 function ‪is_female()
3449 {
3450  gender = self GetPlayerGenderType( CurrentSessionMode() );
3451 
3452  b_female = false;
3453  if( isdefined( gender ) && gender == "female" )
3454  {
3455  b_female = true;
3456  }
3457 
3458  return b_female;
3459 }
3460 
3461 // get array of points on navmesh
3462 function ‪PositionQuery_PointArray( origin, minSearchRadius, maxSearchRadius, halfHeight, innerSpacing, reachableBy_Ent )
3463 {
3464  if ( isdefined( reachableBy_ent ) )
3465  {
3466  queryResult = PositionQuery_Source_Navigation( origin, minSearchRadius, maxSearchRadius, halfHeight, innerSpacing, reachableBy_Ent );
3467  }
3468  else
3469  {
3470  queryResult = PositionQuery_Source_Navigation( origin, minSearchRadius, maxSearchRadius, halfHeight, innerSpacing );
3471  }
3472 
3473  pointarray = [];
3474  foreach( pointStruct in queryResult.data )
3475  {
3476  ‪ARRAY_ADD( pointarray, pointStruct.origin );
3477  }
3478 
3479  return pointarray;
3480 }
3481 
3483 {
3484  count = 0;
3485  foreach( team in level.teams )
3486  {
3487  count += level.playerCount[team];
3488  }
3489  return count;
3490 }
3491 
3493 {
3494  return ‪IS_TRUE( level.rankEnabled );
3495 }
3496 
3497 function ‪isOneRound()
3498 {
3499  if ( level.roundLimit == 1 )
3500  return true;
3501 
3502  return false;
3503 }
3504 
3506 {
3507  if ( level.roundLimit > 1 && game[ "roundsplayed" ] == 0 )
3508  return true;
3509 
3510  return false;
3511 }
3512 
3513 function ‪isLastRound()
3514 {
3515  if ( level.roundLimit > 1 && game[ "roundsplayed" ] >= ( level.roundLimit - 1 ) )
3516  return true;
3517 
3518  return false;
3519 }
3520 
3522 {
3523  if ( level.forcedEnd )
3524  return true;
3525 
3526  if ( isdefined( level.shouldPlayOvertimeRound ) )
3527  {
3528  if ( [[level.shouldPlayOvertimeRound]]() ) // start/keep playing overtime
3529  {
3530  level.nextRoundIsOvertime = true;
3531  return false;
3532  }
3533  else if ( isdefined( game["overtime_round"] ) ) // We were in overtime, but shouldn't play another round, we're done
3534  {
3535  return true;
3536  }
3537  }
3538 
3540  {
3541  return true;
3542  }
3543 
3544  return false;
3545 }
3546 
3548 {
3549  if( level.roundLimit <= 0 )
3550  return false;
3551 
3552  return ( ‪getRoundsPlayed() >= level.roundLimit );
3553 }
3554 
3556 {
3557  foreach( team in level.teams )
3558  {
3559  if ( ‪getRoundsWon(team) >= level.roundWinLimit )
3560  return true;
3561  }
3562 
3563  return false;
3564 }
3565 
3567 {
3568  tie_wins = game["roundswon"]["tie"];
3569 
3570  foreach( team in level.teams )
3571  {
3572  if ( ‪getRoundsWon(team) + tie_wins >= level.roundWinLimit )
3573  return true;
3574  }
3575 
3576  return false;
3577 }
3578 
3580 {
3581  max_wins = 0;
3582  winning_team = undefined;
3583 
3584  foreach( team in level.teams )
3585  {
3586  wins = ‪getRoundsWon(team);
3587 
3588  if ( !isdefined( winning_team ) )
3589  {
3590  max_wins = wins;
3591  winning_team = team;
3592  continue;
3593  }
3594 
3595  if ( wins == max_wins )
3596  {
3597  winning_team = "tie";
3598  }
3599  else if ( wins > max_wins )
3600  {
3601  max_wins = wins;
3602  winning_team = team;
3603  }
3604  }
3605 
3606  return winning_team;
3607 }
3608 
3610 {
3611  if( !isdefined(level.roundWinLimit) || level.roundWinLimit <= 0 )
3612  return false;
3613 
3615  {
3616  //"True" means that we should end the game
3617  return true;
3618  }
3619 
3620  //No over-time should occur if either team has more rounds won, even if there were rounds that ended in draw.
3621  // For example, If the round win limit is 5 and one team has one win and 4 draws occur in a row, we want to declare the
3622  //team with the victory as the winner and not enter an over-time round.
3624  {
3625  //We want the game to have an over-time round if the teams are tied.
3626  //In a game with a win limit of 3, 3 ties in a row would cause the previous 'if' check to return 'true'.
3627  // We want to make sure the game doesn't end if that's the case.
3628  if( ‪getRoundWinLimitWinningTeam() != "tie" )
3629  {
3630  return true;
3631  }
3632  }
3633 
3634  return false;
3635 }
3636 
3637 
3639 {
3640  foreach( team in level.teams )
3641  {
3642  if ( game["teamScores"][team] >= level.scoreLimit )
3643  return true;
3644  }
3645 
3646  return false;
3647 }
3648 
3649 
3651 {
3652  if ( level.scoreRoundWinBased )
3653  return false;
3654 
3655  if( level.scoreLimit <= 0 )
3656  return false;
3657 
3658  if ( level.teamBased )
3659  {
3661  return true;
3662  }
3663  else
3664  {
3665  for ( i = 0; i < level.players.size; i++ )
3666  {
3667  player = level.players[i];
3668  if ( isdefined( player.pointstowin ) && ( player.pointstowin >= level.scorelimit ) )
3669  return true;
3670  }
3671  }
3672  return false;
3673 }
3674 
3676 {
3677  return (level.roundScoreLimit * (game[ "roundsplayed" ] + 1));
3678 }
3679 
3681 {
3682  round_score_limit = ‪get_current_round_score_limit();
3683 
3684  foreach( team in level.teams )
3685  {
3686  if ( game["teamScores"][team] >= round_score_limit )
3687  return true;
3688  }
3689 
3690  return false;
3691 }
3692 
3693 
3695 {
3696  if ( level.roundScoreLimit <= 0 )
3697  return false;
3698 
3699  if ( level.teamBased )
3700  {
3702  return true;
3703  }
3704  else
3705  {
3706  roundScoreLimit = ‪util::get_current_round_score_limit();
3707 
3708  for ( i = 0; i < level.players.size; i++ )
3709  {
3710  player = level.players[i];
3711  if ( isdefined( player.pointstowin ) && ( player.pointstowin >= roundScoreLimit ) )
3712  return true;
3713  }
3714  }
3715  return false;
3716 }
3717 
3718 function ‪getRoundsWon( team )
3719 {
3720  return game["roundswon"][team];
3721 }
3722 
3723 function ‪getOtherTeamsRoundsWon( skip_team )
3724 {
3725  roundswon = 0;
3726 
3727  foreach ( team in level.teams )
3728  {
3729  if ( team == skip_team )
3730  continue;
3731 
3732  roundswon += game["roundswon"][team];
3733  }
3734  return roundswon;
3735 }
3736 
3738 {
3739  return game["roundsplayed"];
3740 }
3741 
3743 {
3744  if ( level.roundLimit != 1 && level.roundWinLimit != 1 )
3745  return true;
3746 
3747  return false;
3748 }
3749 
3751 {
3752  if( GameModeIsMode( ‪GAMEMODE_LEAGUE_MATCH ) )
3753  return "leaguematch";
3754 
3755  return "publicmatch";
3756 }
3757 
3774 function ‪ground_position( v_start, n_max_dist = 5000, n_ground_offset = 0, e_ignore, b_ignore_water = false, b_ignore_glass = false )
3775 {
3776  const N_TRACE_FUDGE = 5; // make sure position that is already on the ground don't go through the ground
3777 
3778  v_trace_start = v_start + ( 0, 0, N_TRACE_FUDGE );
3779  v_trace_end = v_trace_start + ( 0, 0, ( n_max_dist + N_TRACE_FUDGE ) * -1 );
3780 
3781  a_trace = GroundTrace( v_trace_start, v_trace_end, false, e_ignore, b_ignore_water, b_ignore_glass );
3782 
3783  if ( a_trace[ "surfacetype" ] != "none" )
3784  {
3785  return a_trace[ "position" ] + ( 0, 0, n_ground_offset );
3786  }
3787  else
3788  {
3789  return v_start;
3790  }
3791 }
3792 
3801 function ‪delayed_notify( str_notify, f_delay_seconds )
3802 {
3803  wait f_delay_seconds;
3804 
3805  if ( isDefined( self ) )
3806  {
3807  self notify( str_notify );
3808  }
3809 }
3810 
3818 function ‪delayed_delete( str_notify, f_delay_seconds )
3819 {
3820  assert( isEntity( self ) );
3821 
3822  wait f_delay_seconds;
3823 
3824  if ( isDefined( self ) && isEntity( self ) )
3825  {
3826  self delete();
3827  }
3828 }
3829 
3853 function ‪do_chyron_text( str_1_full , str_1_short , str_2_full , str_2_short , str_3_full , str_3_short , str_4_full , str_4_short , str_5_full = "", str_5_short = "" , n_duration )
3854 {
3855  level.chyron_text_active = true;
3856  level ‪flagsys::set( "chyron_active" );
3857 
3858  if ( !isdefined( n_duration ) )
3859  {
3860  n_duration = 12;
3861  }
3862 
3863  foreach ( player in level.players )
3864  {
3865  player thread ‪player_set_chyron_menu( str_1_full, str_1_short, str_2_full, str_2_short, str_3_full, str_3_short, str_4_full, str_4_short, str_5_full, str_5_short, n_duration );
3866  }
3867 
3868  level waittill( "chyron_menu_closed" );
3869 
3870  level.chyron_text_active = undefined;
3871  level ‪flagsys::clear( "chyron_active" );
3872 }
3873 
3874 function ‪player_set_chyron_menu( str_1_full , str_1_short , str_2_full , str_2_short , str_3_full , str_3_short , str_4_full , str_4_short , str_5_full = "", str_5_short = "" , n_duration ) //self = player
3875 {
3876  self endon( "disconnect" );
3877 
3878  Assert( isdefined( n_duration ), "Must set a duration for displaying the chyron menu text." );
3879 
3880  menuHandle = self OpenLUIMenu( "CPChyron" );
3881 
3882  self SetLUIMenuData( menuHandle, "line1full", str_1_full );
3883  self SetLUIMenuData( menuHandle, "line1short", str_1_short );
3884  self SetLUIMenuData( menuHandle, "line2full", str_2_full );
3885  self SetLUIMenuData( menuHandle, "line2short", str_2_short );
3886 
3887  mapname = GetDvarString( "mapname" );
3888 
3889  hideLine3Full = false;
3890 
3891  if( mapname == "cp_mi_eth_prologue" && ‪IS_BONUSZM )
3892  hideLine3Full = true;
3893 
3894  if( !hideLine3Full )
3895  {
3896  self SetLUIMenuData( menuHandle, "line3full", str_3_full );
3897  self SetLUIMenuData( menuHandle, "line3short", str_3_short );
3898  }
3899 
3900  if ( !‪IS_BONUSZM )
3901  {
3902  self SetLUIMenuData( menuHandle, "line4full", str_4_full );
3903  self SetLUIMenuData( menuHandle, "line4short", str_4_short );
3904  self SetLUIMenuData( menuHandle, "line5full", str_5_full );
3905  self SetLUIMenuData( menuHandle, "line5short", str_5_short );
3906  }
3907 
3908  waittillframeend; // wait for waittills
3909  self notify( "chyron_menu_open" );
3910  level notify( "chyron_menu_open" );
3911 
3912  do
3913  {
3914  self waittill( "menuresponse", menu, response );
3915  }
3916  while ( menu != "CPChyron" || response != "closed" );
3917 
3918  self notify( "chyron_menu_closed" );
3919  level notify( "chyron_menu_closed" );
3920 
3921  wait 5;
3922  self CloseLUIMenu( menuHandle );
3923 }
3924 
3925 //TODO is there a more elegant way to incorporate this into a lookup table?
3926 function ‪get_next_safehouse( str_next_map )
3927 {
3928  switch( str_next_map )
3929  {
3930  case "cp_mi_sing_blackstation":
3931  case "cp_mi_sing_biodomes":
3932  case "cp_mi_sing_sgen":
3933  return "cp_sh_singapore";
3934  case "cp_mi_cairo_infection":
3935  case "cp_mi_cairo_aquifer":
3936  case "cp_mi_cairo_lotus":
3937  return "cp_sh_cairo";
3938  default:
3939  return "cp_sh_mobile";
3940  }
3941 }
3942 
3944 {
3945  mapname = toLower( GetDvarString( "mapname" ) );
3946 
3947  if(mapname == "cp_sh_cairo" ||
3948  mapname == "cp_sh_mobile" ||
3949  mapname == "cp_sh_singapore")
3950  {
3951  return true;
3952  }
3953 
3954  return false;
3955 }
3956 
3958 {
3959  mapname = toLower( GetDvarString( "mapname" ) );
3960 
3961  switch(mapname)
3962  {
3963  case "cp_mi_cairo_aquifer":
3964  case "cp_mi_cairo_infection":
3965  case "cp_mi_cairo_lotus":
3966  case "cp_mi_cairo_ramses":
3967  case "cp_mi_eth_prologue":
3968  case "cp_mi_sing_biodomes":
3969  case "cp_mi_sing_blackstation":
3970  case "cp_mi_sing_chinatown":
3971  case "cp_mi_sing_sgen":
3972  case "cp_mi_sing_vengeance":
3973  case "cp_mi_zurich_coalescene":
3974  case "cp_mi_zurich_newworld":
3975  return true;
3976 
3977  default:
3978  return false;
3979  }
3980 }
3981 
3982 
3984 {
3985  if( self == level )
3986  {
3987  foreach( e_player in level.activeplayers )
3988  {
3989  e_player ‪util::freeze_player_controls( true );
3990  e_player ‪scene::set_igc_active( true );
3991  level notify( "disable_cybercom", e_player, true );
3992  e_player ‪util::show_hud( 0 );
3993  }
3994  }
3995  else
3996  {
3997  self ‪util::freeze_player_controls( true );
3998  self ‪scene::set_igc_active( true );
3999  level notify( "disable_cybercom", self, true );
4000  self ‪util::show_hud( 0 );
4001  }
4002 }
4003 
4005 {
4006  if( self == level )
4007  {
4008  foreach( e_player in level.activeplayers )
4009  {
4010  e_player ‪util::freeze_player_controls( false );
4011  e_player ‪scene::set_igc_active( false );
4012  level notify( "enable_cybercom", e_player );
4013  e_player ‪util::show_hud( 1 );
4014  }
4015  }
4016  else
4017  {
4018  self ‪util::freeze_player_controls( false );
4019  self ‪scene::set_igc_active( false );
4020  level notify( "enable_cybercom", e_player );
4021  self ‪util::show_hud( 1 );
4022  }
4023 }
4024 
4025 function ‪show_hud( b_show ) // self == player
4026 {
4027  if ( b_show )
4028  {
4029  if ( !‪IS_TRUE( self.fullscreen_black_active ) )
4030  {
4031  if ( !self ‪flagsys::get( "playing_movie_hide_hud" ) )
4032  {
4033  if ( !‪scene::is_igc_active() )
4034  {
4035  if ( !‪IS_TRUE( self.dont_show_hud ) )
4036  {
4037  self SetClientUIVisibilityFlag( "hud_visible", true );
4038  }
4039  }
4040  }
4041  }
4042  }
4043  else
4044  {
4045  self SetClientUIVisibilityFlag( "hud_visible", false );
4046  }
4047 }
4048 
4049 
4058 function ‪array_copy_if_array( any_var )
4059 {
4060  return ( IsArray( any_var ) ? ArrayCopy( any_var ) : any_var );
4061 }
4062 
4063 function ‪is_item_purchased( ref )
4064 {
4065  itemIndex = GetItemIndexFromRef( ref );
4066  return ( ( itemIndex < 0 || itemIndex >= 256 ) ? false : self IsItemPurchased( itemIndex ) );
4067 }
4068 
4070 {
4071  return self hasPerk( ref ) && self ‪is_item_purchased( ref );
4072 }
4073 
4074 function ‪has_purchased_perk_equipped_with_specific_stat( single_perk_ref, stats_table_ref )
4075 {
4076  if( IsPlayer( self ) )
4077  {
4078  return self hasPerk( single_perk_ref ) && self ‪is_item_purchased( stats_table_ref );
4079  }
4080  else
4081  {
4082  return false;
4083  }
4084 }
4085 
4086 // some specific perks from mp_statsTable.csv
4087 
4089 {
4090  return ‪has_purchased_perk_equipped( "specialty_flakjacket" );
4091 }
4092 
4094 {
4095  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_nottargetedbyairsupport", "specialty_nottargetedbyairsupport|specialty_nokillstreakreticle" ) );
4096 }
4097 
4099 {
4100  return ‪has_purchased_perk_equipped( "specialty_gpsjammer" );
4101 }
4102 
4104 {
4105  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_stunprotection", "specialty_stunprotection|specialty_flashprotection|specialty_proximityprotection" ) );
4106 }
4107 
4110 function ‪has_hacker_perk_purchased_and_equipped() // aka engineering perk
4111 {
4112  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_showenemyequipment", "specialty_showenemyequipment|specialty_showscorestreakicons|specialty_showenemyvehicles" ) );
4113 }
4114 
4116 {
4117  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_nottargetedbyaitank", "specialty_nottargetedbyaitank|specialty_nottargetedbyraps|specialty_nottargetedbysentry|specialty_nottargetedbyrobot|specialty_immunenvthermal" ) );
4118 }
4119 
4121 {
4122  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_immunecounteruav", "specialty_immunecounteruav|specialty_immuneemp|specialty_immunetriggerc4|specialty_immunetriggershock|specialty_immunetriggerbetty|specialty_sixthsensejammer|specialty_trackerjammer|specialty_immunesmoke" ) );
4123 }
4124 
4126 {
4127  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_sprintfire", "specialty_sprintfire|specialty_sprintgrenadelethal|specialty_sprintgrenadetactical|specialty_sprintequipment" ) );
4128 }
4129 
4131 {
4132  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_fastweaponswitch", "specialty_fastweaponswitch|specialty_sprintrecovery|specialty_sprintfirerecovery" ) );
4133 }
4134 
4136 {
4137  return ‪has_purchased_perk_equipped( "specialty_scavenger" );
4138 }
4139 
4142 function ‪has_jetquiet_perk_purchased_and_equipped() // aka blast suppressor
4143 {
4144  return ( self ‪has_purchased_perk_equipped_with_specific_stat( "specialty_jetquiet", "specialty_jetnoradar|specialty_jetquiet" ) );
4145 }
4146 
4148 {
4149  return ‪has_purchased_perk_equipped( "specialty_loudenemies" );
4150 }
4151 
4154 function ‪has_ninja_perk_purchased_and_equipped() // aka dead silence
4155 {
4156  return ‪has_purchased_perk_equipped( "specialty_quieter" );
4157 }
4158 
4160 {
4161  return ‪has_purchased_perk_equipped( "specialty_bulletflinch" );
4162 }
4163 
4164 function ‪str_strip_lh( str )
4165 {
4166  if ( StrEndsWith( str, "_lh" ) )
4167  {
4168  return GetSubStr( str, 0, str.size - 3 );
4169  }
4170 
4171  return str;
4172 }
4173 
4174 function ‪trackWallRunningDistance() //self == player
4175 {
4176  self endon("disconnect");
4177  self.movementTracking.wallRunning = SpawnStruct();
4178  self.movementTracking.wallRunning.distance = 0;
4179  self.movementTracking.wallRunning.count = 0;
4180  self.movementTracking.wallRunning.time = 0;
4181 
4182  while (true)
4183  {
4184  self waittill( "wallrun_begin" );
4185 
4186  startPos = self.origin;
4187  ‪startTime = GetTime();
4188  self.movementTracking.wallRunning.count++;
4189 
4190  self waittill( "wallrun_end" );
4191 
4192  self.movementTracking.wallRunning.distance += Distance( startPos, self.origin );
4193  self.movementTracking.wallRunning.time += GetTime() - ‪startTime;
4194  }
4195 }
4196 
4197 function ‪trackSprintDistance() //self == player
4198 {
4199  self endon("disconnect");
4200  self.movementTracking.sprinting = SpawnStruct();
4201  self.movementTracking.sprinting.distance = 0;
4202  self.movementTracking.sprinting.count = 0;
4203  self.movementTracking.sprinting.time = 0;
4204 
4205  while (true)
4206  {
4207  self waittill( "sprint_begin" );
4208 
4209  startPos = self.origin;
4210  ‪startTime = GetTime();
4211  self.movementTracking.sprinting.count++;
4212 
4213  self waittill( "sprint_end" );
4214 
4215  self.movementTracking.sprinting.distance += Distance( startPos, self.origin );
4216  self.movementTracking.sprinting.time += GetTime() - ‪startTime;
4217  }
4218 }
4219 
4220 function ‪trackDoubleJumpDistance() //self == player
4221 {
4222  self endon("disconnect");
4223  self.movementTracking.doublejump = SpawnStruct();
4224  self.movementTracking.doublejump.distance = 0;
4225  self.movementTracking.doublejump.count = 0;
4226  self.movementTracking.doublejump.time = 0;
4227 
4228  while (true)
4229  {
4230  self waittill( "doublejump_begin" );
4231 
4232  startPos = self.origin;
4233  ‪startTime = GetTime();
4234  self.movementTracking.doublejump.count++;
4235 
4236  self waittill( "doublejump_end" );
4237 
4238  self.movementTracking.doublejump.distance += Distance( startPos, self.origin );
4239  self.movementTracking.doublejump.time += GetTime() - ‪startTime;
4240  }
4241 }
4242 
4244 {
4245  minimapOrigins = getEntArray( "minimap_corner", "targetname" );
4246  if( miniMapOrigins.size )
4247  {
4248  return ‪math::find_box_center( miniMapOrigins[0].origin, miniMapOrigins[1].origin );
4249  }
4250 
4251  return ( 0, 0, 0 );
4252 }
4253 
4255 {
4256  minimapOrigins = getEntArray( "minimap_corner", "targetname" );
4257  if( miniMapOrigins.size )
4258  {
4259  x = abs( miniMapOrigins[0].origin[0] - miniMapOrigins[1].origin[0] );
4260  y = abs( miniMapOrigins[0].origin[1] - miniMapOrigins[1].origin[1] );
4261 
4262  return max( x, y );
4263  }
4264 
4265  return 0;
4266 }
‪has_purchased_perk_equipped
‪function has_purchased_perk_equipped(ref)
Definition: util_shared.gsc:4069
‪has_hacker_perk_purchased_and_equipped
‪function has_hacker_perk_purchased_and_equipped()
Definition: util_shared.gsc:4110
‪waittill_any_array_return
‪function waittill_any_array_return(a_notifies)
Definition: util_shared.gsc:544
‪script_delay
‪function script_delay()
Definition: util_shared.gsc:970
‪callback
‪function callback(event, localclientnum, params)
Definition: callbacks_shared.csc:13
‪isWeaponEnabled
‪function isWeaponEnabled()
Definition: util_shared.gsc:1158
‪within_fov
‪function within_fov(start_origin, start_angles, end_origin, fov)
Definition: util_shared.gsc:2190
‪startTime
‪class AnimationAdjustmentInfoZ startTime
‪MAX_SPAWNED_PER_FRAME
‪#define MAX_SPAWNED_PER_FRAME
Definition: shared.gsh:307
‪get_rounds_played
‪function get_rounds_played()
Definition: util_shared.gsc:2164
‪button_right_held
‪function button_right_held()
Definition: util_shared.gsc:2333
‪getWeaponClass
‪function getWeaponClass(weapon)
Definition: util_shared.gsc:2676
‪melee_notify_wrapper
‪function melee_notify_wrapper()
Definition: util_shared.gsc:1100
‪get_rounds_won
‪function get_rounds_won(team)
Definition: util_shared.gsc:2145
‪isOneRound
‪function isOneRound()
Definition: util_shared.gsc:3497
‪_timeout
‪function _timeout(delay)
Definition: util_shared.gsc:711
‪button_held_think
‪function button_held_think(which_button)
Definition: util_shared.gsc:2199
‪GAMEMODE_LEAGUE_MATCH
‪#define GAMEMODE_LEAGUE_MATCH
Definition: shared.gsh:15
‪delayed_delete
‪function delayed_delete(str_notify, f_delay_seconds)
Definition: util_shared.gsc:3818
‪spawn_model
‪function spawn_model(model_name, origin, angles, n_spawnflags=0, b_throttle=false)
Definition: util_shared.gsc:1538
‪getRoundWinLimitWinningTeam
‪function getRoundWinLimitWinningTeam()
Definition: util_shared.gsc:3579
‪player_lock_control
‪function player_lock_control()
Definition: util_shared.gsc:3983
‪is_bot
‪function is_bot()
Definition: util_shared.gsc:2488
‪get_time_in_seconds
‪function get_time_in_seconds()
Definition: util_shared.gsc:1746
‪waittill_stance_button_pressed
‪function waittill_stance_button_pressed()
Definition: util_shared.gsc:2383
‪array_copy_if_array
‪function array_copy_if_array(any_var)
Definition: util_shared.gsc:4058
‪get_all_alive_players_s
‪function get_all_alive_players_s()
Definition: util_shared.gsc:2865
‪timer
‪function timer(n_time, str_endon, x, y, height)
Definition: lui_shared.gsc:163
‪coopGame
‪function coopGame()
Definition: util_shared.gsc:1431
‪hitScoreLimit
‪function hitScoreLimit()
Definition: util_shared.gsc:3650
‪any_team_hit_round_score_limit
‪function any_team_hit_round_score_limit()
Definition: util_shared.gsc:3680
‪get_elapsed_time
‪function get_elapsed_time(start_time, end_time)
Definition: util_shared.gsc:2598
‪ground_position
‪function ground_position(v_start, n_max_dist=5000, n_ground_offset=0, e_ignore, b_ignore_water=false, b_ignore_glass=false)
Definition: util_shared.gsc:3774
‪getLastWeapon
‪function getLastWeapon()
Definition: util_shared.gsc:2498
‪get_eye
‪function get_eye()
Definition: util_shared.gsc:1494
‪is_killstreaks_enabled
‪function is_killstreaks_enabled()
Definition: util_shared.gsc:1978
‪setClientSysState
‪function setClientSysState(sSysName, sSysState, player)
Definition: util_shared.gsc:1369
‪getRoundsWon
‪function getRoundsWon(team)
Definition: util_shared.gsc:3718
‪fileprint_map_start
‪function fileprint_map_start(file)
Definition: util_shared.gsc:1037
‪anyTeamHitRoundWinLimit
‪function anyTeamHitRoundWinLimit()
Definition: util_shared.gsc:3555
‪clear
‪function clear(str_flag)
Definition: flag_shared.csc:130
‪has_awareness_perk_purchased_and_equipped
‪function has_awareness_perk_purchased_and_equipped()
Definition: util_shared.gsc:4147
‪has_flak_jacket_perk_purchased_and_equipped
‪function has_flak_jacket_perk_purchased_and_equipped()
Definition: util_shared.gsc:4088
‪find_box_center
‪function find_box_center(mins, maxs)
Definition: math_shared.gsc:86
‪waittill_vehicle_move_up_button_pressed
‪function waittill_vehicle_move_up_button_pressed()
Definition: util_shared.gsc:2443
‪fileprint_map_entity_start
‪function fileprint_map_entity_start()
Definition: util_shared.gsc:1053
‪waittill_any_timeout
‪function waittill_any_timeout(n_timeout, string1, string2, string3, string4, string5)
Definition: util_shared.gsc:631
‪stop_magic_bullet_shield
‪function stop_magic_bullet_shield(ent)
Definition: util_shared.gsc:2100
‪a_kvps_match
‪function query_ents a_kvps_match
Definition: util_shared.gsc:3262
‪empty
‪function empty(a, b, c, d, e)
Definition: util_shared.gsc:52
‪hitRoundScoreLimit
‪function hitRoundScoreLimit()
Definition: util_shared.gsc:3694
‪ads_button_held
‪function ads_button_held()
Definition: util_shared.gsc:2293
‪fileprint_end
‪function fileprint_end()
Definition: util_shared.gsc:1061
‪waittill_multiple
‪function waittill_multiple(...)
Definition: util_shared.gsc:276
‪GetPlaySpaceCenter
‪function GetPlaySpaceCenter()
Definition: util_shared.gsc:4243
‪note_elapsed_time
‪function note_elapsed_time(start_time, label="unknown")
Definition: util_shared.gsc:2567
‪get_time_left
‪function get_time_left()
Definition: util_shared.gsc:1757
‪orient_to_normal
‪function orient_to_normal(normal)
Definition: util_shared.gsc:1163
‪streamer_wait
‪function streamer_wait(n_stream_request_id, n_wait_frames=0, n_timeout=0, b_bonuszm_streamer_fallback=true)
Definition: util_shared.gsc:86
‪waittill_either
‪function waittill_either(msg1, msg2)
Definition: util_shared.gsc:303
‪draw_debug_line
‪function draw_debug_line(start, end, timer)
Definition: util_shared.gsc:150
‪has_cold_blooded_perk_purchased_and_equipped
‪function has_cold_blooded_perk_purchased_and_equipped()
Definition: util_shared.gsc:4115
‪deleteAfterTime
‪function deleteAfterTime(time)
Definition: util_shared.gsc:2710
‪delayed_notify
‪function delayed_notify(str_notify, f_delay_seconds)
Definition: util_shared.gsc:3801
‪get_current_round_score_limit
‪function get_current_round_score_limit()
Definition: util_shared.gsc:3675
‪show_hud
‪function show_hud(b_show)
Definition: util_shared.gsc:4025
‪waittill_player_not_looking_at
‪function waittill_player_not_looking_at(origin, dot, do_trace)
Definition: util_shared.gsc:1641
‪GetPlaySpaceMaxWidth
‪function GetPlaySpaceMaxWidth()
Definition: util_shared.gsc:4254
‪isLastRound
‪function isLastRound()
Definition: util_shared.gsc:3513
‪BUTTON_ADS
‪#define BUTTON_ADS
Definition: shared.gsh:399
‪has_ghost_perk_purchased_and_equipped
‪function has_ghost_perk_purchased_and_equipped()
Definition: util_shared.gsc:4098
‪waittill_level_any_timeout
‪function waittill_level_any_timeout(n_timeout, otherEnt, string1, string2, string3, string4, string5)
Definition: util_shared.gsc:680
‪PositionQuery_PointArray
‪function PositionQuery_PointArray(origin, minSearchRadius, maxSearchRadius, halfHeight, innerSpacing, reachableBy_Ent)
Definition: util_shared.gsc:3462
‪is_lastround
‪function is_lastround()
Definition: util_shared.gsc:2137
‪has_jetquiet_perk_purchased_and_equipped
‪function has_jetquiet_perk_purchased_and_equipped()
Definition: util_shared.gsc:4142
‪is_one_round
‪function is_one_round()
Definition: util_shared.gsc:2121
‪waittill_any
‪function waittill_any(str_notify1, str_notify2, str_notify3, str_notify4, str_notify5, str_notify6)
Definition: util_shared.gsc:581
‪getOtherTeamsRoundsWon
‪function getOtherTeamsRoundsWon(skip_team)
Definition: util_shared.gsc:3723
‪freeze_player_controls
‪function freeze_player_controls(b_frozen=true)
Definition: util_shared.gsc:2474
‪fileprint_map_entity_end
‪function fileprint_map_entity_end()
Definition: util_shared.gsc:1057
‪has_toughness_perk_purchased_and_equipped
‪function has_toughness_perk_purchased_and_equipped()
Definition: util_shared.gsc:4159
‪get_weapon_by_name
‪function get_weapon_by_name(weapon_name)
Definition: util_shared.gsc:3409
‪DELETE_SAFE
‪#define DELETE_SAFE
Definition: shared.gsh:508
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪trackWallRunningDistance
‪function trackWallRunningDistance()
Definition: util_shared.gsc:4174
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪_enableWeapon
‪function _enableWeapon()
Definition: util_shared.gsc:1145
‪debug_sphere
‪function debug_sphere(origin, radius, color, alpha, time)
Definition: util_shared.gsc:215
‪a
‪function add_remove_list a
Definition: util_shared.csc:906
‪get_start_time
‪function get_start_time()
Definition: util_shared.gsc:2550
‪fileprint_map_header
‪function fileprint_map_header(bInclude_blank_worldspawn)
Definition: util_shared.gsc:1045
‪spawn_player_clone
‪function spawn_player_clone(player, animname)
Definition: util_shared.gsc:2049
‪isUsabilityEnabled
‪function isUsabilityEnabled()
Definition: util_shared.gsc:1106
‪DELETE_BOTH
‪#define DELETE_BOTH
Definition: shared.gsh:511
‪waittill_any_return
‪function waittill_any_return(string1, string2, string3, string4, string5, string6, string7)
Definition: util_shared.gsc:416
‪explode_notify_wrapper
‪function explode_notify_wrapper()
Definition: util_shared.gsc:1082
‪waittill_asset_loaded
‪function waittill_asset_loaded(str_type, str_name)
Definition: util_shared.gsc:1921
‪wait_till_not_touching
‪function wait_till_not_touching(e_to_check, e_to_touch)
Definition: util_shared.gsc:1846
‪any_player_is_touching
‪function any_player_is_touching(ent, str_team)
Definition: util_shared.gsc:1868
‪damage_notify_wrapper
‪function damage_notify_wrapper(damage, attacker, direction_vec, point, type, modelName, tagName, partName, iDFlags)
Definition: util_shared.gsc:1076
‪set_lighting_state
‪function set_lighting_state(n_state)
Definition: util_shared.gsc:3037
‪has_ninja_perk_purchased_and_equipped
‪function has_ninja_perk_purchased_and_equipped()
Definition: util_shared.gsc:4154
‪wasLastRound
‪function wasLastRound()
Definition: util_shared.gsc:3521
‪track
‪function track(spot_to_track)
Definition: util_shared.gsc:238
‪deleteAfterTimeThread
‪function deleteAfterTimeThread(time)
Definition: util_shared.gsc:2719
‪resetUsability
‪function resetUsability()
Definition: util_shared.gsc:1130
‪isUsingRemote
‪function isUsingRemote()
Definition: util_shared.gsc:2705
‪STATS_TABLE_CP
‪#define STATS_TABLE_CP
Definition: shared.gsh:450
‪getRoundsPlayed
‪function getRoundsPlayed()
Definition: util_shared.gsc:3737
‪get_time_frac
‪function get_time_frac(n_end_time)
Definition: util_shared.gsc:1751
‪has_gung_ho_perk_purchased_and_equipped
‪function has_gung_ho_perk_purchased_and_equipped()
Definition: util_shared.gsc:4125
‪init_button_wrappers
‪function init_button_wrappers()
Definition: util_shared.gsc:2451
‪waittill_multiple_ents
‪function waittill_multiple_ents(...)
Definition: util_shared.gsc:350
‪STATS_TABLE_COL_GROUP
‪#define STATS_TABLE_COL_GROUP
Definition: _statstable.gsh:4
‪isRankEnabled
‪function isRankEnabled()
Definition: util_shared.gsc:3492
‪damage
‪function damage(trap)
Definition: _zm_trap_electric.gsc:116
‪set_sun_shadow_split_distance
‪function set_sun_shadow_split_distance(f_distance)
Definition: util_shared.gsc:3079
‪get_other_teams_rounds_won
‪function get_other_teams_rounds_won(skip_team)
Definition: util_shared.gsc:2150
‪has_blind_eye_perk_purchased_and_equipped
‪function has_blind_eye_perk_purchased_and_equipped()
Definition: util_shared.gsc:4093
‪waitTillRollingOrNotMoving
‪function waitTillRollingOrNotMoving()
Definition: util_shared.gsc:2647
‪is_female
‪function is_female()
Definition: util_shared.gsc:3448
‪break_glass
‪function break_glass(n_radius=50)
Definition: util_shared.gsc:319
‪is_item_purchased
‪function is_item_purchased(ref)
Definition: util_shared.gsc:4063
‪_delay
‪function _delay(time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:1207
‪DELETE_BEHIND
‪#define DELETE_BEHIND
Definition: shared.gsh:509
‪spawn_array_struct
‪function spawn_array_struct()
Definition: util_shared.gsc:2896
‪spawn_anim_model
‪function spawn_anim_model(model_name, origin, angles, n_spawnflags=0, b_throttle)
Definition: util_shared.gsc:1575
‪DEFAULT
‪#define DEFAULT(__var, __default)
Definition: shared.gsh:270
‪waittill_string
‪function waittill_string(msg, ent)
Definition: util_shared.gsc:248
‪new_timer
‪function new_timer(n_timer_length)
Definition: util_shared.gsc:1732
‪create_flags_and_return_tokens
‪function create_flags_and_return_tokens(flags)
Definition: util_shared.gsc:1017
‪debug_magic_bullet_shield_death
‪function debug_magic_bullet_shield_death(guy)
Definition: util_shared.gsc:2022
‪spawn_anim_player_model
‪function spawn_anim_player_model(model_name, origin, angles, n_spawnflags=0)
Definition: util_shared.gsc:1595
‪is_first_round
‪function is_first_round()
Definition: util_shared.gsc:2129
‪get_array_of_closest
‪function get_array_of_closest(org, array, excluders, max, maxdist)
Definition: util_shared.gsc:2943
‪GetCurrentGameMode
‪function GetCurrentGameMode()
Definition: util_shared.gsc:3750
‪delay
‪function delay(time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:1202
‪fileprint_start
‪function fileprint_start(file)
Definition: util_shared.gsc:1033
‪STATS_TABLE_MP
‪#define STATS_TABLE_MP
Definition: shared.gsh:451
‪get_next_safehouse
‪function get_next_safehouse(str_next_map)
Definition: util_shared.gsc:3926
‪is_primary_damage
‪function is_primary_damage(meansofdeath)
Definition: util_shared.gsc:1788
‪wait_network_frame
‪function wait_network_frame(n_count=1)
Definition: util_shared.gsc:64
‪trackSprintDistance
‪function trackSprintDistance()
Definition: util_shared.gsc:4197
‪isStunned
‪function isStunned()
Definition: util_shared.gsc:813
‪wait_endon
‪function wait_endon(waitTime, endOnString, endonString2, endonString3, endonString4)
Definition: util_shared.gsc:1699
‪stance_button_held
‪function stance_button_held()
Definition: util_shared.gsc:2273
‪is_round_based
‪function is_round_based()
Definition: util_shared.gsc:2169
‪totalPlayerCount
‪function totalPlayerCount()
Definition: util_shared.gsc:3482
‪waittill_use_button_pressed
‪function waittill_use_button_pressed()
Definition: util_shared.gsc:2353
‪is_flashbanged
‪function is_flashbanged()
Definition: util_shared.gsc:1983
‪IsEnemyPlayer
‪function IsEnemyPlayer(player)
Definition: util_shared.gsc:2510
‪waittill_level_string
‪function waittill_level_string(msg, ent, otherEnt)
Definition: util_shared.gsc:260
‪_disableWeapon
‪function _disableWeapon()
Definition: util_shared.gsc:1137
‪has_scavenger_perk_purchased_and_equipped
‪function has_scavenger_perk_purchased_and_equipped()
Definition: util_shared.gsc:4135
‪end
‪function end(final)
Definition: _killcam.gsc:511
‪waittill_any_ents_two
‪function waittill_any_ents_two(ent1, string1, ent2, string2)
Definition: util_shared.gsc:776
‪waittill_ads_button_pressed
‪function waittill_ads_button_pressed()
Definition: util_shared.gsc:2428
‪has_purchased_perk_equipped_with_specific_stat
‪function has_purchased_perk_equipped_with_specific_stat(single_perk_ref, stats_table_ref)
Definition: util_shared.gsc:4074
‪new_func
‪function new_func(func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:891
‪TIMEOUT
‪#define TIMEOUT(__t)
Definition: shared.gsh:218
‪debug_spherical_cone
‪function debug_spherical_cone(origin, domeApex, angle, slices, color, alpha, depthTest, duration)
Definition: util_shared.gsc:185
‪deleteAfterTimeAndNetworkFrame
‪function deleteAfterTimeAndNetworkFrame(time)
Definition: util_shared.gsc:2761
‪isRoundBased
‪function isRoundBased()
Definition: util_shared.gsc:3742
‪delay_notify
‪function delay_notify(time_or_notify, str_notify, str_endon, arg1, arg2, arg3, arg4, arg5)
Definition: util_shared.gsc:1278
‪has_fast_hands_perk_purchased_and_equipped
‪function has_fast_hands_perk_purchased_and_equipped()
Definition: util_shared.gsc:4130
‪is_safehouse
‪function is_safehouse()
Definition: util_shared.gsc:3943
‪waittill_any_ents
‪function waittill_any_ents(ent1, string1, ent2, string2, ent3, string3, ent4, string4, ent5, string5, ent6, string6, ent7, string7)
Definition: util_shared.gsc:737
‪ARRAY_ADD
‪#define ARRAY_ADD(__array, __item)
Definition: shared.gsh:304
‪waitForTime
‪function waitForTime(time)
Definition: util_shared.gsc:2727
‪is_ads
‪function is_ads()
Definition: util_shared.gsc:1521
‪shoot_notify_wrapper
‪function shoot_notify_wrapper()
Definition: util_shared.gsc:1094
‪use_button_held
‪function use_button_held()
Definition: util_shared.gsc:2253
‪get_other_teams_alive_players_s
‪function get_other_teams_alive_players_s(teamNameToIgnore)
Definition: util_shared.gsc:2839
‪_delay_network_frames
‪function _delay_network_frames(n_frames, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:1247
‪delete_on_death_or_notify
‪function delete_on_death_or_notify(e_to_delete, str_notify, str_clientfield=undefined)
Definition: util_shared.gsc:1817
‪player_set_chyron_menu
‪function player_set_chyron_menu(str_1_full, str_1_short, str_2_full, str_2_short, str_3_full, str_3_short, str_4_full, str_4_short, str_5_full="", str_5_short="", n_duration)
Definition: util_shared.gsc:3874
‪BUTTON_ATTACK
‪#define BUTTON_ATTACK
Definition: shared.gsh:400
‪waittill_any_ex
‪function waittill_any_ex(...)
Definition: util_shared.gsc:474
‪script_wait
‪function script_wait(called_from_spawner=false)
Definition: util_shared.gsc:1930
‪wait_till
‪function wait_till(str_flag)
Definition: flag_shared.csc:189
‪is_player_looking_at
‪function is_player_looking_at(origin, dot, do_trace, ignore_ent)
Definition: util_shared.gsc:1664
‪DELETE_AGGRESSIVE
‪#define DELETE_AGGRESSIVE
Definition: shared.gsh:512
‪has_tactical_mask_purchased_and_equipped
‪function has_tactical_mask_purchased_and_equipped()
Definition: util_shared.gsc:4103
‪waitForTimeAndNetworkFrame
‪function waitForTimeAndNetworkFrame(time)
Definition: util_shared.gsc:2741
‪waittill_player_looking_at
‪function waittill_player_looking_at(origin, arc_angle_degrees=90, do_trace, e_ignore)
Definition: util_shared.gsc:1616
‪has_hard_wired_perk_purchased_and_equipped
‪function has_hard_wired_perk_purchased_and_equipped()
Definition: util_shared.gsc:4120
‪array
‪function filter array
Definition: array_shared.csc:16
‪timer_wait
‪function timer_wait(n_wait)
Definition: util_shared.gsc:1773
‪Spawn
‪function Spawn(parent, onDeathCallback)
Definition: _flak_drone.gsc:427
‪STATS_TABLE_ZM
‪#define STATS_TABLE_ZM
Definition: shared.gsh:452
‪isFirstRound
‪function isFirstRound()
Definition: util_shared.gsc:3505
‪getClientSysState
‪function getClientSysState(sSysName)
Definition: util_shared.gsc:1394
‪waittill_notify_or_timeout
‪function waittill_notify_or_timeout(msg, timer)
Definition: util_shared.gsc:1892
‪str_strip_lh
‪function str_strip_lh(str)
Definition: util_shared.gsc:4164
‪do_chyron_text
‪function do_chyron_text(str_1_full, str_1_short, str_2_full, str_2_short, str_3_full, str_3_short, str_4_full, str_4_short, str_5_full="", str_5_short="", n_duration)
Definition: util_shared.gsc:3853
‪_disableUsability
‪function _disableUsability()
Definition: util_shared.gsc:1112
‪waittill_attack_button_pressed
‪function waittill_attack_button_pressed()
Definition: util_shared.gsc:2413
‪get_team_alive_players_s
‪function get_team_alive_players_s(teamName)
Definition: util_shared.gsc:2822
‪getHostPlayer
‪function getHostPlayer()
Definition: util_shared.gsc:2904
‪MAKE_ARRAY
‪#define MAKE_ARRAY(__array)
Definition: shared.gsh:303
‪init
‪function init()
Definition: struct.csc:1
‪WAIT_ABOUT
‪#define WAIT_ABOUT(__time)
Definition: shared.gsh:436
‪global_spawn_throttle
‪function global_spawn_throttle(n_count_per_network_frame)
Definition: spawner_shared.gsc:238
‪hitRoundLimit
‪function hitRoundLimit()
Definition: util_shared.gsc:3547
‪clientNotify
‪function clientNotify(event)
Definition: util_shared.gsc:1416
‪registerClientSys
‪function registerClientSys(sSysName)
Definition: util_shared.gsc:1344
‪getHostPlayerForBots
‪function getHostPlayerForBots()
Definition: util_shared.gsc:2916
‪a_ents
‪function _query_ents_by_substring_helper a_ents
Definition: util_shared.gsc:3334
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪BUTTON_STANCE
‪#define BUTTON_STANCE
Definition: shared.gsh:398
‪single_func
‪function single_func(entity, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:838
‪waitTillNotMoving
‪function waitTillNotMoving()
Definition: util_shared.gsc:2621
‪any_team_hit_score_limit
‪function any_team_hit_score_limit()
Definition: util_shared.gsc:3638
‪exists
‪function exists(str_flag)
Definition: flag_shared.csc:43
‪player_unlock_control
‪function player_unlock_control()
Definition: util_shared.gsc:4004
‪delay_network_frames
‪function delay_network_frames(n_frames, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:1242
‪set_igc_active
‪function set_igc_active(b_in_igc)
Definition: scene_shared.gsc:5028
‪is_looking_at
‪function is_looking_at(ent_or_org, n_dot_range=0.67, do_trace=false, v_offset)
Definition: util_shared.gsc:1448
‪isFlashed
‪function isFlashed()
Definition: util_shared.gsc:796
‪getStatsTableName
‪function getStatsTableName()
Definition: util_shared.gsc:2660
‪BUTTON_USE
‪#define BUTTON_USE
Definition: shared.gsh:397
‪debug_line
‪function debug_line(start, end, color, alpha, depthTest, duration)
Definition: util_shared.gsc:159
‪BUTTON_RIGHT
‪#define BUTTON_RIGHT
Definition: shared.gsh:403
‪attack_button_held
‪function attack_button_held()
Definition: util_shared.gsc:2313
‪change
‪function change(team)
Definition: _teams.gsc:258
‪waittill_use_button_held
‪function waittill_use_button_held()
Definition: util_shared.gsc:2368
‪WaitTillEndOnThreaded
‪function WaitTillEndOnThreaded(waitCondition, callback, endCondition1, endCondition2, endCondition3)
Definition: util_shared.gsc:1713
‪auto_delete
‪function auto_delete(n_mode=DELETE_SAFE, n_min_time_alive=0, n_dist_horizontal=0, n_dist_vertical=0)
Definition: util_shared.gsc:3132
‪is_new_cp_map
‪function is_new_cp_map()
Definition: util_shared.gsc:3957
‪call_func
‪function call_func(s_func)
Definition: util_shared.gsc:914
‪_enableUsability
‪function _enableUsability()
Definition: util_shared.gsc:1119
‪set_console_status
‪function set_console_status()
Definition: util_shared.gsc:1899
‪drawcylinder_think
‪function drawcylinder_think(pos, rad, height, seconds, stop_notify, color, alpha)
Definition: util_shared.gsc:2780
‪timeout
‪function timeout(n_time, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:1011
‪anyTeamHitRoundLimitWithDraws
‪function anyTeamHitRoundLimitWithDraws()
Definition: util_shared.gsc:3566
‪is_time_left
‪function is_time_left()
Definition: util_shared.gsc:1768
‪hitRoundWinLimit
‪function hitRoundWinLimit()
Definition: util_shared.gsc:3609
‪death_notify_wrapper
‪function death_notify_wrapper(attacker, damageType)
Definition: util_shared.gsc:1070
‪is_igc_active
‪function is_igc_active()
Definition: scene_shared.gsc:5045
‪isHacked
‪function isHacked()
Definition: util_shared.gsc:2493
‪alert_notify_wrapper
‪function alert_notify_wrapper()
Definition: util_shared.gsc:1088
‪waittill_stance_button_held
‪function waittill_stance_button_held()
Definition: util_shared.gsc:2398
‪delete_on_death
‪function delete_on_death(ent)
Definition: util_shared.gsc:1796
‪IS_BONUSZM
‪#define IS_BONUSZM
Definition: shared.gsh:532
‪mayApplyScreenEffect
‪function mayApplyScreenEffect()
Definition: util_shared.gsc:2613
‪WaitTillSlowProcessAllowed
‪function WaitTillSlowProcessAllowed()
Definition: util_shared.gsc:2536
‪drawcylinder
‪function drawcylinder(pos, rad, height, duration, stop_notify, color, alpha)
Definition: util_shared.gsc:2768
‪fileprint_radiant_vec
‪function fileprint_radiant_vec(vector)
Definition: util_shared.gsc:1065
‪waittill_any_array
‪function waittill_any_array(a_notifies)
Definition: util_shared.gsc:598
‪get_dot_direction
‪function get_dot_direction(v_point, b_ignore_z, b_normalize, str_direction, b_use_eye)
Definition: math_shared.gsc:198
‪_waitlogic
‪function _waitlogic(s_tracker, notifies)
Definition: util_shared.gsc:386
‪fileprint_chk
‪function fileprint_chk(file, str)
Definition: util_shared.gsc:1041
‪DELETE_BLOCKED
‪#define DELETE_BLOCKED
Definition: shared.gsh:510
‪trackDoubleJumpDistance
‪function trackDoubleJumpDistance()
Definition: util_shared.gsc:4220
‪a_ret
‪return a_ret
Definition: util_shared.gsc:3330
‪waittillend
‪function waittillend(msg)
Definition: util_shared.gsc:233
‪single_thread
‪function single_thread(entity, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.gsc:936
‪_delay_notify
‪function _delay_notify(time_or_notify, str_notify, str_endon, arg1, arg2, arg3, arg4, arg5)
Definition: util_shared.gsc:1283
‪get_closest_player
‪function get_closest_player(org, str_team)
Definition: util_shared.gsc:1338
‪get_time
‪function get_time()
Definition: util_shared.gsc:1740
‪fileprint_map_keypairprint
‪function fileprint_map_keypairprint(key1, key2)
Definition: util_shared.gsc:1049
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265
‪magic_bullet_shield
‪function magic_bullet_shield(ent)
Definition: util_shared.gsc:1997