SERVER: Quick and dirty game_counter implementation, mostly adlib

This commit is contained in:
Steam Deck User 2023-03-25 20:07:25 -04:00
parent 2aad4a471d
commit 6fd6d0dafd
2 changed files with 35 additions and 1 deletions

View file

@ -53,6 +53,7 @@ void(string com) SV_ParseClientCommand;
.float recoil_delay;
.float mapversion;
.float ammo;
.float frags;
#endif // FTE

View file

@ -359,4 +359,37 @@ void() place_model =
// Now just execute the misc_model spawn function.
misc_model();
};
};
//
// game_counter()
// Quick and dirty game_counter implementation, referenced
// from TWHL docs (https://twhl.info/index.php/wiki/page/game_counter)
//
#define SPAWNFLAG_COUNTER_REMOVEONFIRE 1
#define SPAWNFLAG_COUNTER_RESETONFIRE 2
void() game_counter_increment =
{
self.frags++;
if (self.frags == self.health) {
SUB_UseTargets();
if (self.spawnflags & SPAWNFLAG_COUNTER_REMOVEONFIRE) {
remove(self);
} else if (self.spawnflags & SPAWNFLAG_COUNTER_RESETONFIRE) {
self.frags = self.cost;
}
}
}
void() game_counter =
{
// TODO: master checking..
// Store the initial value in case RESET ON FIRE is set.
self.cost = self.frags;
// Every time its triggered, increment.
self.use = game_counter_increment;
}