]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move more g_ca checks into mutator hooks
authorMario <mario.mario@y7mail.com>
Sat, 15 Jun 2013 05:44:33 +0000 (15:44 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 15 Jun 2013 05:44:33 +0000 (15:44 +1000)
qcsrc/server/cl_player.qc
qcsrc/server/mutators/gamemode_arena.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc

index 5eb8247c2aa7bb8ebe42877717015deb39be1760..fbe6d7aea9dbda56745613bc34d0944d39c1cdad 100644 (file)
@@ -485,9 +485,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
        self.dmg_inflictor = inflictor;
 
-       if(g_ca && self != attacker && IS_PLAYER(attacker))
-               PlayerTeamScore_Add(attacker, SP_SCORE, ST_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
-
        float abot, vbot, awep;
        abot = (IS_BOT_CLIENT(attacker));
        vbot = (IS_BOT_CLIENT(self));
index 46b8faccc182bc60f5c8b997df036e77c0535196..bb6312ea1f7593f414977604b763e5c58e00543c 100644 (file)
@@ -237,6 +237,15 @@ MUTATOR_HOOKFUNCTION(arena_SV_StartFrame)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(arena_FilterItem)
+{
+       if(autocvar_g_powerups <= 0)
+       if(self.flags & FL_POWERUP)
+               return TRUE;
+               
+       return FALSE;
+}
+
 void arena_Initialize()
 {
        maxspawned = max(2, autocvar_g_arena_maxspawned);
@@ -260,6 +269,7 @@ MUTATOR_DEFINITION(gamemode_arena)
        MUTATOR_HOOK(GiveFragsForKill, arena_GiveFragsForKill, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDies, arena_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(SV_StartFrame, arena_SV_StartFrame, CBC_ORDER_ANY);
+       MUTATOR_HOOK(FilterItem, arena_FilterItem, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 1f43bdde8b5a9d6f99edfac9f6517bac0fac6550..7c49045650b3479f170f67f9b16d7c126f351ddc 100644 (file)
@@ -242,7 +242,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage)
 {
        if(IS_PLAYER(frag_target))
        if(frag_target.deadflag == DEAD_NO)
-       if(frag_target == frag_attacker || !IsDifferentTeam(frag_target, frag_attacker))
+       if(frag_target == frag_attacker || !IsDifferentTeam(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL)
                frag_damage = 0;
                
        frag_mirrordamage = 0;
@@ -250,6 +250,28 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(ca_FilterItem)
+{
+       if(autocvar_g_powerups <= 0)
+       if(self.flags & FL_POWERUP)
+               return TRUE;
+               
+       if(autocvar_g_pickup_items <= 0)
+               return TRUE;
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor)
+{
+       float excess = max(0, frag_damage - damage_take - damage_save);
+       
+       if(frag_target != frag_attacker && IS_PLAYER(frag_attacker))
+               PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
+               
+       return FALSE;
+}
+
 // scoreboard setup
 void ca_ScoreRules()
 {
@@ -293,6 +315,8 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST);
        MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDamage_Calculate, ca_PlayerDamage, CBC_ORDER_ANY);
+       MUTATOR_HOOK(FilterItem, ca_FilterItem, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, ca_PlayerDamage_SplitHealthArmor, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index e22cba6bbf773ac645c04ac2e793f994d9e081af..424b124f561fd9433b82c66ac9b5ade70696d52d 100644 (file)
@@ -93,7 +93,7 @@ void CreatureFrame (void)
                {
                        // check for falling damage
                        float velocity_len = vlen(self.velocity);
-                       if(!self.hook.state && !g_ca && !(g_cts && !autocvar_g_cts_selfdamage))
+                       if(!self.hook.state && !(g_cts && !autocvar_g_cts_selfdamage))
                        {
                                dm = vlen(self.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
                                if (self.deadflag)
index 926a4ab9df36a6faeec3214cab01510f72d7f274..a895600728c459e8f31888fe163d300b362a4b8c 100644 (file)
@@ -277,10 +277,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_powerups == 0)
                        return FALSE;
-               if(g_ca)
-                       return FALSE;
-               if(g_arena)
-                       return FALSE;
        }
        else
        {
@@ -288,8 +284,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_pickup_items == 0)
                        return FALSE;
-               if(g_ca)
-                       return FALSE;
                if(g_weaponarena)
                        if(!WEPSET_EMPTY_E(self) || (self.items & IT_AMMO))
                                return FALSE;