]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/keyhunt/keyhunt.qh
Merge branch 'master' into terencehill/less_entities
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / keyhunt / keyhunt.qh
1 #pragma once
2
3 #include <common/mapinfo.qh>
4
5 #ifdef CSQC
6 void HUD_Mod_KH(vector pos, vector mySize);
7 #endif
8 CLASS(KeyHunt, Gametype)
9     INIT(KeyHunt)
10     {
11         this.gametype_init(this, _("Key Hunt"),"kh","g_keyhunt",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round"));
12     }
13     METHOD(KeyHunt, m_parse_mapinfo, bool(string k, string v))
14     {
15         if (!k) {
16             cvar_set("g_keyhunt_teams", cvar_defstring("g_keyhunt_teams"));
17             return true;
18         }
19         switch (k) {
20             case "teams":
21                 cvar_set("g_keyhunt_teams", v);
22                 return true;
23         }
24         return false;
25     }
26     METHOD(KeyHunt, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
27     {
28         if(spawnpoints >= 12 && diameter > 5120)
29             return true;
30         return false;
31     }
32     METHOD(KeyHunt, m_setTeams, void(string sa))
33     {
34         cvar_set("g_keyhunt_teams", sa);
35     }
36     METHOD(KeyHunt, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
37     {
38         TC(Gametype, this);
39         returns(menu, _("Point limit:"),   200, 1500, 50, "g_keyhunt_point_limit",     "g_keyhunt_teams_override",     _("The amount of points needed before the match will end"));
40     }
41 #ifdef CSQC
42     ATTRIB(KeyHunt, m_modicons, void(vector pos, vector mySize), HUD_Mod_KH);
43 #endif
44     ATTRIB(KeyHunt, m_legacydefaults, string, "1000 20 3 0");
45 ENDCLASS(KeyHunt)
46 REGISTER_GAMETYPE(KEYHUNT, NEW(KeyHunt));