]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh
Merge branch 'master' into pending-release
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / tmayhem / tmayhem.qh
diff --git a/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh b/qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh
new file mode 100644 (file)
index 0000000..6e37f66
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <common/gamemodes/gamemode/deathmatch/deathmatch.qh>
+#include <common/gamemodes/gamemode/tdm/tdm.qh>
+#include <common/mapinfo.qh>
+
+CLASS(tmayhem, Gametype)
+       INIT(tmayhem)
+       {
+               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!"));
+       }
+       METHOD(tmayhem, m_parse_mapinfo, bool(string k, string v))
+       {
+               if (!k) {
+                       cvar_set("g_tmayhem_teams", cvar_defstring("g_tmayhem_teams"));
+                       return true;
+               }
+               switch (k) {
+                       case "teams":
+                       cvar_set("g_tmayhem_teams", v);
+                       return true;
+               }
+               return false;
+       }
+       METHOD(tmayhem, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
+       {
+               return true;
+       }
+       METHOD(tmayhem, m_isForcedSupported, bool(Gametype this))
+       {
+               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)){
+                       return true;
+               }
+               if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.m_flags)){
+                       return true;
+               }
+               return false;
+       }
+       METHOD(tmayhem, m_setTeams, void(string sa))
+       {
+               cvar_set("g_tmayhem_teams", sa);
+       }
+       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))
+       {
+               TC(Gametype, this);
+               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"));
+       }
+       ATTRIB(tmayhem, m_legacydefaults, string, "1500 20 2 0");
+ENDCLASS(tmayhem)
+REGISTER_GAMETYPE(TEAM_MAYHEM, NEW(tmayhem));
+#define g_tmayhem IS_GAMETYPE(TEAM_MAYHEM)