7 // when triggered, the music is overridden for activator until timeout (or forever, if timeout is 0)
8 // when targetname is not set, THIS ONE is default
9 void target_music_sendto(float to)
11 WriteByte(to, TE_CSQC_TARGET_MUSIC);
12 WriteByte(to, self.volume * 255.0);
13 WriteByte(to, self.fade_time * 16.0);
14 WriteByte(to, self.timeout);
15 WriteString(to, self.noise);
17 void target_music_reset()
19 if(self.targetname == "")
20 target_music_sendto(MSG_ALL);
22 void target_music_use()
26 msg_entity = activator;
27 target_music_sendto(MSG_ONE);
29 void spawnfunc_target_music()
31 self.use = target_music_use;
32 self.reset = target_music_reset;
33 precache_sound(self.noise);
36 if(self.targetname == "")
37 target_music_sendto(MSG_INIT);
46 // when triggered, it is disabled/enabled for everyone
47 float trigger_music_SendEntity(entity to, float sf)
49 WriteByte(MSG_ENTITY, TE_CSQC_TARGET_MUSIC);
53 WriteByte(MSG_ENTITY, sf);
56 WriteCoord(MSG_ENTITY, self.origin_x);
57 WriteCoord(MSG_ENTITY, self.origin_y);
58 WriteCoord(MSG_ENTITY, self.origin_z);
62 if(self.model != "null")
64 WriteShort(MSG_ENTITY, self.modelindex);
65 WriteCoord(MSG_ENTITY, self.mins_x);
66 WriteCoord(MSG_ENTITY, self.mins_y);
67 WriteCoord(MSG_ENTITY, self.mins_z);
68 WriteCoord(MSG_ENTITY, self.maxs_x);
69 WriteCoord(MSG_ENTITY, self.maxs_y);
70 WriteCoord(MSG_ENTITY, self.maxs_z);
74 WriteShort(MSG_ENTITY, 0);
75 WriteCoord(MSG_ENTITY, self.maxs_x);
76 WriteCoord(MSG_ENTITY, self.maxs_y);
77 WriteCoord(MSG_ENTITY, self.maxs_z);
79 WriteByte(MSG_ENTITY, self.volume * 255.0);
80 WriteByte(MSG_ENTITY, self.fade_time * 16.0);
81 WriteString(MSG_ENTITY, self.noise);
85 void trigger_music_reset()
87 self.cnt = !(self.spawnflags & 1);
88 self.SendFlags |= 0x80;
90 void trigger_music_use()
93 self.SendFlags |= 0x80;
95 void spawnfunc_trigger_music()
98 setmodel(self, self.model);
99 precache_sound (self.noise);
104 setorigin(self, self.origin + self.mins);
105 setsize(self, '0 0 0', self.maxs - self.mins);
107 trigger_music_reset();
109 self.use = trigger_music_use;
110 self.reset = trigger_music_reset;
112 Net_LinkEntity(self, FALSE, 0, trigger_music_SendEntity);