]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh
Mayhem and Team Mayhem gamemodes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / tmayhem / tmayhem.qh
1 #pragma once
2
3 #include <common/gamemodes/gamemode/deathmatch/deathmatch.qh>
4 #include <common/gamemodes/gamemode/tdm/tdm.qh>
5 #include <common/mapinfo.qh>
6
7 CLASS(tmayhem, Gametype)
8         INIT(tmayhem)
9         {
10                 this.gametype_init(this, _("Team Mayhem"),"tmayhem","g_tmayhem",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=1500 teams=2 leadlimit=0",_("Compete with your team for the most damage dealt and frags in this chaotic mayhem!"));
11         }
12         METHOD(tmayhem, m_parse_mapinfo, bool(string k, string v))
13         {
14                 if (!k) {
15                         cvar_set("g_tmayhem_teams", cvar_defstring("g_tmayhem_teams"));
16                         return true;
17                 }
18                 switch (k) {
19                         case "teams":
20                         cvar_set("g_tmayhem_teams", v);
21                         return true;
22                 }
23                 return false;
24         }
25         METHOD(tmayhem, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
26         {
27                 return true;
28         }
29         METHOD(tmayhem, m_isForcedSupported, bool(Gametype this))
30         {
31                 if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)){
32                         return true;
33                 }
34                 if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags)){
35                         return true;
36                 }
37                 return false;
38         }
39         METHOD(tmayhem, m_setTeams, void(string sa))
40         {
41                 cvar_set("g_tmayhem_teams", sa);
42         }
43         METHOD(tmayhem, 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))
44         {
45                 TC(Gametype, this);
46                 returns(menu, _("Point limit:"),     200,  3000,  100, "g_tmayhem_point_limit",         "g_tmayhem_teams_override",         _("How much score is needed before the match will end"));
47         }
48         ATTRIB(tmayhem, m_legacydefaults, string, "1500 20 2 0");
49 ENDCLASS(tmayhem)
50 REGISTER_GAMETYPE(TEAM_MAYHEM, NEW(tmayhem));
51 #define g_tmayhem IS_GAMETYPE(TEAM_MAYHEM)