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.
This commit is contained in:
Ian 2022-11-21 21:25:23 -05:00
parent b74c6cd8c8
commit 8257107fea

View file

@ -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;