From 2a5c51f5b15480c4223dc567a8defd98240a5cfa Mon Sep 17 00:00:00 2001 From: cypress Date: Sat, 25 Nov 2023 18:40:08 -0500 Subject: [PATCH] SERVER: Add spawnflag 1 for single-play radios --- source/server/entities/map_entities.qc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/server/entities/map_entities.qc b/source/server/entities/map_entities.qc index fcaea8a..a468d3a 100644 --- a/source/server/entities/map_entities.qc +++ b/source/server/entities/map_entities.qc @@ -63,6 +63,7 @@ void() place_fire = .float radioState; .float length; .string tune; +#define SPAWNFLAG_RADIO_PLAYONCE 1 void() radioPlay = { self.health = 1; @@ -70,13 +71,15 @@ void() radioPlay = if (self.radioState == 1) { sound (self, CHAN_ITEM, self.tune, 1, ATTN_NORM); + + if (!(self.spawnflags & SPAWNFLAG_RADIO_PLAYONCE)) #ifndef FTE - self.nextthink = time + GetSoundLen(self.tune); + self.nextthink = time + GetSoundLen(self.tune); #else - self.nextthink = time + self.length; + self.nextthink = time + self.length; #endif // FTE @@ -100,6 +103,9 @@ void() radio_hit = self.radioState = 1; else if (self.radioState == 1) self.radioState = 0; + + if (self.spawnflags & SPAWNFLAG_RADIO_PLAYONCE) + self.takedamage = DAMAGE_NO; } void() item_radio =