]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/teamplay.qc
Merge branch 'master' into terencehill/infinite_ammo
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / teamplay.qc
1 float TeamByColor(float color)
2 {
3         switch(color)
4         {
5         case COLOR_TEAM1: return 0;
6         case COLOR_TEAM2: return 1;
7         case COLOR_TEAM3: return 2;
8         case COLOR_TEAM4: return 3;
9         default: return 0;
10         }
11 }
12 float ColorByTeam(float i)
13 {
14         switch(i)
15         {
16         case 0: return COLOR_TEAM1;
17         case 1: return COLOR_TEAM2;
18         case 2: return COLOR_TEAM3;
19         case 3: return COLOR_TEAM4;
20         default: return COLOR_TEAM1;
21         }
22 }
23
24 float GetPlayerColorForce(float i)
25 {
26         if(!teamplay)
27                 return 0;
28         else
29                 return stof(getplayerkey(i, "colors")) & 15;
30 }
31
32 float GetPlayerColor(float i)
33 {
34         if not(playerslots[i].gotscores) // unconnected
35                 return COLOR_SPECTATOR;
36         else if(stof(getplayerkey(i, "frags")) == FRAGS_SPECTATOR)
37                 return COLOR_SPECTATOR;
38         else
39                 return GetPlayerColorForce(i);
40 }
41
42 string GetPlayerName(float i)
43 {
44         return ColorTranslateRGB(getplayerkey(i, "name"));
45 }
46
47 vector GetTeamRGB(float color)
48 {
49         switch(color)
50         {
51         default: return '1 1 1';
52         case COLOR_TEAM1: return '1 0 0'; // red
53         case COLOR_TEAM2: return '0 0 1'; // blue
54         case COLOR_TEAM3: return '1 1 0'; // yellow
55         case COLOR_TEAM4: return '1 0 1'; // pink
56         }
57 }
58
59 string GetTeamName(float color)
60 {
61         switch(color)
62         {
63         default: return _("Spectators");
64         case COLOR_TEAM1: return _("Red Team");
65         case COLOR_TEAM2: return _("Blue Team");
66         case COLOR_TEAM3: return _("Yellow Team");
67         case COLOR_TEAM4: return _("Pink Team");
68         }
69 }