From 8257107feae602718d4bc98756d85ab635c5130e Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 21 Nov 2022 21:25:23 -0500 Subject: [PATCH] Server: Call W_SprintStop() before preparing to use equipment Fixes https://github.com/nzp-team/nzportable/issues/58 and also prevents being able to exploit sprinting while holding a grenade. --- source/server/weapons/weapon_core.qc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index 00cea47..d5d38dd 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -1966,6 +1966,11 @@ void() W_Betty = { if (self.throw_delay > time || self.zoom || self.downed || self.secondary_grenades < 1 || self.isBuying) return; + // Prevent the Player from Sprinting and also avoid issues with + // the equipment being completely cancelled.. + if (self.sprinting) + W_SprintStop(); + Set_W_Frame (0, 18, 0, 0, GRENADE, checkHoldB, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT); sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM); self.secondary_grenades -= 1; @@ -1978,6 +1983,11 @@ void() W_Grenade = if (self.throw_delay > time || self.zoom || self.downed || self.primary_grenades < 1 || self.isBuying) return; + // Prevent the Player from Sprinting and also avoid issues with + // the equipment being completely cancelled.. + if (self.sprinting) + W_SprintStop(); + Set_W_Frame (0, 2, 0, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT); sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM); self.primary_grenades -= 1;