]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanup/quick improvement to auto_helpme_when_damaged
authorSamual <samual@xonotic.org>
Thu, 12 Apr 2012 16:25:06 +0000 (12:25 -0400)
committerSamual <samual@xonotic.org>
Thu, 12 Apr 2012 16:25:06 +0000 (12:25 -0400)
defaultXonotic.cfg
qcsrc/server/mutators/gamemode_ctf.qc

index 7d76d7de27d44afa51cd60ae1e5f8c0b1d0d51cc..6b58fd5477641311b3f6fe72902ea21ae1582404 100644 (file)
@@ -595,7 +595,7 @@ set g_ctf_flag_return_time 15
 set g_ctf_flag_return_dropped 100
 set g_ctf_flag_return_damage 0
 set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
-set g_ctf_flagcarrier_auto_helpme_when_damaged 1
+set g_ctf_flagcarrier_auto_helpme_when_damaged 50
 set g_ctf_flagcarrier_allow_vehicle_carry 1 
 set g_ctf_flagcarrier_selfdamagefactor 1
 set g_ctf_flagcarrier_selfforcefactor 1
index b05e8da3c8368ff90506dfbfbbd281a080b6229e..b82e26345063eb9d9369a9b5bbb33bd7a807fde0 100644 (file)
@@ -336,7 +336,7 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype)
        WaypointSprite_Kill(player.wps_flagcarrier);
        
        if(player.wps_enemyflagcarrier)
-                       WaypointSprite_Kill(player.wps_enemyflagcarrier);
+               WaypointSprite_Kill(player.wps_enemyflagcarrier);
        
        // captureshield
        ctf_CaptureShield_Update(player, 0); // shield player from picking up flag
@@ -967,13 +967,22 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
        // scan through all the flags and notify the client about them 
        for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
        {
-               if(flag.ctf_status == FLAG_CARRY)
-                       if(flag.owner == self)
-                               self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_CARRYING : IT_BLUE_FLAG_CARRYING); // carrying: self is currently carrying the flag
-                       else 
-                               self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_TAKEN : IT_BLUE_FLAG_TAKEN); // taken: someone on self's team is carrying the flag
-               else if(flag.ctf_status == FLAG_DROPPED) 
-                       self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_LOST : IT_BLUE_FLAG_LOST); // lost: the flag is dropped somewhere on the map
+               switch(flag.ctf_status)
+               {
+                       case FLAG_CARRY:
+                       {
+                               if(flag.owner == self)
+                                       self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_CARRYING : IT_BLUE_FLAG_CARRYING); // carrying: self is currently carrying the flag
+                               else 
+                                       self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_TAKEN : IT_BLUE_FLAG_TAKEN); // taken: someone on self's team is carrying the flag
+                               break;
+                       }
+                       case FLAG_DROPPED:
+                       {
+                               self.items |= ((flag.items & IT_KEY2) ? IT_RED_FLAG_LOST : IT_BLUE_FLAG_LOST); // lost: the flag is dropped somewhere on the map
+                               break;
+                       }
+               }
        }
        
        // item for stopping players from capturing the flag too often
@@ -1002,10 +1011,10 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t
                        frag_force *= autocvar_g_ctf_flagcarrier_forcefactor;
                }
        }
-       else if(frag_target.flagcarried) // if the target is a flagcarrier
+       else if(frag_target.flagcarried && (frag_target.deadflag == DEAD_NO) && IsDifferentTeam(frag_target, frag_attacker)) // if the target is a flagcarrier
        {
-               if(autocvar_g_ctf_flagcarrier_auto_helpme_when_damaged)
-                       WaypointSprite_HelpMePing(self.wps_flagcarrier); // TODO: only do this if there is a significant loss of health?
+               if(autocvar_g_ctf_flagcarrier_auto_helpme_when_damaged > frag_target.health)
+                       WaypointSprite_HelpMePing(frag_target.wps_flagcarrier); // TODO: only do this if there is a significant loss of health?
        }
        return 0;
 }