From e757682d88cbbc69e091ba8d5877f7c0c2b0b403 Mon Sep 17 00:00:00 2001 From: cypress Date: Thu, 14 Sep 2023 15:23:22 -0400 Subject: [PATCH] SERVER: Add a use delay to the Mystery Box --- source/server/entities/mystery_box.qc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/server/entities/mystery_box.qc b/source/server/entities/mystery_box.qc index 6f46db9..f9f5ce3 100644 --- a/source/server/entities/mystery_box.qc +++ b/source/server/entities/mystery_box.qc @@ -55,6 +55,16 @@ void() MBOX_OpenAnimation6 = [6, MBOX_OpenAnimation7 ] { self.frame = 6; MBOX_Up void() MBOX_OpenAnimation7 = [7, MBOX_OpenAnimation8 ] { self.frame = 7; MBOX_UpdateGlowFrame(); }; void() MBOX_OpenAnimation8 = [8, SUB_Null ] { self.frame = 8; MBOX_UpdateGlowFrame(); }; +// +// MBOX_WaitEnd() +// Ends the per-use delay for the Mystery Box. +// +void() MBOX_WaitEnd = +{ + self.boxstatus = 0; + self.think = SUB_Null; +} + // // MBOX_Reset() // Resets the Mystery Box to be ready for @@ -63,7 +73,12 @@ void() MBOX_OpenAnimation8 = [8, SUB_Null ] { self.frame = 8; MBOX_Up inline void() MBOX_Reset = { self.frame = 0; - self.boxstatus = 0; + self.boxstatus = -1; + + // Add a 3 second delay before the Mystery Box + // can be interact with again. + self.think = MBOX_WaitEnd; + self.nextthink = time + 3; }; // @@ -651,7 +666,6 @@ void() MBOX_Touch = if (self.owner == other) { other.reload_delay = 0; - self.boxstatus = 0; self.owner = world; if (other.weapon != self.boxweapon.weapon && other.secondaryweapon != self.boxweapon.weapon && other.secondaryweapon && other.thirdweapon != self.boxweapon.weapon) {