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 WriteString(to, self.noise);
16 void target_music_reset()
18 target_music_sendto(MSG_ALL);
20 void target_music_use()
24 msg_entity = activator;
25 target_music_sendto(MSG_ONE);
27 void spawnfunc_target_music()
29 self.use = target_music_use;
30 self.reset = target_music_reset;
31 precache_sound(self.noise);
34 target_music_sendto(MSG_INIT);
43 // when triggered, it is disabled/enabled for everyone
44 float trigger_music_SendEntity(entity to, float sf)
46 WriteByte(MSG_ENTITY, TE_CSQC_TARGET_MUSIC);
50 WriteByte(MSG_ENTITY, sf);
53 WriteCoord(MSG_ENTITY, self.origin_x);
54 WriteCoord(MSG_ENTITY, self.origin_y);
55 WriteCoord(MSG_ENTITY, self.origin_z);
59 if(self.model != "null")
61 WriteShort(MSG_ENTITY, self.modelindex);
62 WriteCoord(MSG_ENTITY, self.mins_x);
63 WriteCoord(MSG_ENTITY, self.mins_y);
64 WriteCoord(MSG_ENTITY, self.mins_z);
65 WriteCoord(MSG_ENTITY, self.maxs_x);
66 WriteCoord(MSG_ENTITY, self.maxs_y);
67 WriteCoord(MSG_ENTITY, self.maxs_z);
71 WriteShort(MSG_ENTITY, 0);
72 WriteCoord(MSG_ENTITY, self.maxs_x);
73 WriteCoord(MSG_ENTITY, self.maxs_y);
74 WriteCoord(MSG_ENTITY, self.maxs_z);
76 WriteByte(MSG_ENTITY, self.volume * 255.0);
77 WriteByte(MSG_ENTITY, self.fade_time * 16.0);
78 WriteString(MSG_ENTITY, self.noise);
82 void trigger_music_reset()
84 self.cnt = !(self.spawnflags & 1);
85 self.SendFlags |= 0x80;
87 void trigger_music_use()
90 self.SendFlags |= 0x80;
92 void spawnfunc_trigger_music()
95 setmodel(self, self.model);
96 precache_sound (self.noise);
101 setorigin(self, self.origin + self.mins);
102 setsize(self, '0 0 0', self.maxs - self.mins);
104 trigger_music_reset();
106 self.use = trigger_music_use;
107 self.reset = trigger_music_reset;
109 Net_LinkEntity(self, FALSE, 0, trigger_music_SendEntity);