]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Mostly updating stuff changed during my vacation.
authordrjaska <drjaska83@gmail.com>
Sun, 29 Aug 2021 04:13:53 +0000 (07:13 +0300)
committerdrjaska <drjaska83@gmail.com>
Sun, 29 Aug 2021 04:13:53 +0000 (07:13 +0300)
qcsrc/common/gamemodes/gamemode/mayhem/mayhem.qh
qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc
qcsrc/common/gamemodes/gamemode/tmayhem/tmayhem.qh

index bf5568b84edbeff8402a97e00a908bb6773a43aa..2fee8530576e5c8898aa6e922b9f9f35c2b4a069 100644 (file)
@@ -7,7 +7,7 @@
 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))
     {
index 70bd1dcf8476a71f378a51d3bdf6875a7219ad4a..36f1159fd94a234b9296b077c5ab5a0d9270b94f 100644 (file)
@@ -63,12 +63,12 @@ MUTATOR_HOOKFUNCTION(mayhem, FilterItem)
 {
        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;
                        } 
@@ -114,26 +114,25 @@ MUTATOR_HOOKFUNCTION(mayhem, PlayerDamage_SplitHealthArmor)
                        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
@@ -149,27 +148,28 @@ MUTATOR_HOOKFUNCTION(mayhem, PlayerDamage_SplitHealthArmor)
 
                        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;
                }
        }
 }
index acb10404e90fb35040ebb6cc17e18fc242c762aa..26c3f30ef62cb7e1153353eef3219b70fa28cd4e 100644 (file)
@@ -1,6 +1,6 @@
 #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;
 
@@ -105,12 +105,12 @@ MUTATOR_HOOKFUNCTION(tmayhem, FilterItem)
 {
        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;
                        } 
@@ -161,26 +161,27 @@ MUTATOR_HOOKFUNCTION(tmayhem, PlayerDamage_SplitHealthArmor)
 
                        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;
                }
                
@@ -197,31 +198,33 @@ MUTATOR_HOOKFUNCTION(tmayhem, PlayerDamage_SplitHealthArmor)
 
                        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)
index 290881c9c921d509adbaa83a5aa401d417489cf0..2fe524aff5d3828d77e66f4bec2ca59ce1e143e6 100644 (file)
@@ -7,7 +7,7 @@
 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))
     {