]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/g_grabber.qc
Many fixes and adaptations to the Accuracy Stats window, and get the Grabber to prope...
[voretournament/voretournament.git] / data / qcsrc / server / g_grabber.qc
index 5202c1cee6bb4085c990f13d260abdd13196981f..1c3361e1f929e5403ed5a8d88dac9d333a7dc526 100644 (file)
@@ -131,6 +131,17 @@ void GrabberThink()
        if(self.aiment)\r
                WarpZone_RefSys_AddIncrementally(self, self.aiment);\r
 \r
+       // prevent the grabber from sticking to a player that has been swallowed\r
+       if(self.aiment.predator.classname == "player")\r
+       {\r
+               // if the grabber is linked to a player that we swallowed, disconnect it (or the grabber will stick to us / the player inside us)\r
+               // otherwise, link the grabber to the player who ate our linked player\r
+               if(self.aiment.predator != self.owner)\r
+                       SetMovetypeFollow(self, self.aiment.predator);\r
+               else\r
+                       RemoveGrabber(self.owner);\r
+       }\r
+\r
        self.nextthink = time;\r
 \r
        makevectors(self.owner.v_angle);\r
@@ -255,6 +266,7 @@ void GrabberTouch (void)
                if(other.movetype != MOVETYPE_NONE)\r
                {\r
                        SetMovetypeFollow(self, other);\r
+                       W_Grabber_UpdateStats(self.owner, FALSE, TRUE); // count this as a hit\r
                        WarpZone_RefSys_BeginAddingIncrementally(self, self.aiment);\r
                }\r
 \r
@@ -283,6 +295,8 @@ void FireGrabber (void)
        local entity missile;\r
        local vector org;\r
 \r
+       W_Grabber_UpdateStats(self, TRUE, FALSE);\r
+\r
        if((arena_roundbased && time < warmup) || (time < game_starttime))\r
                return;\r
 \r
@@ -327,7 +341,7 @@ void FireGrabber (void)
 //  voidGrabberFrame()\r
 //  {\r
 //         // this function has been modified for Voretournament\r
-// -       if (self.BUTTON_GRABBER && g_grabber)\r
+// -       if (self.BUTTON_JETPACK && g_grabber)\r
 //         {\r
 // -               if (!self.grabber && self.grabber_time <= time && !self.button6_pressed_before)\r
 // -                       if (timeoutStatus != 2) //only allow the player to fire the grabber if the game is not paused (timeout)\r
@@ -338,7 +352,7 @@ void FireGrabber (void)
 //                 if (self.grabber)\r
 //                         RemoveGrabber(self);\r
 //         }\r
-// -       self.button6_pressed_before = self.BUTTON_GRABBER;\r
+// -       self.button6_pressed_before = self.BUTTON_JETPACK;\r
 //         /*\r
 //         // if I have no grabber or it's not pulling yet, make sure I'm not flying!\r
 //         if((self.grabber == world || !self.grabber.state) && self.movetype == MOVETYPE_FLY)\r
@@ -348,7 +362,7 @@ void GrabberFrame()
        if(timeoutStatus != 2 && self.weapon != WEP_GRABBER)\r
        {\r
                // offhand grabber controls\r
-               if(self.BUTTON_GRABBER)\r
+               if(self.BUTTON_JETPACK)\r
                {\r
                        if not(self.grabber || (self.grabber_state & GRABBER_WAITING_FOR_RELEASE))\r
                        {\r
@@ -376,10 +390,10 @@ void GrabberFrame()
        }\r
        else if(!(self.items & IT_JETPACK) && self.switchweapon != WEP_GRABBER)\r
        {\r
-               if(self.BUTTON_GRABBER && !self.grabber_switchweapon)\r
+               if(self.BUTTON_JETPACK && !self.grabber_switchweapon)\r
                        W_SwitchWeapon(WEP_GRABBER);\r
        }\r
-       self.grabber_switchweapon = self.BUTTON_GRABBER;\r
+       self.grabber_switchweapon = self.BUTTON_JETPACK;\r
 \r
        if(self.weapon != WEP_GRABBER)\r
        {\r