SERVER: Add supper for triggerstate; decrement game_counter when triggerstate is OFF

This commit is contained in:
MotoLegacy 2024-12-29 12:27:47 -05:00
parent 2cc0ca7ed3
commit b5ecd5dafd
3 changed files with 20 additions and 2 deletions

View file

@ -43,7 +43,15 @@
float cheats_have_been_activated;
// Quake assumes these are defined.
// cypress - NOTE
// on/off are inverted compared to goldsrc for
// compatibility with existing nzp content.
#define TRIGGERSTATE_ON 0
#define TRIGGERSTATE_OFF 1
#define TRIGGERSTATE_TOGGLE 2
.float triggerstate;
string string_null;
.string killtarget;
entity activator;

View file

@ -384,7 +384,10 @@ void() place_model =
#define SPAWNFLAG_COUNTER_RESETONFIRE 2
void() game_counter_increment =
{
self.frags++;
if (global_triggerstate == TRIGGERSTATE_OFF)
self.frags--;
else
self.frags++;
if (self.frags == self.health) {
SUB_UseTargets();

View file

@ -54,6 +54,8 @@ void() DelayThink =
remove(self);
};
float global_triggerstate;
void() SUB_UseTargets =
{
local entity t, stemp, otemp, act;
@ -146,6 +148,7 @@ void() SUB_UseTargets =
t.enemy = activator;
t.message = self.message;
t.killtarget = self.killtarget;
t.triggerstate = self.triggerstate;
t.target = self.target;
t.target2 = self.target2;
t.target3 = self.target3;
@ -189,8 +192,12 @@ void() SUB_UseTargets =
t.classname = "spawn_dog";
if (self.use != SUB_Null)
{
global_triggerstate = self.triggerstate;
if (self.use)
self.use();
global_triggerstate = -1;
}
self = stemp;
other = otemp;