]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/race/race.qh
Merge branch 'terencehill/noclip_death_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / race / race.qh
1 #pragma once
2
3 #include <common/mapinfo.qh>
4
5 #ifdef CSQC
6 void HUD_Mod_Race(vector pos, vector mySize);
7 #endif
8 CLASS(Race, Gametype)
9     INIT(Race)
10     {
11         this.gametype_init(this, _("Race"),"rc","g_race",GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line"));
12     }
13     METHOD(Race, m_parse_mapinfo, bool(string k, string v))
14     {
15         if (!k) {
16             cvar_set("g_race_qualifying_timelimit", cvar_defstring("g_race_qualifying_timelimit"));
17             return true;
18         }
19         switch (k) {
20             case "qualifying_timelimit":
21                 cvar_set("g_race_qualifying_timelimit", v);
22                 return true;
23         }
24         return false;
25     }
26     METHOD(Race, m_generate_mapinfo, void(Gametype this, string v))
27     {
28         if(v == "trigger_race_checkpoint")
29             MapInfo_Map_supportedGametypes |= this.m_flags;
30     }
31     METHOD(Race, m_isTwoBaseMode, bool())
32     {
33         return true;
34     }
35     METHOD(Race, 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))
36     {
37         TC(Gametype, this);
38         returns(menu, _("Laps:"),            1,   25,  1, "g_race_laps_limit",         string_null,                    string_null);
39     }
40 #ifdef CSQC
41     ATTRIB(Race, m_modicons, void(vector pos, vector mySize), HUD_Mod_Race);
42 #endif
43     ATTRIB(Race, m_legacydefaults, string, "20 5 7 15 0");
44 ENDCLASS(Race)
45 REGISTER_GAMETYPE(RACE, NEW(Race));
46 #define g_race IS_GAMETYPE(RACE)