‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_gametype.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\array_shared;
4 #using scripts\shared\callbacks_shared;
5 #using scripts\shared\flag_shared;
6 #using scripts\shared\gameobjects_shared;
7 #using scripts\shared\hud_shared;
8 #using scripts\shared\laststand_shared;
9 #using scripts\shared\lui_shared;
10 #using scripts\shared\math_shared;
11 #using scripts\shared\spawner_shared;
12 #using scripts\shared\util_shared;
13 #using scripts\shared\music_shared;
14 
15 #insert scripts\shared\shared.gsh;
16 
17 #using scripts\zm\gametypes\_globallogic;
18 #using scripts\zm\gametypes\_globallogic_defaults;
19 #using scripts\zm\gametypes\_globallogic_score;
20 #using scripts\zm\gametypes\_globallogic_spawn;
21 #using scripts\zm\gametypes\_globallogic_ui;
22 #using scripts\zm\gametypes\_globallogic_utils;
23 #using scripts\zm\gametypes\_hud_message;
24 #using scripts\zm\gametypes\_spawning;
25 #using scripts\zm\gametypes\_weapons;
26 
27 #using scripts\zm\_util;
28 #using scripts\zm\_zm;
29 #using scripts\zm\_zm_audio;
30 #using scripts\zm\_zm_blockers;
31 #using scripts\zm\_zm_game_module;
32 #using scripts\zm\_zm_laststand;
33 #using scripts\zm\_zm_pers_upgrades_functions;
34 #using scripts\zm\_zm_spawner;
35 #using scripts\zm\_zm_stats;
36 #using scripts\zm\_zm_utility;
37 
38 #insert scripts\zm\_zm_perks.gsh;
39 
40 #precache( "menu", MENU_TEAM );
41 #precache( "menu", MENU_CLASS );
42 #precache( "menu", MENU_CHANGE_CLASS );
43 #precache( "menu", MENU_CONTROLS );
44 #precache( "menu", MENU_OPTIONS );
45 #precache( "menu", MENU_LEAVEGAME );
46 #precache( "menu", MENU_SPECTATE );
47 #precache( "menu", MENU_RESTART_GAME );
48 #precache( "menu", MENU_SCOREBOARD );
49 #precache( "menu", MENU_INIT_TEAM_ALLIES );
50 #precache( "menu", MENU_INIT_TEAM_AXIS );
51 #precache( "menu", MENU_WAGER_SIDE_BET );
52 #precache( "menu", MENU_WAGER_SIDE_BET_PLAYER );
53 #precache( "menu", MENU_CHANGE_CLASS_WAGER );
54 #precache( "menu", MENU_CHANGE_CLASS_CUSTOM );
55 #precache( "menu", MENU_CHANGE_CLASS_BAREBONES );
56 #precache( "string", "MP_HOST_ENDED_GAME" );
57 #precache( "string", "MP_HOST_ENDGAME_RESPONSE" );
58 
59 #namespace zm_gametype;
60 
61 //
62 // This function *only* sets default values - all gamemode specifics should be over-ridden in script in the gametype script - after the call to this function.
63 //
64 
65 function ‪main( )
66 {
68 
70 
71  ‪menu_init();
72 
73  //util::registerRoundLimit( minValue, maxValue )
75 
76  //util::registerTimeLimit( minValue, maxValue )
78 
79  //util::registerScoreLimit( minValue, maxValue )
81 
82  //util::registerRoundWinLimit( minValue, maxValue )
84 
85  //util::registerNumLives( minValue, maxValue )
87 
88 
89  ‪weapons::registerGrenadeLauncherDudDvar( level.gameType, 10, 0, 1440 );
90  ‪weapons::registerThrownGrenadeDudDvar( level.gameType, 0, 0, 1440 );
91  ‪weapons::registerKillstreakDelay( level.gameType, 0, 0, 1440 );
92 
93  ‪globallogic::registerFriendlyFireDelay( level.gameType, 15, 0, 1440 );
94 
95 
96  level.takeLivesOnDeath = true;
97  level.teamBased = true;
98  level.disablePrematchMessages = true; //NEW
99  level.disableMomentum = true; //NEW
100 
101  level.overrideTeamScore = false;
102  level.overridePlayerScore = false;
103  level.displayHalftimeText = false;
104  level.displayRoundEndText = false;
105 
106  level.allowAnnouncer = false;
107  //level.allowZmbAnnouncer = true;
108 
109  level.endGameOnScoreLimit = false;
110  level.endGameOnTimeLimit = false;
111  level.resetPlayerScoreEveryRound = true;
112 
113  level.doPrematch = false;
114  level.noPersistence = true;
115  level.cumulativeRoundScores = true;
116 
117  level.forceAutoAssign = true;
118  level.dontShowEndReason = true;
119  level.forceAllAllies = true; //NEW
120 
121  //DISABLE TEAM SWAP
122  level.allow_teamchange = false;
123  SetDvar( "scr_disable_team_selection", 1 );
124  //makeDvarServerInfo( "scr_disable_team_selection", 1 );
125 
126  SetDvar( "scr_disable_weapondrop", 1 );
127 
128  level.onStartGameType = &‪onStartGameType;
129 // level.onSpawnPlayer = &onSpawnPlayer;
130  level.onSpawnPlayer = &‪globallogic::blank;
131  level.onSpawnPlayerUnified = &‪onSpawnPlayerUnified;
132  level.onRoundEndGame = &‪onRoundEndGame;
133  //level.giveCustomLoadout = &giveCustomLoadout;
134  level.playerMaySpawn = &‪maySpawn;
135 
136  ‪zm_utility::set_game_var("ZM_roundLimit", 1);
137  ‪zm_utility::set_game_var("ZM_scoreLimit", 1);
138 
139  ‪zm_utility::set_game_var("_team1_num", 0);
140  ‪zm_utility::set_game_var("_team2_num", 0);
141 
142  map_name = level.script;
143 
144  //level.gamemode_match = spawnstruct();
145 
146  mode = GetDvarString( "ui_gametype" );
147 
148  if((!isdefined(mode) || mode == "") && isdefined(level.default_game_mode))
149  {
150  mode = level.default_game_mode;
151  }
152 
154 
155  ‪zm_utility::set_game_var_once("side_selection", 1);
156 
157  location = level.default_start_location;
158  ‪zm_utility::set_gamemode_var_once("location", location);
159 
160 
161  //* level.gamemode_match.num_rounds = GetDvarInt("zm_num_rounds");
162  //level.gamemode_match.rounds = [];
163  ‪zm_utility::set_gamemode_var_once("randomize_mode", GetDvarInt("zm_rand_mode"));
164  ‪zm_utility::set_gamemode_var_once("randomize_location", GetDvarInt("zm_rand_loc"));
165  ‪zm_utility::set_gamemode_var_once("team_1_score", 0);
166  ‪zm_utility::set_gamemode_var_once("team_2_score", 0);
167  ‪zm_utility::set_gamemode_var_once("current_round", 0);
168  ‪zm_utility::set_gamemode_var_once("rules_read", false);
169  ‪zm_utility::set_game_var_once("switchedsides", false);
170 
171  gametype = GetDvarString("ui_gametype");
172 
173  game["dialog"]["gametype"] = gametype + "_start";
174  game["dialog"]["gametype_hardcore"] = gametype + "_start";
175  game["dialog"]["offense_obj"] = "generic_boost";
176  game["dialog"]["defense_obj"] = "generic_boost";
177 
178  ‪zm_utility::set_gamemode_var("pre_init_zombie_spawn_func", undefined);
179  ‪zm_utility::set_gamemode_var("post_init_zombie_spawn_func", undefined);
180  ‪zm_utility::set_gamemode_var("match_end_notify", undefined);
181  ‪zm_utility::set_gamemode_var("match_end_func", undefined);
182 
183  // Sets the scoreboard columns and determines with data is sent across the network
184  setscoreboardcolumns( "score", "kills", "downs", "revives", "headshots" );
186  // level thread module_hud_connecting();
187 }
188 
190 {
191  level.spawnPlayer = &‪globallogic_spawn::spawnPlayer;
192  level.spawnPlayerPrediction = &‪globallogic_spawn::spawnPlayerPrediction;
193  level.spawnClient = &‪globallogic_spawn::spawnClient;
194  level.spawnSpectator = &‪globallogic_spawn::spawnSpectator;
195  level.spawnIntermission = &‪globallogic_spawn::spawnIntermission;
196  level.scoreOnGivePlayerScore = &‪globallogic_score::givePlayerScore;
197  level.onPlayerScore = &‪globallogic::blank;
198  level.onTeamScore = &‪globallogic::blank;
199 
200  level.waveSpawnTimer = &‪globallogic::waveSpawnTimer;
201 
202  level.onSpawnPlayer = &‪globallogic::blank;
203  level.onSpawnPlayerUnified = &‪globallogic::blank;
204  level.onSpawnSpectator = &‪onSpawnSpectator;
205  level.onSpawnIntermission = &‪onSpawnIntermission;
206  level.onRespawnDelay = &‪globallogic::blank;
207 
208  level.onForfeit = &‪globallogic::blank;
209  level.onTimeLimit = &‪globallogic::blank;
210  level.onScoreLimit = &‪globallogic::blank;
211  level.onDeadEvent = &‪onDeadEvent;
212  level.onOneLeftEvent = &‪globallogic::blank;
213  level.giveTeamScore = &‪globallogic::blank;
214 
215  level.getTimePassed = &‪globallogic_utils::getTimePassed;
216  level.getTimeLimit = &‪globallogic_defaults::default_getTimeLimit;
217  level.getTeamKillPenalty = &‪globallogic::blank;
218  level.getTeamKillScore = &‪globallogic::blank;
219 
220  level.isKillBoosting = &‪globallogic::blank;
221 
222  level._setTeamScore = &‪globallogic_score::_setTeamScore;
223  level._setPlayerScore = &‪globallogic::blank;
224 
225  level._getTeamScore = &‪globallogic::blank;
226  level._getPlayerScore = &‪globallogic::blank;
227 
228  level.onPrecacheGameType = &‪globallogic::blank;
229  level.onStartGameType = &‪globallogic::blank;
230  level.onPlayerConnect = &‪globallogic::blank;
231  level.onPlayerDisconnect = &‪onPlayerDisconnect;
232  level.onPlayerDamage = &‪globallogic::blank;
233  level.onPlayerKilled = &‪globallogic::blank;
234  level.onPlayerKilledExtraUnthreadedCBs = [];
235 
236  level.onTeamOutcomeNotify = &‪hud_message::teamOutcomeNotifyZombie;
237  level.onOutcomeNotify = &‪globallogic::blank;
238  level.onTeamWagerOutcomeNotify = &‪globallogic::blank;
239  level.onWagerOutcomeNotify = &‪globallogic::blank;
240  level.onEndGame = &‪onEndGame;
241  level.onRoundEndGame = &‪globallogic::blank;
242  level.onMedalAwarded = &‪globallogic::blank;
243  level.dogManagerOnGetDogs = &‪globallogic::blank;
244 
245 
246  level.autoassign = &‪globallogic_ui::menuAutoAssign;
247  level.spectator = &‪globallogic_ui::menuSpectator;
248  level.curClass = &‪globallogic_ui::menuClass;
249  level.allies = &‪menuAlliesZombies;
250  level.teamMenu = &‪globallogic_ui::menuTeam;
251 
252  level.callbackActorKilled = &‪globallogic::blank;
253  level.callbackVehicleDamage = &‪globallogic::blank;
254  level.callbackVehicleKilled = &‪globallogic::blank;
255 }
256 
258 {
259  self endon("disconnect");
260 
261  self._being_shellshocked = true;
262  self shellshock("grief_stab_zm",.75);
263  wait(.75);
264  self._being_shellshocked = false;
265 }
266 
268 {
269  //Tombstone is currently used as Stampinup Light and will not be coming back,
270  //just return false now
271  return false;
272 }
273 
275 {
276  if(isDefined(level.game_mode_custom_onPlayerDisconnect))
277  {
278  level [[level.game_mode_custom_onPlayerDisconnect]](self);
279  }
280  if( isdefined( level.check_quickrevive_hotjoin ) )
281  {
282  level thread [[ level.check_quickrevive_hotjoin ]]();
283  }
284  level ‪zm::checkForAllDead(self);
285 }
286 
287 function ‪onDeadEvent( team )
288 {
289  thread ‪globallogic::endGame( level.zombie_team, "" );
290 }
291 
293 {
294  spawnpointname = "info_intermission";
295  spawnpoints = getentarray( spawnpointname, "classname" );
296 
297  // CODER_MOD: TommyK (8/5/08)
298  if(spawnpoints.size < 1)
299  {
300 
301  return;
302  }
303 
304  spawnpoint = spawnpoints[RandomInt(spawnpoints.size)];
305  if( isDefined( spawnpoint ) )
306  {
307  self ‪spawn( spawnpoint.origin, spawnpoint.angles );
308  }
309 }
310 
311 function ‪onSpawnSpectator( origin, angles )
312 {
313 }
314 
315 
316 
317 function ‪maySpawn()
318 {
319  if ( IsDefined(level.customMaySpawnLogic) )
320  return self [[ level.customMaySpawnLogic ]]();
321 
322  if ( self.pers["lives"] == 0 )
323  {
324  level notify( "player_eliminated" );
325  self notify( "player_eliminated" );
326  return false;
327  }
328  return true;
329 }
330 
332 {
333  setClientNameMode("auto_change");
334 
335  level.spawnMins = ( 0, 0, 0 );
336  level.spawnMaxs = ( 0, 0, 0 );
337  structs = ‪struct::get_array("player_respawn_point", "targetname");
338  foreach(struct in structs)
339  {
340  level.spawnMins = ‪math::expand_mins( level.spawnMins, struct.origin );
341  level.spawnMaxs = ‪math::expand_maxs( level.spawnMaxs, struct.origin );
342  }
343 
344  level.mapCenter = ‪math::find_box_center( level.spawnMins, level.spawnMaxs );
345  setMapCenter( level.mapCenter );
346 
347 
348 
349 // globallogic_ui::setObjectiveText( "allies", &"OBJECTIVES_ZSURVIVAL" );
350 // globallogic_ui::setObjectiveText( "axis", &"OBJECTIVES_ZSURVIVAL" );
351 //
352 // if ( level.splitscreen )
353 // {
354 // globallogic_ui::setObjectiveScoreText( "allies", &"OBJECTIVES_ZSURVIVAL" );
355 // globallogic_ui::setObjectiveScoreText( "axis", &"OBJECTIVES_ZSURVIVAL" );
356 // }
357 // else
358 // {
359 // globallogic_ui::setObjectiveScoreText( "allies", &"OBJECTIVES_ZSURVIVAL_SCORE" );
360 // globallogic_ui::setObjectiveScoreText( "axis", &"OBJECTIVES_ZSURVIVAL_SCORE" );
361 // }
362 // globallogic_ui::setObjectiveHintText( "allies", &"OBJECTIVES_ZSURVIVAL_HINT" );
363 // globallogic_ui::setObjectiveHintText( "axis", &"OBJECTIVES_ZSURVIVAL_HINT" );
364 
365 // level.spawnMins = ( 0, 0, 0 );
366 // level.spawnMaxs = ( 0, 0, 0 );
367 // spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
368 // spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
369 // spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
370 // spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
371 // spawning::updateAllSpawnPoints();
372 //
373 // level.spawn_axis_start= spawnlogic::getSpawnpointArray("mp_tdm_spawn_axis_start");
374 // level.spawn_allies_start= spawnlogic::getSpawnpointArray("mp_tdm_spawn_allies_start");
375 //
376 // level.mapCenter = spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
377 // setMapCenter( level.mapCenter );
378 //
379 // spawnpoint = spawnlogic::getRandomIntermissionPoint();
380 // setDemoIntermissionPoint( spawnpoint.origin, spawnpoint.angles );
381 
382  //allowed[0] = "zsurvival";
383 
384  level.displayRoundEndText = false;
385  //gameobjects::main(allowed);
386 
387  // now that the game objects have been deleted place the influencers
389 
390  if ( !‪util::isOneRound() )
391  {
392  level.displayRoundEndText = true;
393  if( level.scoreRoundWinBased )
394  {
396  }
397  }
398 }
399 
401 {
402  ‪onSpawnPlayer(false);
403 }
404 
405 
406 // coop_player_spawn_placement()
407 // {
408 // structs = struct::get_array( "initial_spawn_points", "targetname" );
409 //
410 // temp_ent = Spawn( "script_model", (0,0,0) );
411 // for( i = 0; i < structs.size; i++ )
412 // {
413 // temp_ent.origin = structs[i].origin;
414 // temp_ent placeSpawnpoint();
415 // structs[i].origin = temp_ent.origin;
416 // }
417 // temp_ent Delete();
418 //
419 // level flag::wait_till( "start_zombie_round_logic" );
420 //
421 // //chrisp - adding support for overriding the default spawning method
422 //
423 // players = GetPlayers();
424 //
425 // for( i = 0; i < players.size; i++ )
426 // {
427 // players[i] setorigin( structs[i].origin );
428 // players[i] setplayerangles( structs[i].angles );
429 // players[i].spectator_respawn = structs[i];
430 // }
431 // }
432 
433 
435 {
436 
437 
438  if(level ‪flag::get("begin_spawning"))
439  {
440  spawnPoint = ‪zm::check_for_valid_spawn_near_team( self, true );
441  }
442 
443  if (!isdefined(spawnPoint))
444  {
445  match_string = "";
446 
447  location = level.scr_zm_map_start_location;
448  if ((location == "default" || location == "" ) && IsDefined(level.default_start_location))
449  {
450  location = level.default_start_location;
451  }
452 
453  match_string = level.scr_zm_ui_gametype + "_" + location;
454 
455  spawnPoints = [];
456  structs = ‪struct::get_array("initial_spawn", "script_noteworthy");
457  if(IsDefined(structs))
458  {
459  foreach(struct in structs)
460  {
461  if(IsDefined(struct.script_string) )
462  {
463 
464  tokens = strtok(struct.script_string," ");
465  foreach(token in tokens)
466  {
467  if(token == match_string )
468  {
469  spawnPoints[spawnPoints.size] = struct;
470  }
471  }
472  }
473 
474  }
475  }
476 
477  if(!IsDefined(spawnPoints) || spawnPoints.size == 0) // old method, failed new method.
478  {
479  spawnPoints = ‪struct::get_array("initial_spawn_points", "targetname");
480  }
481 
482  assert(IsDefined(spawnPoints), "Could not find initial spawn points!");
483 
484  spawnPoint = ‪zm::getFreeSpawnpoint( spawnPoints, self );
485  }
486 
487  return spawnPoint;
488 }
489 
490 
491 
492 
493 function ‪onSpawnPlayer(predictedSpawn)
494 {
495  if(!IsDefined(predictedSpawn))
496  {
497  predictedSpawn = false;
498  }
499 
500  pixbeginevent("ZSURVIVAL:onSpawnPlayer");
501  self.usingObj = undefined;
502 
503  self.is_zombie = false;
504 
505  ‪zm::updatePlayerNum( self );
506 
507  //For spectator respawn
508  if( IsDefined( level.custom_spawnPlayer ) && ‪IS_TRUE(self.player_initialized))
509  {
510  self [[level.custom_spawnPlayer]]();
511  return;
512  }
513 
514 
515  if( isdefined(level.customSpawnLogic) )
516  {
517 
518  spawnPoint = self [[level.customSpawnLogic]](predictedSpawn);
519  if (predictedSpawn)
520  return;
521  }
522  else
523  {
524 
525 
526  spawnPoint = self ‪onFindValidSpawnPoint();
527 
528  if ( predictedSpawn )
529  {
530  self predictSpawnPoint( spawnPoint.origin, spawnPoint.angles );
531  return;
532  }
533 /* else if(game["switchedsides"]) // mid match.
534  {
535  self setorigin(spawnPoint.origin);
536  self setplayerangles (spawnPoint.angles);
537  self notify( "spawned_player" );
538  return;
539  }*/
540  else
541  {
542  self ‪spawn( spawnPoint.origin, spawnPoint.angles, "zsurvival" );
543  }
544  }
545 
546 
547  //Zombies player setup
548  self.entity_num = self GetEntityNumber();
549  self thread ‪zm::onPlayerSpawned();
550  self thread ‪zm::player_revive_monitor();
551  self freezecontrols( true );
552  self.spectator_respawn = spawnPoint;
553 
554  self.score = self ‪globallogic_score::getPersStat( "score" );
555  //self.pers["lives"] = 1;
556 
557  self.pers["participation"] = 0;
558 
559  self.score_total = self.score;
560  self.old_score = self.score;
561 
562  self.player_initialized = false;
563  self.zombification_time = 0;
564  self.enableText = true;
565 
566  // DCS 090910: now that player can destroy some barricades before set.
568 
569  if(!‪IS_TRUE(level.host_ended_game))
570  {
571  self ‪util::freeze_player_controls( false );
572  self enableWeapons();
573  }
574  if(isDefined(level.game_mode_spawn_player_logic))
575  {
576  spawn_in_spectate = [[level.game_mode_spawn_player_logic]]();
577  if(spawn_in_spectate)
578  {
579  self ‪util::delay(.05, undefined, &‪zm::spawnSpectator);
580  }
581  }
582 
583  pixendevent();
584 }
585 //---------------------------------------------------------------------------------------------------
586 // check if ent or struct valid for gametype use.
587 // DCS 051512
588 //---------------------------------------------------------------------------------------------------
590 {
591  match_string = "";
592 
593  location = level.scr_zm_map_start_location;
594  if ((location == "default" || location == "" ) && IsDefined(level.default_start_location))
595  {
596  location = level.default_start_location;
597  }
598 
599  match_string = level.scr_zm_ui_gametype + "_" + location;
600 
601  player_spawns = [];
602  structs = ‪struct::get_array("player_respawn_point", "targetname");
603  foreach(struct in structs)
604  {
605  if(IsDefined(struct.script_string) )
606  {
607  tokens = strtok(struct.script_string," ");
608  foreach(token in tokens)
609  {
610  if(token == match_string )
611  {
612  player_spawns[player_spawns.size] = struct;
613  }
614  }
615  }
616  else // no gametype defining string, add to array for all locations.
617  {
618  player_spawns[player_spawns.size] = struct;
619  }
620  }
621  return player_spawns;
622 }
623 
624 function ‪onEndGame( winningTeam )
625 {
626  //Clean up this players crap
627 }
628 
629 function ‪onRoundEndGame( roundWinner )
630 {
631  if ( game["roundswon"]["allies"] == game["roundswon"]["axis"] )
632  winner = "tie";
633  else if ( game["roundswon"]["axis"] > game["roundswon"]["allies"] )
634  winner = "axis";
635  else
636  winner = "allies";
637 
638  return winner;
639 }
640 
641 // giveCustomLoadout( takeAllWeapons, alreadySpawned )
642 // {
643 // self TakeAllWeapons();
644 // self giveWeapon( level.weaponBaseMelee );
645 // self giveWeapon( GetWeapon( "frag_grenade" ) );
646 // self zm_utility::give_start_weapon( true );
647 // }
648 
649 function ‪menu_init()
650 {
651  game["menu_team"] = ‪MENU_TEAM;
652  game["menu_changeclass_allies"] = ‪MENU_CHANGE_CLASS;
653  game["menu_initteam_allies"] = ‪MENU_INIT_TEAM_ALLIES;
654  game["menu_changeclass_axis"] = ‪MENU_CHANGE_CLASS;
655  game["menu_initteam_axis"] = ‪MENU_INIT_TEAM_AXIS;
656  game["menu_class"] = ‪MENU_CLASS;
657  game["menu_start_menu"] = ‪MENU_START_MENU;
658  game["menu_changeclass"] = ‪MENU_CHANGE_CLASS;
659  game["menu_changeclass_offline"] = ‪MENU_CHANGE_CLASS;
660  game["menu_wager_side_bet"] = ‪MENU_WAGER_SIDE_BET;
661  game["menu_wager_side_bet_player"] = ‪MENU_WAGER_SIDE_BET_PLAYER;
662  game["menu_changeclass_wager"] = ‪MENU_CHANGE_CLASS_WAGER;
663  game["menu_changeclass_custom"] = ‪MENU_CHANGE_CLASS_CUSTOM;
664  game["menu_changeclass_barebones"] = ‪MENU_CHANGE_CLASS_BAREBONES;
665 
666  game["menu_controls"] = ‪MENU_CONTROLS;
667  game["menu_options"] = ‪MENU_OPTIONS;
668  game["menu_leavegame"] = ‪MENU_LEAVEGAME;
669  game["menu_restartgamepopup"] = ‪MENU_RESTART_GAME;
670 
671  level thread ‪menu_onPlayerConnect();
672 }
673 
675 {
676  for(;;)
677  {
678  level waittill("connecting", player);
679  player thread ‪menu_onMenuResponse();
680  }
681 }
682 
684 {
685  self endon("disconnect");
686 
687  for(;;)
688  {
689  self waittill("menuresponse", menu, response);
690 
691  //println( self getEntityNumber() + " menuresponse: " + menu + " " + response );
692 
693  //iprintln("^6", response);
694 
695  if ( response == "back" )
696  {
697  self closeInGameMenu();
698 
699  if ( level.console )
700  {
701  if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] || menu == game["menu_team"] || menu == game["menu_controls"] )
702  {
703 // assert(self.pers["team"] == "allies" || self.pers["team"] == "axis");
704 
705  if( self.pers["team"] == "allies" )
706  self openMenu( game[ "menu_start_menu" ] );
707  if( self.pers["team"] == "axis" )
708  self openMenu( game[ "menu_start_menu" ] );
709  }
710  }
711  continue;
712  }
713 
714  if(response == "changeteam" && level.allow_teamchange == "1")
715  {
716  self closeInGameMenu();
717  self openMenu(game["menu_team"]);
718  }
719 
720  if(response == "changeclass_marines" )
721  {
722  self closeInGameMenu();
723  self openMenu( game["menu_changeclass_allies"] );
724  continue;
725  }
726 
727  if(response == "changeclass_opfor" )
728  {
729  self closeInGameMenu();
730  self openMenu( game["menu_changeclass_axis"] );
731  continue;
732  }
733 
734  if(response == "changeclass_wager" )
735  {
736  self closeInGameMenu();
737  self openMenu( game["menu_changeclass_wager"] );
738  continue;
739  }
740 
741  if(response == "changeclass_custom" )
742  {
743  self closeInGameMenu();
744  self openMenu( game["menu_changeclass_custom"] );
745  continue;
746  }
747 
748  if(response == "changeclass_barebones" )
749  {
750  self closeInGameMenu();
751  self openMenu( game["menu_changeclass_barebones"] );
752  continue;
753  }
754 
755  if(response == "changeclass_marines_splitscreen" )
756  self openMenu( "changeclass_marines_splitscreen" );
757 
758  if(response == "changeclass_opfor_splitscreen" )
759  self openMenu( "changeclass_opfor_splitscreen" );
760 
761  if(response == "endgame")
762  {
763  // TODO: replace with onSomethingEvent call
764  if(self IsSplitscreen() )
765  {
766  //if ( level.console )
767  // endparty();
768  level.skipVote = true;
769 
770  if ( !‪IS_TRUE(level.gameended) )
771  {
772  self ‪zm_stats::increment_client_stat( "deaths" );
773  self ‪zm_stats::increment_player_stat( "deaths" );
775 
776  level.host_ended_game = true;
778  level notify("end_game");
779  }
780  }
781 
782  continue;
783  }
784 
785  if ( response == "restart_level_zm")
786  {
787  self ‪zm_stats::increment_client_stat( "deaths" );
788  self ‪zm_stats::increment_player_stat( "deaths" );
790  MissionFailed();
791  }
792 
793  if(response == "killserverpc")
794  {
795  level thread ‪globallogic::killserverPc();
796 
797  continue;
798  }
799 
800  if ( response == "endround" )
801  {
802  if ( !‪IS_TRUE(level.gameEnded ))
803  {
805 
806  self closeInGameMenu();
807 
808  level.host_ended_game = true;
810  level notify("end_game");
811  }
812  else
813  {
814  self closeInGameMenu();
815  self iprintln( &"MP_HOST_ENDGAME_RESPONSE" );
816  }
817  continue;
818  }
819 
820  if(menu == game["menu_team"] && level.allow_teamchange == "1")
821  {
822  switch(response)
823  {
824  case "allies":
825  //self closeInGameMenu();
826  self [[level.allies]]();
827  break;
828 
829  case "axis":
830  //self closeInGameMenu();
831  self [[level.teamMenu]](response);
832  break;
833 
834  case "autoassign":
835  //self closeInGameMenu();
836  self [[level.autoassign]]( true );
837  break;
838 
839  case "spectator":
840  //self closeInGameMenu();
841  self [[level.spectator]]();
842  break;
843  }
844  } // the only responses remain are change class events
845  else if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] || menu == game["menu_changeclass_wager"] || menu == game["menu_changeclass_custom"] || menu == game["menu_changeclass_barebones"] )
846  {
847  self closeInGameMenu();
848 
849  if( level.rankedMatch && isSubstr(response, "custom") )
850  {
851  //if ( self IsItemLocked( _rank::GetItemIndex( "feature_cac" ) ) )
852  //kick( self getEntityNumber() );
853  }
854 
855  self.selectedClass = true;
856  self [[level.curClass]](response);
857  }
858  }
859 }
860 
862 {
864 
865  if ( !level.console && level.allow_teamchange == "0" && (isdefined(self.hasDoneCombat) && self.hasDoneCombat) )
866  {
867  return;
868  }
869 
870  if(self.pers["team"] != "allies")
871  {
872  // allow respawn when switching teams during grace period.
873  if ( level.inGracePeriod && (!isdefined(self.hasDoneCombat) || !self.hasDoneCombat) )
874  self.hasSpawned = false;
875 
876  if(self.sessionstate == "playing")
877  {
878  self.switching_teams = true;
879  self.joining_team = "allies";
880  self.leaving_team = self.pers["team"];
881  self ‪suicide();
882  }
883 
884  self.pers["team"] = "allies";
885  self.team = "allies";
886  self.pers["class"] = undefined;
887  self.curClass = undefined;
888  self.pers["weapon"] = undefined;
889  self.pers["savedmodel"] = undefined;
890 
892 
893  self.sessionteam = "allies";
894 
895  self SetClientScriptMainMenu( game[ "menu_start_menu" ] );
896 
897  self notify("joined_team");
898  level notify( "joined_team" );
899  self ‪callback::callback( #"on_joined_team" );
900  self notify("end_respawn");
901  }
902 
903  //self beginClassChoice();
904 }
905 
907 {
908  array::thread_all(level.zombie_spawners, &‪spawner::add_spawn_function, &‪zm_spawner::zombie_spawn_init);
909  array::thread_all(level.zombie_spawners, &‪spawner::add_spawn_function, level._zombies_round_spawn_failsafe);
910 }
911 
912 function ‪init()
913 {
914  level ‪flag::init( "pregame" );
915 
916  level ‪flag::set( "pregame" );
917 
918  level thread ‪onPlayerConnect();
919 }
920 
922 {
923  for ( ;; )
924  {
925  level waittill( "connected", player );
926  player thread ‪onPlayerSpawned();
927  if(isDefined(level.game_module_onPlayerConnect))
928  {
929  player [[level.game_module_onPlayerConnect]]();
930  }
931  }
932 }
933 
935 {
936  level endon( "end_game" );
937  self endon( "disconnect" );
938 
939  for ( ;; )
940  {
941  self ‪util::waittill_either( "spawned_player", "fake_spawned_player" );
942 
943  if ( ‪IS_TRUE( level.match_is_ending) )
944  {
945  return;
946  }
947 
949  {
950  self thread ‪zm_laststand::auto_revive( self );
951  }
952 
953  if ( IsDefined( level.custom_player_fake_death_cleanup ) )
954  {
955  self [[ level.custom_player_fake_death_cleanup ]]();
956  }
957 
958  self SetStance( "stand" );
959  self.zmbDialogQueue = [];
960  self.zmbDialogActive = false;
961  self.zmbDialogGroups = [];
962  self.zmbDialogGroup = "";
963 
964  self TakeAllWeapons();
965 
966  if ( IsDefined( level.giveCustomCharacters ) )
967  {
968  self [[ level.giveCustomCharacters ]]();
969  //TODO: Update the stat lookup to set the correct character index
970  //self SetDStat( "characterContext", "characterIndex", self GetCharacterBodyType() );
971  }
972 
973  self GiveWeapon( level.weaponBaseMelee );
974 
975  if(isDefined(level.onPlayerSpawned_restore_previous_weapons) && ‪IS_TRUE(level.isresetting_grief)) //give players back their weapons if Grief is reset after a stalemate
976  {
977  weapons_restored = self [[level.onPlayerSpawned_restore_previous_weapons]]();
978  }
979  if(!‪IS_TRUE(weapons_restored))
980  {
982  }
983 
984  weapons_restored = 0;
985 
986  if ( IsDefined( level._team_loadout ) )
987  {
988  self GiveWeapon( level._team_loadout );
989  self SwitchToWeapon( level._team_loadout );
990  }
991 
992  if(isdefined(level.gamemode_post_spawn_logic))
993  {
994  self [[level.gamemode_post_spawn_logic]]();
995  }
996  }
997 }
998 
999 
1001 {
1002  map_logic_exists = level ‪flag::exists( "start_zombie_round_logic" );
1003  map_logic_started = level ‪flag::get( "start_zombie_round_logic" );
1004 
1005  if( map_logic_exists && map_logic_started )
1006  {
1007  self thread ‪player_hotjoin();
1008  }
1009 }
1010 
1012 {
1013  self endon("disconnect");
1014 
1015  self ‪initialBlack();
1016 
1017  self.rebuild_barrier_reward = 1; //to prevent losing this pers upgrade when he spawns in at the end of the round. It gets cleared for all players once the new round starts
1018  self.is_hotjoining = true;
1019 
1020  wait(.5);
1021 
1022  if ( IsDefined( level.giveCustomCharacters ) )
1023  {
1024  self [[ level.giveCustomCharacters ]]();
1025  //TODO: Update the stat lookup to set the correct character index
1026  //self SetDStat( "characterContext", "characterIndex", self GetCharacterBodyType() );
1027  }
1028  self ‪zm::spawnSpectator();
1029  music::setmusicstate("none");//stops loadscreen music from looping indefinitely
1030 
1031  self.is_hotjoining = false;
1032  self.is_hotjoin = true;
1033 
1034  self thread ‪wait_fade_in();
1035 
1036  if(‪IS_TRUE(level.intermission) || ‪IS_TRUE(level.host_ended_game) )
1037  {
1038  self SetClientThirdPerson( 0 );
1039  self resetFov();
1040 
1041  self.health = 100; // This is needed so the player view doesn't get stuck
1042  self thread [[level.custom_intermission]]();
1043 
1044  }
1045 
1046 }
1047 
1048 
1049 function ‪wait_fade_in( )
1050 {
1051  self ‪util::streamer_wait( undefined, 0, 30 );
1052 
1053  if ( isdefined( level.hotjoin_extra_blackscreen_time ) )
1054  {
1055  wait level.hotjoin_extra_blackscreen_time;
1056  }
1057 
1058  ‪initialBlackEnd();
1059 }
1060 
1062 {
1063  self CloseMenu( "InitialBlack" );
1064  self OpenMenu( "InitialBlack" );
1065 }
1066 
1068 {
1069  self CloseMenu( "InitialBlack" );
1070 }
‪endGame
‪function endGame(winner, endReasonText)
Definition: _globallogic.gsc:1950
‪MENU_WAGER_SIDE_BET_PLAYER
‪#define MENU_WAGER_SIDE_BET_PLAYER
Definition: shared.gsh:472
‪expand_maxs
‪function expand_maxs(maxs, point)
Definition: math_shared.gsc:114
‪callback
‪function callback(event, localclientnum, params)
Definition: callbacks_shared.csc:13
‪MENU_CHANGE_CLASS
‪#define MENU_CHANGE_CLASS
Definition: shared.gsh:461
‪MENU_INIT_TEAM_AXIS
‪#define MENU_INIT_TEAM_AXIS
Definition: shared.gsh:470
‪MENU_CHANGE_CLASS_WAGER
‪#define MENU_CHANGE_CLASS_WAGER
Definition: shared.gsh:473
‪isOneRound
‪function isOneRound()
Definition: util_shared.gsc:3497
‪blank
‪function blank(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
Definition: _globallogic.gsc:333
‪increment_client_stat
‪function increment_client_stat(stat_name, include_gametype)
Definition: _zm_stats.gsc:389
‪registerRoundWinLimit
‪function registerRoundWinLimit(minValue, maxValue)
Definition: _util.gsc:630
‪gameHistoryPlayerQuit
‪function gameHistoryPlayerQuit()
Definition: _globallogic.gsc:1423
‪onSpawnIntermission
‪function onSpawnIntermission()
Definition: _zm_gametype.gsc:292
‪get_player_spawns_for_gametype
‪function get_player_spawns_for_gametype()
Definition: _zm_gametype.gsc:589
‪custom_spawn_init_func
‪function custom_spawn_init_func()
Definition: _zm_gametype.gsc:906
‪menuSpectator
‪function menuSpectator()
Definition: _globallogic_ui.gsc:526
‪killserverPc
‪function killserverPc()
Definition: _globallogic.gsc:690
‪increment_player_stat
‪function increment_player_stat(stat_name)
Definition: _zm_stats.gsc:369
‪closeMenus
‪function closeMenus()
Definition: _globallogic_ui.gsc:416
‪find_box_center
‪function find_box_center(mins, maxs)
Definition: math_shared.gsc:86
‪menu_onMenuResponse
‪function menu_onMenuResponse()
Definition: _zm_gametype.gsc:683
‪getFreeSpawnpoint
‪function getFreeSpawnpoint(spawnpoints, player)
Definition: _zm.gsc:690
‪MENU_WAGER_SIDE_BET
‪#define MENU_WAGER_SIDE_BET
Definition: shared.gsh:471
‪resetTeamScores
‪function resetTeamScores()
Definition: _globallogic_score.gsc:808
‪init
‪function init()
Definition: _zm_gametype.gsc:912
‪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
‪give_start_weapon
‪function give_start_weapon(b_switch_weapon)
Definition: _zm_utility.gsc:4530
‪spawnPlayer
‪function spawnPlayer()
Definition: _globallogic_spawn.gsc:227
‪get_array
‪function get_array(kvp_value, kvp_key="targetname")
Definition: struct.csc:34
‪registerFriendlyFireDelay
‪function registerFriendlyFireDelay(dvarString, defaultValue, minValue, maxValue)
Definition: _globallogic.gsc:3917
‪zombie_spawn_init
‪function zombie_spawn_init(animname_set)
Definition: _zm_spawner.gsc:200
‪menu_onPlayerConnect
‪function menu_onPlayerConnect()
Definition: _zm_gametype.gsc:674
‪freeze_player_controls
‪function freeze_player_controls(b_frozen=true)
Definition: util_shared.gsc:2474
‪player_hotjoin
‪function player_hotjoin()
Definition: _zm_gametype.gsc:1011
‪spawn
‪function spawn(v_origin=(0, 0, 0), v_angles=(0, 0, 0))
Definition: struct.csc:23
‪registerKillstreakDelay
‪function registerKillstreakDelay(dvarString, defaultValue, minValue, maxValue)
Definition: _weapons.gsc:847
‪wait_fade_in
‪function wait_fade_in()
Definition: _zm_gametype.gsc:1049
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪registerGrenadeLauncherDudDvar
‪function registerGrenadeLauncherDudDvar(dvarString, defaultValue, minValue, maxValue)
Definition: _weapons.gsc:813
‪waveSpawnTimer
‪function waveSpawnTimer()
Definition: _globallogic.gsc:1091
‪menu_init
‪function menu_init()
Definition: _zm_gametype.gsc:649
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪registerNumLives
‪function registerNumLives(minValue, maxValue, teamLivesMinValue, teamLivesMaxValue)
Definition: _util.gsc:664
‪registerScoreLimit
‪function registerScoreLimit(minValue, maxValue)
Definition: _util.gsc:638
‪delay
‪function delay(time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.csc:784
‪initialBlack
‪function initialBlack()
Definition: _zm_gametype.gsc:1061
‪set_game_var
‪function set_game_var(gvar, val)
Definition: _zm_utility.gsc:5185
‪MENU_CLASS
‪#define MENU_CLASS
Definition: shared.gsh:460
‪onRoundEndGame
‪function onRoundEndGame(roundWinner)
Definition: _zm_gametype.gsc:629
‪create_map_placed_influencers
‪function create_map_placed_influencers()
Definition: _spawning.gsc:522
‪onPlayerDisconnect
‪function onPlayerDisconnect()
Definition: _zm_gametype.gsc:274
‪onStartGameType
‪function onStartGameType()
Definition: _zm_gametype.gsc:331
‪set_gamemode_var_once
‪function set_gamemode_var_once(gvar, val)
Definition: _zm_utility.gsc:5172
‪MENU_CHANGE_CLASS_CUSTOM
‪#define MENU_CHANGE_CLASS_CUSTOM
Definition: shared.gsh:474
‪suicide
‪function suicide()
Definition: _vehicle.gsc:1309
‪MENU_LEAVEGAME
‪#define MENU_LEAVEGAME
Definition: shared.gsh:465
‪MENU_CHANGE_CLASS_BAREBONES
‪#define MENU_CHANGE_CLASS_BAREBONES
Definition: shared.gsh:475
‪MENU_TEAM
‪#define MENU_TEAM
Definition: shared.gsh:458
‪pers_upgrade_jugg_player_death_stat
‪function pers_upgrade_jugg_player_death_stat()
Definition: _zm_pers_upgrades_functions.gsc:11
‪getTimePassed
‪function getTimePassed()
Definition: _globallogic_utils.gsc:274
‪canPlayerSuicide
‪function canPlayerSuicide()
Definition: _zm_gametype.gsc:267
‪onPlayerConnect
‪function onPlayerConnect()
Definition: _zm_gametype.gsc:921
‪menuAlliesZombies
‪function menuAlliesZombies()
Definition: _zm_gametype.gsc:861
‪menuAutoAssign
‪function menuAutoAssign(comingFromMenu)
Definition: _globallogic_ui.gsc:176
‪MENU_START_MENU
‪#define MENU_START_MENU
Definition: shared.gsh:459
‪GlobalLogic_SetupDefault_ZombieCallbacks
‪function GlobalLogic_SetupDefault_ZombieCallbacks()
Definition: _zm_gametype.gsc:189
‪do_game_mode_shellshock
‪function do_game_mode_shellshock()
Definition: _zm_gametype.gsc:257
‪main
‪function main()
Definition: _zm_gametype.gsc:65
‪freeze_players
‪function freeze_players(freeze)
Definition: _zm_game_module.gsc:122
‪set_gamemode_var
‪function set_gamemode_var(gvar, val)
Definition: _zm_utility.gsc:5162
‪onDeadEvent
‪function onDeadEvent(team)
Definition: _zm_gametype.gsc:287
‪expand_mins
‪function expand_mins(mins, point)
Definition: math_shared.gsc:94
‪givePlayerScore
‪function givePlayerScore(event, player, victim, descValue, weapon)
Definition: _globallogic_score.gsc:431
‪MENU_RESTART_GAME
‪#define MENU_RESTART_GAME
Definition: shared.gsh:467
‪onSpawnPlayerUnified
‪function onSpawnPlayerUnified()
Definition: _zm_gametype.gsc:400
‪player_revive_monitor
‪function player_revive_monitor()
Definition: _zm.gsc:2395
‪getPersStat
‪function getPersStat(dataName)
Definition: _globallogic_score.gsc:1018
‪registerThrownGrenadeDudDvar
‪function registerThrownGrenadeDudDvar(dvarString, defaultValue, minValue, maxValue)
Definition: _weapons.gsc:830
‪menuClass
‪function menuClass(response, forcedClass)
Definition: _globallogic_ui.gsc:563
‪registerRoundLimit
‪function registerRoundLimit(minValue, maxValue)
Definition: _util.gsc:622
‪menuTeam
‪function menuTeam(team)
Definition: _globallogic_ui.gsc:473
‪set_game_var_once
‪function set_game_var_once(gvar, val)
Definition: _zm_utility.gsc:5190
‪onPlayerSpawned
‪function onPlayerSpawned()
Definition: _zm_gametype.gsc:934
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪_setTeamScore
‪function _setTeamScore(team, teamScore)
Definition: _globallogic_score.gsc:795
‪player_is_in_laststand
‪function player_is_in_laststand()
Definition: laststand_shared.gsc:18
‪exists
‪function exists(str_flag)
Definition: flag_shared.csc:43
‪auto_revive
‪function auto_revive(reviver, dont_enable_weapons)
Definition: _zm_laststand.gsc:1327
‪spawnSpectator
‪function spawnSpectator(origin, angles)
Definition: _globallogic_spawn.gsc:532
‪default_getTimeLimit
‪function default_getTimeLimit()
Definition: _globallogic_defaults.gsc:332
‪onSpawnSpectator
‪function onSpawnSpectator(origin, angles)
Definition: _zm_gametype.gsc:311
‪checkForAllDead
‪function checkForAllDead(excluded_player)
Definition: _zm.gsc:1773
‪updateObjectiveText
‪function updateObjectiveText()
Definition: _globallogic_ui.gsc:397
‪updatePlayerNum
‪function updatePlayerNum(player)
Definition: _zm.gsc:673
‪initialBlackEnd
‪function initialBlackEnd()
Definition: _zm_gametype.gsc:1067
‪on_connect
‪function on_connect()
Definition: _arena.gsc:20
‪onPlayerConnect_check_for_hotjoin
‪function onPlayerConnect_check_for_hotjoin()
Definition: _zm_gametype.gsc:1000
‪spawnIntermission
‪function spawnIntermission(useDefaultCallback, endGame)
Definition: _globallogic_spawn.gsc:703
‪spawnClient
‪function spawnClient(timeAlreadyPassed)
Definition: _globallogic_spawn.gsc:832
‪add_spawn_function
‪function add_spawn_function(spawn_func, param1, param2, param3, param4, param5)
Definition: spawner_shared.gsc:3252
‪registerTimeLimit
‪function registerTimeLimit(minValue, maxValue)
Definition: _util.gsc:655
‪MENU_OPTIONS
‪#define MENU_OPTIONS
Definition: shared.gsh:464
‪onFindValidSpawnPoint
‪function onFindValidSpawnPoint()
Definition: _zm_gametype.gsc:434
‪check_for_valid_spawn_near_team
‪function check_for_valid_spawn_near_team(revivee, return_struct)
Definition: _zm.gsc:3361
‪maySpawn
‪function maySpawn()
Definition: _zm_gametype.gsc:317
‪MENU_INIT_TEAM_ALLIES
‪#define MENU_INIT_TEAM_ALLIES
Definition: shared.gsh:469
‪spawnPlayerPrediction
‪function spawnPlayerPrediction()
Definition: _globallogic_spawn.gsc:162
‪teamOutcomeNotifyZombie
‪function teamOutcomeNotifyZombie(winner, isRound, endReasonText)
Definition: _hud_message.gsc:329
‪onSpawnPlayer
‪function onSpawnPlayer(predictedSpawn)
Definition: _zm_gametype.gsc:493
‪MENU_CONTROLS
‪#define MENU_CONTROLS
Definition: shared.gsh:463
‪onEndGame
‪function onEndGame(winningTeam)
Definition: _zm_gametype.gsc:624
‪rebuild_barrier_reward_reset
‪function rebuild_barrier_reward_reset()
Definition: _zm_blockers.gsc:2361