From 1205b94030bec32d495504f2af1714542b71b2e0 Mon Sep 17 00:00:00 2001 From: MotoLegacy Date: Tue, 30 Jan 2024 16:19:21 -0500 Subject: [PATCH] SERVER: Add trigger_awardpoints trigger --- source/server/entities/triggers.qc | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/source/server/entities/triggers.qc b/source/server/entities/triggers.qc index 8e84af3..02327aa 100644 --- a/source/server/entities/triggers.qc +++ b/source/server/entities/triggers.qc @@ -363,6 +363,42 @@ void() trigger_setfire = self.touch = trigger_setfire_touch; } +// +// trigger_awardpoints +// Awards touching client Score on contact. +// +#define SPAWNFLAG_TRIGGERSCORE_REQUIRESTAND 1 +#define SPAWNFLAG_TRIGGERSCORE_REQUIRECROUCH 2 +#define SPAWNFLAG_TRIGGERSCORE_REQUIREPRONE 4 +#define SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS 8 + +void() trigger_awardpoints_touch = +{ + if (other.classname != "player" || other.downed) + return; + + if (other.stance != PLAYER_STANCE_STAND && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIRESTAND)) + return; + if (other.stance != PLAYER_STANCE_CROUCH && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIRECROUCH)) + return; + if (other.stance != PLAYER_STANCE_PRONE && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIREPRONE)) + return; + + addmoney(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS)); + + if (self.aistatus != "") + sound(self, 0, self.aistatus, 1, 1); +} + +void() trigger_awardpoints = +{ + InitTrigger (); + self.touch = trigger_awardpoints_touch; + + if (self.aistatus != "") + precache_sound(self.aistatus); +} + // // Quake Triggers //