SERVER: Restore compatibility with old item_radio entities

This commit is contained in:
cypress 2023-10-31 12:11:45 -04:00
parent e96648d8c4
commit 4341005d18

View file

@ -69,7 +69,17 @@ void() radioPlay =
if (self.radioState == 1) { if (self.radioState == 1) {
sound (self, CHAN_ITEM, self.tune, 1, ATTN_NORM); sound (self, CHAN_ITEM, self.tune, 1, ATTN_NORM);
#ifndef FTE
self.nextthink = time + GetSoundLen(self.tune);
#else
self.nextthink = time + self.length; self.nextthink = time + self.length;
#endif // FTE
self.think = radioPlay; self.think = radioPlay;
} else if (self.radioState == 0) { } else if (self.radioState == 0) {
sound (self, CHAN_ITEM, "sounds/null.wav", 1, ATTN_NONE); sound (self, CHAN_ITEM, "sounds/null.wav", 1, ATTN_NONE);
@ -83,7 +93,7 @@ void() radio_hit =
self.health = 1; self.health = 1;
sound (self, CHAN_ITEM, "sounds/misc/radio.wav", 1, ATTN_NORM); sound (self, CHAN_ITEM, "sounds/misc/radio.wav", 1, ATTN_NORM);
self.nextthink = time + 1;//getSoundLen("sounds/music/tune1.wav"); self.nextthink = time + 1;
self.think = radioPlay; self.think = radioPlay;
if (self.radioState == 0) if (self.radioState == 0)
@ -97,10 +107,13 @@ void() item_radio =
precache_model ("models/props/radio.mdl"); precache_model ("models/props/radio.mdl");
precache_sound ("sounds/misc/radio.wav"); precache_sound ("sounds/misc/radio.wav");
if(self.tune) { // Backwards compatibility
precache_sound (self.tune); if (!self.tune) {
self.tune = "sounds/music/tune1.wav";
self.length = 10.1;
} }
precache_sound (self.tune);
self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything
self.solid=SOLID_BBOX; self.solid=SOLID_BBOX;
self.classname = "item_radio"; self.classname = "item_radio";