]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/duel/duel.qh
Merge branch 'master' into develop
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / duel / duel.qh
1 #pragma once
2
3 #include <common/gamemodes/gamemode/deathmatch/deathmatch.qh>
4 #include <common/mapinfo.qh>
5
6 CLASS(Duel, Gametype)
7     INIT(Duel)
8     {
9         this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_1V1,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner"));
10     }
11     METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
12     {
13         return (diameter < 16384);
14     }
15     METHOD(Duel, m_isForcedSupported, bool(Gametype this))
16     {
17         if(!cvar("g_duel_not_dm_maps"))
18         {
19             // if this is set, all DM maps support duel too
20             // TODO: we should really check the size of maps, some DM maps do not work for duel!
21             if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
22                 return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
23         }
24         return false;
25     }
26 ENDCLASS(Duel)
27 REGISTER_GAMETYPE(DUEL, NEW(Duel));
28 #define g_duel IS_GAMETYPE(DUEL)