CLASS(mayhem, Gametype)
INIT(mayhem)
{
- this.gametype_init(this, _("Mayhem"),"mayhem","g_mayhem",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("The player with the most frags in total mayhem wins!"));
+ this.gametype_init(this, _("Mayhem"),"mayhem","g_mayhem",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PREFERRED,"","timelimit=15 pointlimit=30 leadlimit=0",_("The player with the most damage and frags in total mayhem wins!"));
}
METHOD(mayhem, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
{
{
entity item = M_ARGV(0, entity);
if (autocvar_g_powerups == 1){
- if (item.flags & FL_POWERUP){
+ if (item.itemdef.instanceOfPowerup){
return false;
}
}
else if (autocvar_g_powerups == -1){
- if (item.flags & FL_POWERUP){
+ if (item.itemdef.instanceOfPowerup){
if (autocvar_g_mayhem_powerups){
return false;
}
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) * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
if (frag_target == frag_attacker && IS_PLAYER(frag_attacker))
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
- //handle hazard suiciding, check first if player has a registered attacker who most likely pushed them there
+ //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) && (
+ 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)) * (1/(start_health + start_armorvalue)));
-
- //when hp and armor values are checked when suiciding for some reason they are 0.9 hp and 0 armor regardless that player suicided with 200+200
- //AFAIK dynamic hp value checking is not possible, hardcoded start hp and armor
- //FIXME: ^ , might require fixing hp+a check for suicides as a whole
- if (frag_deathtype == DEATH_KILL.m_id)
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (start_health + start_armorvalue)) * (1/(start_health + start_armorvalue)));
- return;
+ frag_deathtype == DEATH_SLIME.m_id ||
+ frag_deathtype == DEATH_SWAMP.m_id))
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (start_health + start_armorvalue)) * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
}
//combined damage and frags
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 * 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)));
- //handle hazard suiciding, check first if player has a registered attacker who most likely pushed them there
+ //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) && (
+ 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))
+ 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)));
-
- //when hp and armor values are checked when suiciding for some reason they are 0.9 hp and 0 armor regardless that player suicided with 200+200
- //AFAIK dynamic hp value checking is not possible, hardcoded start hp and armor
- //FIXME: ^ , might require fixing hp+a check for suicides as a whole
- if (frag_deathtype == DEATH_KILL.m_id)
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (start_health + start_armorvalue)) * 0.75 * mayhempointmultiplier * (1/(start_health + start_armorvalue)));
- return;
}
}
}
#include "sv_tmayhem.qh"
-// TODO? rename to teammayhem? requires checking alias length
+// TODO? rename to teammayhem? requires checking alias and other string lengths
int autocvar_g_tmayhem_teams;
int autocvar_g_tmayhem_teams_override;
{
entity item = M_ARGV(0, entity);
if (autocvar_g_powerups == 1){
- if (item.flags & FL_POWERUP){
+ if (item.itemdef.instanceOfPowerup){
return false;
}
}
else if (autocvar_g_powerups == -1){
- if (item.flags & FL_POWERUP){
+ if (item.itemdef.instanceOfPowerup){
if (autocvar_g_tmayhem_powerups){
return false;
}
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) * (1/(start_health + start_armorvalue)));
-
+ 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))
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * (1/(start_health + start_armorvalue)));
-
- //handle hazard suiciding, check first if player has a registered attacker who most likely pushed them there
+ 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
+ //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) && (
+ 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)) * (1/(start_health + start_armorvalue)));
-
- //when hp and armor values are checked when suiciding for some reason they are 0.9 hp and 0 armor regardless that player suicided with 200+200
- //AFAIK dynamic hp value checking is not possible, hardcoded start hp and armor
- //FIXME: ^ , might require fixing hp+a check for suicides as a whole
- if (frag_deathtype == DEATH_KILL.m_id)
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (start_health + start_armorvalue)) * (1/(start_health + start_armorvalue)));
+ GameRules_scoring_add_team(frag_target, SCORE, (-1 * (frag_damage - excess)) * 0.75 * 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)));
+ //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)));
- //handle hazard suiciding, check first if player has a registered attacker who most likely pushed them there
+ //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) && (
+ 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)) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
-
- //when hp and armor values are checked when suiciding for some reason they are 0.9 hp and 0 armor regardless that player suicided with 200+200
- //AFAIK dynamic hp value checking is not possible, hardcoded start hp and armor
- //FIXME: ^ , might require fixing hp+a check for suicides as a whole
- if (frag_deathtype == DEATH_KILL.m_id)
- GameRules_scoring_add_team(frag_target, SCORE, (-1 * (start_health + start_armorvalue)) * 0.75 * tmayhempointmultiplier * (1/(start_health + start_armorvalue)));
return;
}
}
}
+
MUTATOR_HOOKFUNCTION(tmayhem, GiveFragsForKill, CBC_ORDER_FIRST)
{
switch(autocvar_g_tmayhem_scoringmethod)
CLASS(tmayhem, Gametype)
INIT(tmayhem)
{
- this.gametype_init(this, _("Team Mayhem"),"tmayhem","g_tmayhem",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("The team with the most frags in total mayhem wins!"));
+ this.gametype_init(this, _("Team Mayhem"),"tmayhem","g_tmayhem",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("The team with the most damage and frags in total mayhem wins!"));
}
METHOD(tmayhem, m_parse_mapinfo, bool(string k, string v))
{