Better Grabber impact effects
[voretournament/voretournament.git] / data / qcsrc / server / w_grabber.qc
index 92a1223..dbf470f 100644 (file)
@@ -46,6 +46,7 @@ void W_Grabber_Attack2()
        if (trace_fraction < 1)\r
        {\r
                Damage(trace_ent, self, self, cvar("g_balance_grabber_secondary_damage"), WEP_GRABBER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_grabber_secondary_force") * w_shotdir);\r
+               pointparticles(particleeffectnum("grabber_impact2"), trace_endpos, '0 0 0', 1);\r
                W_Grabber_UpdateStats(self, FALSE, TRUE); // the shot is recorded above\r
        }\r
 \r
@@ -62,7 +63,7 @@ void spawnfunc_weapon_grabber (void)
 \r
 float w_grabber(float req)\r
 {\r
-       if(self.predator.classname == "player") // we can't use weapons while in the stomach\r
+       if(self.stat_eaten) // we can't use weapons while in the stomach\r
        {\r
                self.grabber_state |= GRABBER_REMOVING;\r
                return FALSE;\r
@@ -85,9 +86,9 @@ float w_grabber(float req)
                        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 not(self.clip_load < 0) // we're currently reloading\r
+               else if not(self.clip_load < 0) // we're not currently reloading\r
                {\r
-                       if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_JETPACK))\r
+                       if (self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO1))\r
                        {\r
                                if(time < self.weapon_delay)\r
                                        return FALSE;\r
@@ -105,12 +106,13 @@ float w_grabber(float req)
                                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_grabber_primary_animtime"), w_ready);                               \r
                                }\r
                        }\r
-                       if (self.BUTTON_ATCK2)\r
+                       if (self.BUTTON_ATCK2 && weapon_action(self.weapon, WR_CHECKAMMO2))\r
                        {\r
                                if (weapon_prepareattack(1, cvar("g_balance_grabber_secondary_refire")))\r
                                {\r
                                        W_Grabber_Attack2();\r
                                        weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_grabber_secondary_animtime"), w_ready);\r
+                                       sound (self, CHAN_WEAPON2, "weapons/grabber_swing.wav", VOL_BASE, ATTN_NORM);\r
                                }\r
                        }\r
                }\r
@@ -140,7 +142,13 @@ float w_grabber(float req)
                                {\r
                                        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)\r
                                        {\r
-                                               if ( self.ammo_fuel >= (time - self.grabber_time_fueldecrease) * grabbered_fuel )\r
+                                               float active_ammo;\r
+                                               if(cvar("g_balance_grabber_reload_ammo"))\r
+                                                       active_ammo = self.clip_load;\r
+                                               else\r
+                                                       active_ammo = self.ammo_fuel;\r
+\r
+                                               if (active_ammo >= (time - self.grabber_time_fueldecrease) * grabbered_fuel )\r
                                                {\r
                                                        W_DecreaseAmmo(ammo_fuel, (time - self.grabber_time_fueldecrease) * grabbered_fuel, cvar("g_balance_grabber_reload_ammo"));\r
                                                        self.grabber_time_fueldecrease = time;\r
@@ -164,7 +172,7 @@ float w_grabber(float req)
                if (self.BUTTON_CROUCH)\r
                {\r
                        self.grabber_state &~= GRABBER_PULLING;\r
-                       if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_JETPACK))\r
+                       if (self.BUTTON_ATCK)\r
                                self.grabber_state &~= GRABBER_RELEASING;\r
                        else\r
                                self.grabber_state |= GRABBER_RELEASING;\r
@@ -174,7 +182,7 @@ float w_grabber(float req)
                        self.grabber_state |= GRABBER_PULLING;\r
                        self.grabber_state &~= GRABBER_RELEASING;\r
 \r
-                       if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_JETPACK))\r
+                       if (self.BUTTON_ATCK)\r
                        {\r
                                // already fired\r
                                if(self.grabber)\r
@@ -191,10 +199,11 @@ float w_grabber(float req)
        {\r
                precache_model ("models/weapons/g_grabber.md3");\r
                precache_model ("models/weapons/v_grabber.md3");\r
-               precache_model ("models/weapons/h_grabber.dpm");\r
+               precache_model ("models/weapons/h_grabber.iqm");\r
                precache_sound ("weapons/grabber_impact.wav"); // done by g_grabber.qc\r
                precache_sound ("weapons/grabber_fire.wav");\r
                precache_sound ("weapons/grabber_altfire.wav");\r
+               precache_sound ("weapons/grabber_swing.wav");\r
                precache_sound ("weapons/reload.wav");\r
        }\r
        else if (req == WR_SETUP)\r