set g_mayhem 0 "Mayhem: Compete for the most damage dealt and frags in this chaotic mayhem!"
set g_tmayhem 0 "Team Mayhem: Compete with your team for the most damage dealt and frags in this chaotic mayhem!"
-set g_mayhem_scoringmethod 1 "1: 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: 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 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_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"
#include "sv_mayhem.qh"
+float autocvar_g_mayhem_fraglimit;
+float autocvar_g_mayhem_visual_score_limit;
+float mayhempointmultiplier;
+
bool autocvar_g_mayhem_regenerate;
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;
bool autocvar_g_mayhem_pickup_items;
bool autocvar_g_mayhem_pickup_items_remove_weapons_and_ammo;
bool autocvar_g_mayhem_unlimited_ammo;
//non-friendly fire
if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
- GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * 0.75 * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_mayhem_scoringmethod_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)) * 0.75 * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_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:
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)) * 0.75 * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_mayhem_scoringmethod_damage_weight * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
return;
}
}
MUTATOR_HOOKFUNCTION(mayhem, GiveFragsForKill, CBC_ORDER_FIRST)
{
- switch(autocvar_g_mayhem_scoringmethod)
- {
- //frags only
- case 2:
- {
- //fix 999 score from 30 kills for example
- M_ARGV(2, float) = 1 * mayhempointmultiplier * 1.0001;
- return true;
- }
-
- //damage only
- case 3:
+ entity frag_attacker = M_ARGV(0, entity);
+ entity frag_target = M_ARGV(1, entity);
+
+ if(frag_target == frag_attacker){
+ switch(autocvar_g_mayhem_scoringmethod)
{
- M_ARGV(2, float) = 0;
- return true;
+ //frags only
+ case 2:
+ {
+ //fix 999 score from 30 kills for example
+ M_ARGV(2, float) = -1 * mayhempointmultiplier * 1.0001;
+ return true;
+ }
+
+ //damage only
+ case 3:
+ {
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+
+ //combined damage and frags
+ default:
+ case 1:
+ {
+ M_ARGV(2, float) = -autocvar_g_mayhem_scoringmethod_frag_weight * mayhempointmultiplier * 1.0001;
+ return true;
+ }
}
-
- //combined damage and frags
- default:
- case 1:
+ } else {
+ switch(autocvar_g_mayhem_scoringmethod)
{
- M_ARGV(2, float) = 0.25 * mayhempointmultiplier * 1.0001;
- return true;
+ //frags only
+ case 2:
+ {
+ //fix 999 score from 30 kills for example
+ M_ARGV(2, float) = 1 * mayhempointmultiplier * 1.0001;
+ return true;
+ }
+
+ //damage only
+ case 3:
+ {
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+
+ //combined damage and frags
+ default:
+ case 1:
+ {
+ M_ARGV(2, float) = autocvar_g_mayhem_scoringmethod_frag_weight * mayhempointmultiplier * 1.0001;
+ return true;
+ }
}
}
}
#pragma once
#include <common/mutators/base.qh>
-//someone who understands numbers better check if 2 following floats can be ints without imprecision, I'm scared of spaghettimonsters
-float autocvar_g_mayhem_fraglimit;
-float autocvar_g_mayhem_visual_score_limit;
-float mayhempointmultiplier = 1000/30;
+
void mayhem_Initialize();
REGISTER_MUTATOR(mayhem, false)
#include "sv_tmayhem.qh"
+float autocvar_g_tmayhem_fraglimit;
+float autocvar_g_tmayhem_visual_score_limit;
+float autocvar_g_tmayhem_score_leadlimit;
+bool autocvar_g_tmayhem_team_spawns;
+float tmayhempointmultiplier;
+
// TODO? rename to teammayhem? requires checking alias and other string lengths
int autocvar_g_tmayhem_teams;
int autocvar_g_tmayhem_teams_override;
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;
bool autocvar_g_tmayhem_pickup_items;
bool autocvar_g_tmayhem_pickup_items_remove_weapons_and_ammo;
bool autocvar_g_tmayhem_unlimited_ammo;
float excess = max(0, frag_damage - damage_take - damage_save);
//non-friendly fire
- if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
+ if (IS_PLAYER(frag_attacker) && !SAME_TEAM(frag_target, frag_attacker))
GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
//friendly fire or self damage
- if (frag_target == frag_attacker && IS_PLAYER(frag_attacker))
+ if (frag_target == frag_attacker && IS_PLAYER(frag_attacker) || SAME_TEAM(frag_target, frag_attacker))
GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * 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
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)) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
return;
}
float excess = max(0, frag_damage - damage_take - damage_save);
//non-friendly fire
- if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
- GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ 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)));
//friendly fire or self damage
- if (frag_target == frag_attacker && IS_PLAYER(frag_attacker))
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ 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)));
//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:
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)) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * autocvar_g_tmayhem_scoringmethod_damage_weight * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
return;
}
}
MUTATOR_HOOKFUNCTION(tmayhem, GiveFragsForKill, CBC_ORDER_FIRST)
{
- switch(autocvar_g_tmayhem_scoringmethod)
- {
- //frags only
- case 2:
- {
- //fix 999 score from 30 kills for example
- M_ARGV(2, float) = 1 * tmayhempointmultiplier * 1.0001;
- return true;
- }
-
- //damage only
- case 3:
+ entity frag_attacker = M_ARGV(0, entity);
+ entity frag_target = M_ARGV(1, entity);
+
+ if(SAME_TEAM(frag_target, frag_attacker)){
+ switch(autocvar_g_tmayhem_scoringmethod)
{
- M_ARGV(2, float) = 0;
- return true;
+ //frags only
+ case 2:
+ {
+ //fix 999 score from 30 kills for example
+ M_ARGV(2, float) = -1 * tmayhempointmultiplier * 1.0001;
+ return true;
+ }
+
+ //damage only
+ case 3:
+ {
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+
+ //combined damage and frags
+ default:
+ case 1:
+ {
+ M_ARGV(2, float) = -autocvar_g_tmayhem_scoringmethod_frag_weight * tmayhempointmultiplier * 1.0001;
+ return true;
+ }
}
-
- //combined damage and frags
- default:
- case 1:
+ } else {
+ switch(autocvar_g_tmayhem_scoringmethod)
{
- M_ARGV(2, float) = 0.25 * tmayhempointmultiplier * 1.0001;
- return true;
+ //frags only
+ case 2:
+ {
+ //fix 999 score from 30 kills for example
+ M_ARGV(2, float) = 1 * tmayhempointmultiplier * 1.0001;
+ return true;
+ }
+
+ //damage only
+ case 3:
+ {
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+
+ //combined damage and frags
+ default:
+ case 1:
+ {
+ M_ARGV(2, float) = autocvar_g_tmayhem_scoringmethod_frag_weight * tmayhempointmultiplier * 1.0001;
+ return true;
+ }
}
}
}
#pragma once
#include <common/mutators/base.qh>
-//someone who understands numbers better check if 2 following floats can be ints without imprecision, I'm scared of spaghettimonsters
-float autocvar_g_tmayhem_fraglimit;
-float autocvar_g_tmayhem_visual_score_limit;
-float autocvar_g_tmayhem_score_leadlimit;
-bool autocvar_g_tmayhem_team_spawns;
-float tmayhempointmultiplier = 1000/50;
+
void tmayhem_Initialize();
REGISTER_MUTATOR(tmayhem, false)
BADCVAR("leadlimit_and_fraglimit");
BADCVAR("leadlimit_override");
BADCVAR("g_mayhem_scoringmethod");
+ BADCVAR("g_mayhem_scoringmethod_damage_weight");
+ BADCVAR("g_mayhem_scoringmethod_frag_weight");
BADCVAR("g_tmayhem_scoringmethod");
+ BADCVAR("g_tmayhem_scoringmethod_damage_weight");
+ BADCVAR("g_tmayhem_scoringmethod_frag_weight");
BADCVAR("pausable");
BADCVAR("sv_announcer");
BADCVAR("sv_checkforpacketsduringsleep");