]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove kaballcarried, andfix ballcarried so it can be used in keepaway as well
authorunknown <samual@xonotic.org>
Sun, 21 Nov 2010 21:07:49 +0000 (16:07 -0500)
committerunknown <samual@xonotic.org>
Sun, 21 Nov 2010 21:07:49 +0000 (16:07 -0500)
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/clientcommands.qc
qcsrc/server/defs.qh
qcsrc/server/mutators/gamemode_keepaway.qc

index 87d567f29acbcf101e3ebfa9614ce14fdd1f3c65..61c65fdaa8deb79583187ac12592408f82166d79 100644 (file)
@@ -606,7 +606,7 @@ void PutObserverInServer (void)
        if(self.flagcarried)
                DropFlag(self.flagcarried, world, world);
 
-       if(self.ballcarried)
+       if(self.ballcarried && g_nexball)
                DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity);
 
        WaypointSprite_PlayerDead();
@@ -1748,7 +1748,7 @@ void ClientDisconnect (void)
 
        if(self.flagcarried)
                DropFlag(self.flagcarried, world, world);
-       if(self.ballcarried)
+       if(self.ballcarried && g_nexball)
                DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity);
 
        // Here, everything has been done that requires this player to be a client.
index a2943a76053e61e6e873e951594bfa7bd1898feb..8f5b95e3b8e7e29f4801e29428385194d272ee0d 100644 (file)
@@ -620,7 +620,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        else
                                DropFlag(self.flagcarried, world, attacker);
                }
-               if(self.ballcarried)
+               if(self.ballcarried && g_nexball)
                        DropBall(self.ballcarried, self.origin, self.velocity);
                Portal_ClearAllLater(self);
                // clear waypoints
index 0cbe3017eae1ef889844324e8649a1c6cf036d8b..3ef630dd4a88eaa83e77512de9283f95b859f15e 100644 (file)
@@ -213,7 +213,7 @@ void SV_ParseClientCommand(string s) {
                if(self.classname == "player" && cvar("sv_spectate") == 1) {
                        if(self.flagcarried)
                                DropFlag(self.flagcarried, world, world);
-                       if(self.ballcarried)
+                       if(self.ballcarried && g_nexball)
                                DropBall(self.ballcarried, self.origin, self.velocity);
                        WaypointSprite_PlayerDead();
                        self.classname = "observer";
index e8b9c55120aa8b5206b617aef040286c52ba2306..c556e83dbbfc5d9d892c006c2ae875df86b81f44 100644 (file)
@@ -554,15 +554,11 @@ void target_voicescript_clear(entity pl);
 .string target4;
 .float trigger_reverse;
 
-// Nexball
-.entity ballcarried;
+// Nexball 
+.entity ballcarried; // Also used for keepaway
 .float metertime;
 float g_nexball_meter_period;
 
-// Keepaway
-
-.entity kaballcarried;
-
 void SUB_DontUseTargets();
 void SUB_UseTargets();
 
index e8ec55b1e3612a234a973d8318166a376f2f9fec..242e80902c518bbcce11f7a28d44040c575f52b3 100644 (file)
@@ -84,7 +84,7 @@ void ka_TouchEvent()
        if(self.wait > time) { return; }
 
        self.owner = other;
-       other.kaballcarried = self;
+       other.ballcarried = self;
        setattachment(self, other, "");
        setorigin(self, BALL_ATTACHORG);
        
@@ -118,7 +118,7 @@ void ka_TouchEvent()
 void ka_DropEvent(entity plyr) 
 {
        entity ball;
-       ball = plyr.kaballcarried;
+       ball = plyr.ballcarried;
 
        if(!ball) { return; }
        
@@ -135,7 +135,7 @@ void ka_DropEvent(entity plyr)
        ball.alpha = 1.0;
        setorigin(ball, plyr.origin + '0 0 10');
        ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
-       ball.owner.kaballcarried = world;
+       ball.owner.ballcarried = world;
        ball.owner = world;
        
        bprint(plyr.netname, "^7 has dropped the ball!\n");
@@ -154,7 +154,7 @@ void ka_DropEvent(entity plyr)
 
 MUTATOR_HOOKFUNCTION(ka_RemovePlayer)
 {
-       if(self.kaballcarried) { ka_DropEvent(self); }
+       if(self.ballcarried) { ka_DropEvent(self); }
        return 1;
 }
 
@@ -162,20 +162,20 @@ MUTATOR_HOOKFUNCTION(ka_Scoring)
 {
        if((frag_attacker != frag_target) && (frag_attacker.classname == "player"))
        {
-               if(frag_target.kaballcarried) { // get amount of times killing carrier
+               if(frag_target.ballcarried) { // get amount of times killing carrier
                        PlayerScore_Add(frag_attacker, SP_KEEPAWAY_CARRIERKILLS, 1);
                        if(cvar("g_keepaway_bckillscore"))
                                PlayerScore_Add(frag_attacker, SP_KEEPAWAY_SCORE, 1);
                }
-               else if(!frag_attacker.kaballcarried)
+               else if(!frag_attacker.ballcarried)
                        if(cvar("g_keepaway_noncarrier_warn"))
                                centerprint_atprio(frag_attacker, (CENTERPRIO_SPAM + 5), "Killing people while you don't have the ball gives no points!");
 
-               if(frag_attacker.kaballcarried) // get kills as carrier
+               if(frag_attacker.ballcarried) // get kills as carrier
                        PlayerScore_Add(frag_attacker, SP_KEEPAWAY_SCORE, 1);
        }
 
-       if(self.kaballcarried) { ka_DropEvent(self); }
+       if(self.ballcarried) { ka_DropEvent(self); }
        return 1;
 }
 
@@ -189,7 +189,7 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPreThink)
 {
        self.items &~= IT_KEY1;
 
-       if(self.kaballcarried) {
+       if(self.ballcarried) {
                self.items |= IT_KEY1; 
        }
        return 1;