]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add an off-switch for selfdamage2score for scoringmethod 1
authordrjaska <drjaska83@gmail.com>
Sat, 4 Dec 2021 06:32:17 +0000 (08:32 +0200)
committerdrjaska <drjaska83@gmail.com>
Sat, 4 Dec 2021 06:32:17 +0000 (08:32 +0200)
bones feature request

gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc

index e00eae6ff53ed537b1cabdcb6ccfbc836608c470..6f6ddd782e2eec5ecf64930747ca129666a374cb 100644 (file)
@@ -586,10 +586,12 @@ set g_tmayhem 0 "Team Mayhem: Compete with your team for the most damage dealt a
 
 set g_mayhem_scoringmethod 1 "1: By default 25% of the score is based on kills and 75% of it is based on damage. 2: 100% frags. 3: 100% damage."
 set g_tmayhem_scoringmethod 1 "1: By default 25% of the score is based on kills and 75% of it is based on damage. 2: 100% frags. 3: 100% damage."
-set g_mayhem_scoringmethod_damage_weight 0.75 "for the first scoring method how much is damage equal to player's spawning health worth in score"
-set g_tmayhem_scoringmethod_damage_weight 0.75 "for the first scoring method how much is damage equal to player's spawning health worth in score"
-set g_mayhem_scoringmethod_frag_weight 0.25 "for the first scoring method how much is a frag worth in score"
-set g_tmayhem_scoringmethod_frag_weight 0.25 "for the first scoring method how much is a frag worth in score"
+set g_mayhem_scoringmethod_1_damage_weight 0.75 "for the first scoring method how much is damage equal to player's spawning health worth in score"
+set g_tmayhem_scoringmethod_1_damage_weight 0.75 "for the first scoring method how much is damage equal to player's spawning health worth in score"
+set g_mayhem_scoringmethod_1_disable_selfdamage2score 0 "disable reducing score with self damage at the cost of full penalty for suicides regardless of how much health was lost suiciding"
+set g_tmayhem_scoringmethod_1_disable_selfdamage2score 0 "disable reducing score with self damage at the cost of full penalty for suicides regardless of how much health was lost suiciding"
+set g_mayhem_scoringmethod_1_frag_weight 0.25 "for the first scoring method how much is a frag worth in score"
+set g_tmayhem_scoringmethod_1_frag_weight 0.25 "for the first scoring method how much is a frag worth in score"
 
 set g_mayhem_fraglimit 30 "Team Mayhem basis for how many frags until the match ends, edit this over point_limit preferably"
 set g_tmayhem_fraglimit 50 "Team Mayhem basis for how many frags until the match ends, edit this over point_limit preferably"
index 1e2d801eda4fae22d5e9ce1737448f677a1f4fe5..57c5293b971d0570a80d09510e5785e3de2cf7ab 100644 (file)
@@ -9,8 +9,9 @@ string autocvar_g_mayhem_weaponarena;
 bool autocvar_g_mayhem_powerups;
 bool autocvar_g_mayhem_selfdamage;
 int autocvar_g_mayhem_scoringmethod;
-float autocvar_g_mayhem_scoringmethod_damage_weight;
-float autocvar_g_mayhem_scoringmethod_frag_weight;
+float autocvar_g_mayhem_scoringmethod_1_damage_weight;
+float autocvar_g_mayhem_scoringmethod_1_frag_weight;
+bool autocvar_g_mayhem_scoringmethod_1_disable_selfdamage2score;
 bool autocvar_g_mayhem_pickup_items;
 bool autocvar_g_mayhem_pickup_items_remove_weapons_and_ammo;
 bool autocvar_g_mayhem_unlimited_ammo;
@@ -186,18 +187,18 @@ MUTATOR_HOOKFUNCTION(mayhem, PlayerDamage_SplitHealthArmor)
 
                        //non-friendly fire
                        if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
-                               GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_mayhem_scoringmethod_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                               GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_mayhem_scoringmethod_1_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
                        
                        //friendly fire aka self damage
-                       if (frag_target == frag_attacker && IS_PLAYER(frag_attacker))
-                               GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                       if (frag_target == frag_attacker && IS_PLAYER(frag_attacker) && !autocvar_g_mayhem_scoringmethod_1_disable_selfdamage2score)
+                               GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_1_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
                
                        //handle (environmental hazard) suiciding, check first if player has a registered attacker who most likely pushed them there to avoid punishing pushed players as pushers are already rewarded
                        //deathtypes:
                        //kill = suicide, drown = drown in water/liquid, hurttrigger = out of the map void or hurt triggers inside maps like electric sparks
                        //camp = campcheck, lava = lava, slime = slime
                        //team change / rebalance suicides are currently not included
-                       if (!IS_PLAYER(frag_attacker) && (
+                       if (!autocvar_g_mayhem_scoringmethod_1_disable_selfdamage2score && !IS_PLAYER(frag_attacker) && (
                                frag_deathtype == DEATH_KILL.m_id ||
                                frag_deathtype == DEATH_DROWN.m_id ||
                                frag_deathtype == DEATH_HURTTRIGGER.m_id ||
@@ -205,7 +206,7 @@ MUTATOR_HOOKFUNCTION(mayhem, PlayerDamage_SplitHealthArmor)
                                frag_deathtype == DEATH_LAVA.m_id ||
                                frag_deathtype == DEATH_SLIME.m_id ||
                                frag_deathtype == DEATH_SWAMP.m_id))
-                                       GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                                       GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_1_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
                        return;
                }
        }
@@ -238,7 +239,13 @@ MUTATOR_HOOKFUNCTION(mayhem, GiveFragsForKill, CBC_ORDER_FIRST)
                        default:
                        case 1:
                        {
-                               M_ARGV(2, float) = -autocvar_g_mayhem_scoringmethod_frag_weight * mayhempointmultiplier * 1.0001;
+                               //when selfdamage2score is disabled don't enable cheap discounted suicides at the cost of the possibility of 
+                               //punishing for a full life when they only deal a single point worth of self damage to kill themselves
+                               if(autocvar_g_mayhem_scoringmethod_1_disable_selfdamage2score && frag_target==frag_attacker){
+                                       M_ARGV(2, float) = -1 * mayhempointmultiplier * 1.0001;
+                               } else {
+                                       M_ARGV(2, float) = -autocvar_g_mayhem_scoringmethod_1_frag_weight * mayhempointmultiplier * 1.0001;
+                               }
                                return true;
                        }
                }
@@ -264,7 +271,7 @@ MUTATOR_HOOKFUNCTION(mayhem, GiveFragsForKill, CBC_ORDER_FIRST)
                        default:
                        case 1:
                        {
-                               M_ARGV(2, float) = autocvar_g_mayhem_scoringmethod_frag_weight * mayhempointmultiplier * 1.0001;
+                               M_ARGV(2, float) = autocvar_g_mayhem_scoringmethod_1_frag_weight * mayhempointmultiplier * 1.0001;
                                return true;
                        }
                }
index 198bc587cc7a2c261d13df38cf6bc3093fb299b9..41b3ae63345dd509570b529ca91e5ac4be8329ad 100644 (file)
@@ -15,8 +15,9 @@ string autocvar_g_tmayhem_weaponarena;
 bool autocvar_g_tmayhem_powerups;
 bool autocvar_g_tmayhem_selfdamage;
 int autocvar_g_tmayhem_scoringmethod;
-float autocvar_g_tmayhem_scoringmethod_damage_weight;
-float autocvar_g_tmayhem_scoringmethod_frag_weight;
+float autocvar_g_tmayhem_scoringmethod_1_damage_weight;
+float autocvar_g_tmayhem_scoringmethod_1_frag_weight;
+bool autocvar_g_tmayhem_scoringmethod_1_disable_selfdamage2score;
 bool autocvar_g_tmayhem_pickup_items;
 bool autocvar_g_tmayhem_pickup_items_remove_weapons_and_ammo;
 bool autocvar_g_tmayhem_unlimited_ammo;
@@ -235,25 +236,25 @@ MUTATOR_HOOKFUNCTION(tmayhem, PlayerDamage_SplitHealthArmor)
 
                        //non-friendly fire
                        if (IS_PLAYER(frag_attacker) && !SAME_TEAM(frag_target, frag_attacker))
-                               GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_tmayhem_scoringmethod_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                               GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_tmayhem_scoringmethod_1_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
                        
                        //friendly fire or self damage
-                       if (frag_target == frag_attacker && IS_PLAYER(frag_attacker) || SAME_TEAM(frag_target, frag_attacker))
-                               GameRules_scoring_add_team(frag_attacker, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_tmayhem_scoringmethod_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                       if ((SAME_TEAM(frag_target, frag_attacker) && frag_target != frag_attacker) || (frag_target == frag_attacker && IS_PLAYER(frag_attacker) && !autocvar_g_tmayhem_scoringmethod_1_disable_selfdamage2score))
+                               GameRules_scoring_add_team(frag_attacker, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_tmayhem_scoringmethod_1_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
                
                        //handle (environmental hazard) suiciding, check first if player has a registered attacker who most likely pushed them there to avoid punishing pushed players as pushers are already rewarded
                        //deathtypes:
                        //kill = suicide, drown = drown in water/liquid, hurttrigger = out of the map void or hurt triggers inside maps like electric sparks
                        //camp = campcheck, lava = lava, slime = slime
                        //team change / rebalance suicides are currently not included
-                       if (!IS_PLAYER(frag_attacker) && (
+                       if (!autocvar_g_tmayhem_scoringmethod_1_disable_selfdamage2score && !IS_PLAYER(frag_attacker) && (
                                frag_deathtype == DEATH_KILL.m_id ||
                                frag_deathtype == DEATH_DROWN.m_id ||
                                frag_deathtype == DEATH_HURTTRIGGER.m_id ||
                                frag_deathtype == DEATH_CAMP.m_id ||
                                frag_deathtype == DEATH_LAVA.m_id ||
                                frag_deathtype == DEATH_SLIME.m_id))
-                                       GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_tmayhem_scoringmethod_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+                                       GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_tmayhem_scoringmethod_1_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
                        return;
                }
        }
@@ -286,7 +287,13 @@ MUTATOR_HOOKFUNCTION(tmayhem, GiveFragsForKill, CBC_ORDER_FIRST)
                        default:
                        case 1:
                        {
-                               M_ARGV(2, float) = -autocvar_g_tmayhem_scoringmethod_frag_weight * tmayhempointmultiplier * 1.0001;
+                               //when selfdamage2score is disabled don't enable cheap discounted suicides at the cost of the possibility of 
+                               //punishing for a full life when they only deal a single point worth of self damage to kill themselves
+                               if(autocvar_g_tmayhem_scoringmethod_1_disable_selfdamage2score && frag_target==frag_attacker){
+                                       M_ARGV(2, float) = -1 * tmayhempointmultiplier * 1.0001;
+                               } else {
+                                       M_ARGV(2, float) = -autocvar_g_tmayhem_scoringmethod_1_frag_weight * tmayhempointmultiplier * 1.0001;
+                               }
                                return true;
                        }
                }
@@ -312,7 +319,7 @@ MUTATOR_HOOKFUNCTION(tmayhem, GiveFragsForKill, CBC_ORDER_FIRST)
                        default:
                        case 1:
                        {
-                               M_ARGV(2, float) = autocvar_g_tmayhem_scoringmethod_frag_weight * tmayhempointmultiplier * 1.0001;
+                               M_ARGV(2, float) = autocvar_g_tmayhem_scoringmethod_1_frag_weight * tmayhempointmultiplier * 1.0001;
                                return true;
                        }
                }