Skip to content

Commit

Permalink
SERVER: Add trigger_awardpoints trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
MotoLegacy committed Jan 30, 2024
1 parent 7e9490f commit 1205b94
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions source/server/entities/triggers.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down

0 comments on commit 1205b94

Please sign in to comment.