-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackages.cs
38 lines (33 loc) · 1.46 KB
/
packages.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package Event_Instruments {
function fxDTSBrick::onDeath(%obj) {
Parent::onDeath(%obj);
if (%obj.isPlayingInstrument) {
%obj.stopPlaying();
}
}
function serverCmdAddEvent(%client, %enabled, %inputEventIdx, %delay, %targetIdx, %NTNameIdx, %outputEventIdx, %par1, %par2, %par3, %par4) {
%outputEventName = $OutputEvent_NamefxDTSBrick_[%outputEventIdx];
switch$ (%outputEventName) {
case "playNote" or "playRandomNote" or "playPhrase" or "playSong":
%fallbackHash = InstrumentsServer.getInstrumentHash(InstrumentsServer.name(0));
// Accounting for old version of Event_Instruments
if (strLen(%par1) <= 2) {
%instrument = InstrumentsServer.name(%par1);
if (%instrument $= "") {
warn("WARNING: loadBricks() - Unknown instrument index \"" @ %par1 @ "\" for " @ %outputEventName @ " event!");
%par1 = %fallbackHash;
}
else {
%par1 = InstrumentsServer.getInstrumentHash(%instrument);
}
}
// Otherwise let's check if the hash exists on this server
else if ($Instruments::Server::HashToName[%par1] $= "") {
warn("WARNING: loadBricks() - Instrument hash \"" @ %par1 @"\" not found!");
%par1 = %fallbackHash;
}
}
Parent::serverCmdAddEvent(%client, %enabled, %inputEventIdx, %delay, %targetIdx, %NTNameIdx, %outputEventIdx, %par1, %par2, %par3, %par4);
}
};
activatePackage(Event_Instruments);