]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/survival/cl_survival.qc
Change the shortname of survival from surv to sv to better match other gamemodes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / survival / cl_survival.qc
1 #include "cl_survival.qh"
2
3 #include <client/hud/panel/modicons.qh>
4
5 void HUD_Mod_Survival(vector pos, vector mySize)
6 {
7         mod_active = 1; // survival should always show the mod HUD
8
9         int mystatus = entcs_receiver(player_localnum).survival_status;
10         string player_text = "";
11         vector player_color = '1 1 1';
12         //string player_icon = "";
13         if(mystatus == SV_STATUS_HUNTER)
14         {
15                 player_text = _("Hunter");
16                 player_color = '1 0 0';
17                 //player_icon = "player_red";
18         }
19         else if(mystatus == SV_STATUS_PREY)
20         {
21                 player_text = _("Survivor");
22                 player_color = '0 1 0';
23                 //player_icon = "player_neutral";
24         }
25         else
26         {
27                 // if the player has no valid status, don't draw anything
28                 return;
29         }
30
31         //drawpic_aspect_skin(pos, player_icon, vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
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 }