]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
unhardcoded no selfdamage and no friendly damage
authordrjaska <drjaska83@gmail.com>
Tue, 20 Apr 2021 20:12:10 +0000 (23:12 +0300)
committerdrjaska <drjaska83@gmail.com>
Tue, 20 Apr 2021 20:12:10 +0000 (23:12 +0300)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc

index b2a99f49aad3a746f0070ffa6ee4dcf4bd676e5d..8f4303f2b3449f370ff985a996b6070f2c402ed3 100644 (file)
@@ -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"
index 98bee53160e83279394d0d7312fa66c09fe81492..76939a32e9f7ea61e32baf687620f11582380727 100644 (file)
@@ -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;
index 285e399020bf6e9cd0c5f36e0d16f23f721ea711..dd5c6b81e9b03dd68e0b6dc8e2ca9f5dc2079f81 100644 (file)
@@ -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;