From: drjaska Date: Sun, 7 Mar 2021 02:47:35 +0000 (+0200) Subject: Added support for removing powerups only from mayhem. Added a force X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cad89409613f60daa0d8817841ed7ac0f6dae7e6;p=xonotic%2Fxonotic-data.pk3dir.git Added support for removing powerups only from mayhem. Added a force support mapinfo hook which makes maps support mayhem and team mayhem if they support dm. Improved the remove powerup hook logic to consider g_powerups and g_(t)mayhem_powerups variables. Still missing icons. --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 203fab7ec..7acb34975 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -581,6 +581,7 @@ set g_duel_not_dm_maps 0 "when this is set, DM maps will NOT be listed in duel" set g_mayhem 0 "Mayhem: the player with the most frags in total mayhem wins" set g_mayhem_regenerate 0 "allow players to regenerate hp. rates controlled by hp regeneration and rotting cvars" set g_mayhem_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena" +set g_mayhem_powerups 1 "Allow powerups in mayhem. Only checked if g_powerups is -1 therefore this will be overridden by g_powerups 1 or 0" set g_tmayhem 0 "Team Mayhem: the team with the most frags in total mayhem wins" set g_tmayhem_teams 2 "how many teams are in team mayhem (set by mapinfo)" @@ -589,3 +590,4 @@ set g_tmayhem_teams_override 0 "how many teams are in team mayhem" set g_tmayhem_point_limit -1 "Team Mayhem point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)" set g_tmayhem_point_leadlimit -1 "Team Mayhem point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)" set g_tmayhem_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena" +set g_tmayhem_powerups 1 "Allow powerups in team mayhem. Only checked if g_powerups is -1 therefore this will be overridden by g_powerups 1 or 0" diff --git a/qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh b/qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh index eca9883d7..19569ecab 100644 --- a/qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh +++ b/qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh @@ -5,12 +5,19 @@ CLASS(mayhem, Gametype) INIT(mayhem) { - this.gametype_init(this, _("Mayhem"),"mayhem","g_mayhem",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); + this.gametype_init(this, _("Mayhem"),"mayhem","g_mayhem",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("The player with the most frags in total mayhem wins!")); } METHOD(mayhem, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) { return true; } + METHOD(mayhem, m_isForcedSupported, bool(Gametype this)) + { + if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)){ + return true; + } + return false; + } ATTRIB(mayhem, m_legacydefaults, string, "30 20 0"); ENDCLASS(mayhem) REGISTER_GAMETYPE(MAYHEM, NEW(mayhem)); diff --git a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc index bd5e43195..b868b14ac 100644 --- a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc @@ -2,6 +2,7 @@ bool autocvar_g_mayhem_regenerate; string autocvar_g_mayhem_weaponarena; +bool autocvar_g_mayhem_powerups; MUTATOR_HOOKFUNCTION(mayhem, Scores_CountFragsRemaining) { @@ -43,15 +44,20 @@ MUTATOR_HOOKFUNCTION(mayhem, SetWeaponArena) MUTATOR_HOOKFUNCTION(mayhem, FilterItem) { entity item = M_ARGV(0, entity); - - if (autocvar_g_powerups <= 0) - if (item.flags & FL_POWERUP) - return true; - + if (autocvar_g_powerups == 1){ + if (item.flags & FL_POWERUP){ + return false; + } + } + else if (autocvar_g_powerups == -1){ + if (item.flags & FL_POWERUP){ + if (autocvar_g_mayhem_powerups){ + return false; + } + } + } if (autocvar_g_pickup_items <= 0) return true; - else - return false; } MUTATOR_HOOKFUNCTION(mayhem, Damage_Calculate)