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_mayhem_frags2score 1 "enable frags counting towards score"
+set g_mayhem_damage2score 0 "enable damage counting towards score"
+set g_mayhem_damage2score_multiplier 0.0025 "how much score is given for damage dealt. 0.01 -> 1k dmg = 10 score, 0.001 1k dmg = 1 score, 0.0025 400 dmg = 1 score"
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)"
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"
+set g_tmayhem_frags2score 1 "enable frags counting towards score"
+set g_tmayhem_damage2score 0 "enable damage counting towards score"
+set g_tmayhem_damage2score_multiplier 0.0025 "how much score is given for damage dealt. 0.01 -> 1k dmg = 10 score, 0.001 1k dmg = 1 score, 0.0025 400 dmg = 1 score"
string autocvar_g_mayhem_weaponarena;
bool autocvar_g_mayhem_powerups;
bool autocvar_g_mayhem_selfdamage;
+bool autocvar_g_mayhem_frags2score;
+bool autocvar_g_mayhem_damage2score;
+float autocvar_g_mayhem_damage2score_multiplier;
MUTATOR_HOOKFUNCTION(mayhem, Scores_CountFragsRemaining)
{
frag_damage = 0;
M_ARGV(4, float) = frag_damage;
-}
\ No newline at end of file
+}
+
+MUTATOR_HOOKFUNCTION(mayhem, PlayerDamage_SplitHealthArmor)
+{
+ if(autocvar_g_mayhem_damage2score){
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(7, float);
+ float damage_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
+ float damage_save = bound(0, M_ARGV(5, float), GetResource(frag_target, RES_ARMOR));
+
+ float excess = max(0, frag_damage - damage_take - damage_save);
+
+ if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_mayhem_damage2score_multiplier);
+ }
+}
+
+MUTATOR_HOOKFUNCTION(mayhem, GiveFragsForKill, CBC_ORDER_FIRST)
+{
+ if(!autocvar_g_mayhem_frags2score){
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+}
string autocvar_g_tmayhem_weaponarena;
bool autocvar_g_tmayhem_powerups;
bool autocvar_g_tmayhem_selfdamage;
+bool autocvar_g_tmayhem_frags2score;
+bool autocvar_g_tmayhem_damage2score;
+float autocvar_g_tmayhem_damage2score_multiplier;
// code from here on is just to support maps that don't have team entities
void tmayhem_SpawnTeam (string teamname, int teamcolor)
M_ARGV(4, float) = frag_damage;
M_ARGV(5, float) = frag_mirrordamage;
-}
\ No newline at end of file
+}
+
+MUTATOR_HOOKFUNCTION(tmayhem, PlayerDamage_SplitHealthArmor)
+{
+ if(autocvar_g_tmayhem_damage2score){
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(7, float);
+ float damage_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
+ float damage_save = bound(0, M_ARGV(5, float), GetResource(frag_target, RES_ARMOR));
+
+ float excess = max(0, frag_damage - damage_take - damage_save);
+
+ if (frag_target != frag_attacker && IS_PLAYER(frag_attacker) && DIFF_TEAM(frag_target, frag_attacker))
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_tmayhem_damage2score_multiplier);
+ }
+}
+
+MUTATOR_HOOKFUNCTION(tmayhem, GiveFragsForKill, CBC_ORDER_FIRST)
+{
+ if(!autocvar_g_tmayhem_frags2score){
+ M_ARGV(2, float) = 0;
+ return true;
+ }
+}
BADCVAR("g_tmayhem_point_limit");
BADCVAR("leadlimit_and_fraglimit");
BADCVAR("leadlimit_override");
+ BADCVAR("g_mayhem_frags2score");
+ BADCVAR("g_mayhem_damage2score");
+ BADCVAR("g_mayhem_damage2score_multiplier");
+ BADCVAR("g_tmayhem_frags2score");
+ BADCVAR("g_tmayhem_damage2score");
+ BADCVAR("g_tmayhem_damage2score_multiplier");
BADCVAR("pausable");
BADCVAR("sv_announcer");
BADCVAR("sv_checkforpacketsduringsleep");