]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/survival/cl_survival.qc
285d48ea287cc98309ab9fda33af2d7fa5e36f4a
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / survival / cl_survival.qc
1 #include "cl_survival.qh"
2
3 #include <client/draw.qh>
4 #include <client/hud/panel/modicons.qh>
5
6 void HUD_Mod_Survival(vector pos, vector mySize)
7 {
8         mod_active = 1; // survival should always show the mod HUD
9
10         int mystatus = entcs_receiver(player_localnum).survival_status;
11         string player_text = "";
12         vector player_color = '1 1 1';
13         //string player_icon = "";
14         if(mystatus == SV_STATUS_HUNTER)
15         {
16                 player_text = _("Hunter");
17                 player_color = '1 0 0';
18                 //player_icon = "player_red";
19         }
20         else if(mystatus == SV_STATUS_PREY)
21         {
22                 player_text = _("Survivor");
23                 player_color = '0 1 0';
24                 //player_icon = "player_neutral";
25         }
26         else
27         {
28                 // if the player has no valid status, don't draw anything
29                 return;
30         }
31
32         drawstring_aspect(pos, player_text, vec2(mySize.x, mySize.y), player_color, panel_fg_alpha, DRAWFLAG_NORMAL);
33 }
34
35 REGISTER_MUTATOR(cl_sv, true);
36
37 MUTATOR_HOOKFUNCTION(cl_sv, ForcePlayercolors_Skip, CBC_ORDER_LAST)
38 {
39         if(!ISGAMETYPE(SURVIVAL))
40                 return false;
41
42         entity player = M_ARGV(0, entity);
43         entity e = entcs_receiver(player.entnum - 1);
44         int surv_status = ((e) ? e.survival_status : 0);
45         int mystatus = entcs_receiver(player_localnum).survival_status;
46
47         int plcolor = SV_COLOR_PREY; // default to survivor
48         if((mystatus == SV_STATUS_HUNTER || intermission || STAT(GAME_STOPPED)) && surv_status == SV_STATUS_HUNTER)
49                 plcolor = SV_COLOR_HUNTER;
50
51         player.colormap = 1024 + plcolor;
52         return true;
53 }
54
55 MUTATOR_HOOKFUNCTION(cl_sv, DrawScoreboard_Force)
56 {
57         // show the scoreboard when the round ends, so players can see who the hunter was
58         return STAT(GAME_STOPPED);
59 }