]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/w_grabber.qc
Merge branch 'master' into mirceakitsune/weapon_display
[voretournament/voretournament.git] / data / qcsrc / server / w_grabber.qc
index cbd202b66a864f8dae6107a3a4050975d4cdd14b..98c4a38506a552b1be4955d050eeb775a8ea2b90 100644 (file)
@@ -36,7 +36,8 @@ void W_Grabber_Attack2()
        if(time < self.weapon_delay)\r
                return;\r
 \r
-       W_SetupShot (self, TRUE, 0, "weapons/grabber_altfire.wav", cvar("g_balance_grabber_secondary_damage"));\r
+       W_SetupShot (self, TRUE, cvar("g_balance_grabber_secondary_recoil"), "weapons/grabber_altfire.wav", cvar("g_balance_grabber_secondary_damage"));\r
+       pointparticles(particleeffectnum("grabber_muzzleflash"), w_shotorg, '0 0 0', 1);\r
        W_Grabber_UpdateStats(self, TRUE, FALSE); // the hit is recorded below\r
 \r
        WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));\r
@@ -48,14 +49,17 @@ void W_Grabber_Attack2()
                if(trace_ent.classname == "player")\r
                        sound (self, CHAN_PROJECTILE, "weapons/grabber_impact2_player.wav", VOL_BASE, ATTN_NORM);\r
                else\r
+               {\r
                        sound (self, CHAN_PROJECTILE, "weapons/grabber_impact2_world.wav", VOL_BASE, ATTN_NORM);\r
+                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
+                               pointparticles(particleeffectnum("ground_metal"), trace_endpos, '0 0 0', 1);\r
+                       else\r
+                               pointparticles(particleeffectnum("ground_dirt"), trace_endpos, '0 0 0', 1);\r
+               }\r
 \r
                W_Grabber_UpdateStats(self, FALSE, TRUE); // the shot is recorded above\r
        }\r
 \r
-       if (!g_norecoil)\r
-               self.punchangle_x -= cvar("g_balance_grabber_secondary_recoil");\r
-\r
        W_DecreaseAmmo(ammo_fuel, cvar("g_balance_grabber_secondary_ammo"), cvar("g_balance_grabber_reload_ammo"));\r
 }\r
 \r
@@ -81,7 +85,7 @@ float w_grabber(float req)
                // determine by distance if this will be primary fire or alternate fire\r
                W_SetupShot (self, TRUE, 0, "", 0); // do this to update w_shotorg\r
                WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));\r
-               if(trace_fraction < 1 && !self.grabber) // not if hooked or firing the hook\r
+               if(cvar("g_balance_grabber_secondary") && trace_fraction < 1 && !self.grabber) // not if hooked or firing the hook\r
                        self.stat_crosshair_style = 1;\r
                else\r
                        self.stat_crosshair_style = 0;\r
@@ -89,14 +93,14 @@ float w_grabber(float req)
                grabbered_fuel = cvar("g_balance_grabber_primary_grabbered_fuel");\r
                // forced reload\r
                if(cvar("g_balance_grabber_reload_ammo") && self.clip_load < min(cvar("g_balance_grabber_primary_ammo"), cvar("g_balance_grabber_secondary_ammo"))\r
-               && self.clip_load >= 0 && !(self.clip_load >= (time - self.grabber_time_fueldecrease) * grabbered_fuel && self.BUTTON_ATCK)) // not while hooked and still have ammo to stay hooked\r
+               && !(self.clip_load >= (time - self.grabber_time_fueldecrease) * grabbered_fuel && self.BUTTON_ATCK2)) // not while hooked and still have ammo to stay hooked\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.clip_load >= 0 && !self.stat_eaten) // we're not currently reloading or eaten\r
                {\r
-                       if(!self.stat_crosshair_style && self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO1)) // primary attack\r
+                       if(!self.stat_crosshair_style && self.BUTTON_ATCK2 && weapon_action(self.weapon, WR_CHECKAMMO1)) // primary attack\r
                        {\r
                                if(time < self.weapon_delay)\r
                                        return FALSE;\r
@@ -107,14 +111,13 @@ float w_grabber(float req)
                                if (time > self.grabber_refire)\r
                                if (weapon_prepareattack(0, -1))\r
                                {\r
-                                       if (!g_norecoil)\r
-                                               self.punchangle_x -= cvar("g_balance_grabber_primary_recoil");\r
+                                       W_SetupShot (self, TRUE, cvar("g_balance_grabber_primary_recoil"), "", 0); // do this for recoil\r
                                        W_DecreaseAmmo(ammo_fuel, cvar("g_balance_grabber_primary_ammo"), cvar("g_balance_grabber_reload_ammo"));\r
                                        self.grabber_state |= GRABBER_FIRING;\r
                                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_grabber_primary_animtime"), w_ready);                               \r
                                }\r
                        }\r
-                       else if (self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO2)) // secondary attack\r
+                       else if (self.BUTTON_ATCK2 && weapon_action(self.weapon, WR_CHECKAMMO2)) // secondary attack\r
                        {\r
                                if (weapon_prepareattack(1, cvar("g_balance_grabber_secondary_refire")))\r
                                {\r
@@ -180,7 +183,7 @@ float w_grabber(float req)
                self.grabber_state |= GRABBER_PULLING;\r
                self.grabber_state &~= GRABBER_RELEASING;\r
 \r
-               if (self.BUTTON_ATCK)\r
+               if (self.BUTTON_ATCK2)\r
                {\r
                        // already fired\r
                        if(self.grabber)\r
@@ -211,6 +214,7 @@ float w_grabber(float req)
                weapon_setup(WEP_GRABBER);\r
                self.grabber_state &~= GRABBER_WAITING_FOR_RELEASE;\r
                self.current_ammo = ammo_fuel;\r
+               W_DisplaySetup(self, 2, 1, 3, 0.75);\r
        }\r
        else if (req == WR_CHECKAMMO1)\r
        {\r