SERVER: Add Spawnflag to buy Perk-A-Cola while Prone

This commit is contained in:
MotoLegacy 2024-03-23 10:08:33 -07:00
parent a664fd2264
commit 71bbdd29d1

View file

@ -50,6 +50,8 @@ void(entity person) W_HideCrosshair;
// Double-Tap Damage Boost // Double-Tap Damage Boost
#define PERK_SPAWNFLAG_DOUBLETAPV1 1024 #define PERK_SPAWNFLAG_DOUBLETAPV1 1024
#define PERK_SPAWNFLAG_ALLOWPRONE 2048
#define PERK_JUGGERNOG_HEALTH 160 #define PERK_JUGGERNOG_HEALTH 160
// //
@ -256,8 +258,8 @@ void() touch_perk =
if (other.classname != "player" || other.downed || other.isBuying == true || !PlayerIsLooking(other, self)) if (other.classname != "player" || other.downed || other.isBuying == true || !PlayerIsLooking(other, self))
return; return;
// Do this after the perk change check // Typically not allowed to purchase Perk-A-Colas while prone.
if (other.stance == 0) if (other.stance == PLAYER_STANCE_PRONE && !(self.spawnflags & PERK_SPAWNFLAG_ALLOWPRONE))
return; return;
// Power's off! Nothing to do here. // Power's off! Nothing to do here.
@ -320,6 +322,10 @@ void() touch_perk =
other = self; // Set other to client other = self; // Set other to client
self = tempe; // Set self to machine self = tempe; // Set self to machine
// If the player is Prone, for them to Crouch
if (other.stance == PLAYER_STANCE_PRONE)
Player_SetStance(other, PLAYER_STANCE_CROUCH, true);
// Increment usage count // Increment usage count
self.perk_purchase_count++; self.perk_purchase_count++;