‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_friendicons.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\system_shared;
5 
6 #insert scripts\shared\shared.gsh;
7 
8 #namespace friendicons;
9 
10 ‪REGISTER_SYSTEM( "friendicons", &‪__init__, undefined )
11 
12 function ‪__init__()
13 {
15 }
16 
17 function ‪init()
18 {
19  if ( !level.teamBased )
20  {
21  return;
22  }
23 
24  // Draws a team icon over teammates
25  if(GetDvarString( "scr_drawfriend") == "")
26  {
27  SetDvar("scr_drawfriend", "0");
28  }
29  level.drawfriend = GetDvarint( "scr_drawfriend");
30 
31  assert( isdefined(game["headicon_allies"]), "Allied head icons are not defined. Check the team set for the level.");
32  assert( isdefined(game["headicon_axis"]), "Axis head icons are not defined. Check the team set for the level.");
33 
36 
37  for(;;)
38  {
40  wait 5;
41  }
42 }
43 
45 {
46  self endon("disconnect");
47 
48  self.headicon = "";
49 }
50 
52 {
53  self endon("disconnect");
54 
55  self thread ‪showFriendIcon();
56 }
57 
59 {
60  if(level.drawfriend)
61  {
62  team = self.pers["team"];
63  self.headicon = game["headicon_" + team];
64  self.headiconteam = team;
65  }
66 }
67 
69 {
70  drawfriend = GetDvarfloat( "scr_drawfriend");
71  if(level.drawfriend != drawfriend)
72  {
73  level.drawfriend = drawfriend;
74 
76  }
77 }
78 
80 {
81  // for all living players, show the appropriate headicon
82  players = level.players;
83  for(i = 0; i < players.size; i++)
84  {
85  player = players[i];
86 
87  if(isdefined(player.pers["team"]) && player.pers["team"] != "spectator" && player.sessionstate == "playing")
88  {
89  if(level.drawfriend)
90  {
91  team = self.pers["team"];
92  self.headicon = game["headicon_" + team];
93  self.headiconteam = team;
94  }
95  else
96  {
97  players = level.players;
98  for(i = 0; i < players.size; i++)
99  {
100  player = players[i];
101 
102  if(isdefined(player.pers["team"]) && player.pers["team"] != "spectator" && player.sessionstate == "playing")
103  player.headicon = "";
104  }
105  }
106  }
107  }
108 }
‪on_start_gametype
‪function on_start_gametype(func, obj)
Definition: callbacks_shared.csc:285
‪on_player_spawned
‪function on_player_spawned()
Definition: _friendicons.gsc:51
‪updateFriendIcons
‪function updateFriendIcons()
Definition: _friendicons.gsc:79
‪init
‪function init()
Definition: _friendicons.gsc:17
‪on_spawned
‪function on_spawned(func, obj)
Definition: callbacks_shared.csc:245
‪updateFriendIconSettings
‪function updateFriendIconSettings()
Definition: _friendicons.gsc:68
‪on_player_killed
‪function on_player_killed()
Definition: _friendicons.gsc:44
‪__init__
‪function __init__()
Definition: _friendicons.gsc:12
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪showFriendIcon
‪function showFriendIcon()
Definition: _friendicons.gsc:58