From: drjaska Date: Tue, 20 Apr 2021 20:12:10 +0000 (+0300) Subject: unhardcoded no selfdamage and no friendly damage X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=749ca4dcdca046d2e6b6948f0b9ad7a36ad17506;p=xonotic%2Fxonotic-data.pk3dir.git unhardcoded no selfdamage and no friendly damage --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index b2a99f49a..8f4303f2b 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -582,6 +582,7 @@ 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_mayhem_selfdamage 0 "0 = disable selfdamage in mayhem, 1 = enable selfdamage in mayhem" 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)" @@ -592,3 +593,4 @@ set g_tmayhem_point_leadlimit -1 "Team Mayhem point lead limit overriding the ma 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" set g_tmayhem_regenerate 0 "allow players to regenerate hp. rates controlled by hp regeneration and rotting cvars" +set g_tmayhem_selfdamage 0 "0 = disable selfdamage in tmayhem, 1 = enable selfdamage in tmayhem" diff --git a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc index 98bee5316..76939a32e 100644 --- a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc @@ -3,6 +3,7 @@ bool autocvar_g_mayhem_regenerate; string autocvar_g_mayhem_weaponarena; bool autocvar_g_mayhem_powerups; +bool autocvar_g_mayhem_selfdamage; MUTATOR_HOOKFUNCTION(mayhem, Scores_CountFragsRemaining) { @@ -67,7 +68,7 @@ MUTATOR_HOOKFUNCTION(mayhem, Damage_Calculate) float frag_deathtype = M_ARGV(3, float); float frag_damage = M_ARGV(4, float); - if (frag_target == frag_attacker || frag_deathtype == DEATH_FALL.m_id) + if ((autocvar_g_mayhem_selfdamage == 0 && frag_target == frag_attacker) || frag_deathtype == DEATH_FALL.m_id) frag_damage = 0; M_ARGV(4, float) = frag_damage; diff --git a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc index 285e39902..dd5c6b81e 100644 --- a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc @@ -7,6 +7,7 @@ int autocvar_g_tmayhem_teams_override; bool autocvar_g_tmayhem_regenerate; string autocvar_g_tmayhem_weaponarena; bool autocvar_g_tmayhem_powerups; +bool autocvar_g_tmayhem_selfdamage; // code from here on is just to support maps that don't have team entities void tmayhem_SpawnTeam (string teamname, int teamcolor) @@ -122,7 +123,7 @@ MUTATOR_HOOKFUNCTION(tmayhem, Damage_Calculate) if (IS_PLAYER(frag_target)) if (!IS_DEAD(frag_target)) - if (frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL.m_id) + if ((autocvar_g_tmayhem_selfdamage == 0 && frag_target == frag_attacker) || frag_deathtype == DEATH_FALL.m_id) frag_damage = 0; frag_mirrordamage = 0;