]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/w_grabber.qc
Don't endlessly attempt to force reload the grabber if we're out of ammo, since we...
[voretournament/voretournament.git] / data / qcsrc / server / w_grabber.qc
index 09a945f531de3b6a5f6041912d628eb3be151fc4..40786f57edb7cc5e1a36d392aaf30b8eafe06946 100644 (file)
@@ -74,7 +74,12 @@ float w_grabber(float req)
        }\r
        else if (req == WR_THINK)\r
        {\r
-               if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_JETPACK))\r
+               if(cvar("g_balance_grabber_reload_ammo") && self.clip_load < min(cvar("g_balance_grabber_primary_ammo"), cvar("g_balance_grabber_secondary_ammo"))) // forced reload\r
+               {\r
+                       if(self.ammo_fuel >= 1) // we only have one weapon in VT, so nothing else to switch to if we're out of ammo\r
+                               weapon_action(self.weapon, WR_RELOAD);\r
+               }\r
+               else if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_JETPACK))\r
                {\r
                        if(time < self.weapon_delay)\r
                                return FALSE;\r
@@ -90,8 +95,7 @@ float w_grabber(float req)
                                weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_grabber_primary_animtime"), w_ready);                               \r
                        }\r
                }\r
-\r
-               if (self.BUTTON_ATCK2)\r
+               else if (self.BUTTON_ATCK2)\r
                {\r
                        if (weapon_prepareattack(1, cvar("g_balance_grabber_secondary_refire")))\r
                        {\r
@@ -213,7 +217,8 @@ float w_grabber(float req)
        }\r
        else if (req == WR_RELOAD)\r
        {\r
-               W_Reload(min(cvar("g_balance_hagar_primary_ammo"), cvar("g_balance_hagar_secondary_ammo")), cvar("g_balance_hagar_reload_ammo"), cvar("g_balance_hagar_reload_time"), "weapons/reload.wav");\r
+               self.grabber_state |= GRABBER_REMOVING;\r
+               W_Reload(min(cvar("g_balance_grabber_primary_ammo"), cvar("g_balance_grabber_secondary_ammo")), cvar("g_balance_grabber_reload_ammo"), cvar("g_balance_grabber_reload_time"), "weapons/reload.wav");\r
        }\r
        else if (req == WR_SUICIDEMESSAGE)\r
                w_deathtypestring = "did the impossible";\r