diff options
author | Teravus Ovares | 2008-02-04 14:40:46 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-04 14:40:46 +0000 |
commit | 3ff5ad1ed3118525c31974f8ea9b3cf16861c783 (patch) | |
tree | caaa038a912bf765657dbab37a171abdbad88432 /OpenSim/Region/ScriptEngine/Common | |
parent | * Replacing missing break statement from DotNetEngine/Compiler/LSL/Compiler.cs (diff) | |
download | opensim-SC_OLD-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.zip opensim-SC_OLD-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.gz opensim-SC_OLD-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.bz2 opensim-SC_OLD-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.xz |
Patch from mikkopa/_someone Thanks! adds support for llPreloadSound, llTriggerSound, llPlaySound, llPreloadSound.
* Time to make music boxes?
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 96 |
1 files changed, 92 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 76183ae..367a5f7 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -34,6 +34,7 @@ using System.Threading; | |||
34 | using Axiom.Math; | 34 | using Axiom.Math; |
35 | using libsecondlife; | 35 | using libsecondlife; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | ||
37 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Region.ScriptEngine.Common; | 40 | using OpenSim.Region.ScriptEngine.Common; |
@@ -898,12 +899,44 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
898 | 899 | ||
899 | public void llSound() | 900 | public void llSound() |
900 | { | 901 | { |
902 | // This function has been deprecated | ||
903 | // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound | ||
901 | NotImplemented("llSound"); | 904 | NotImplemented("llSound"); |
902 | } | 905 | } |
903 | 906 | ||
904 | public void llPlaySound(string sound, double volume) | 907 | public void llPlaySound(string sound, double volume) |
905 | { | 908 | { |
906 | NotImplemented("llPlaySound"); | 909 | if (volume > 1) |
910 | volume = 1; | ||
911 | if (volume < 0) | ||
912 | volume = 0; | ||
913 | |||
914 | LLUUID ownerID = m_host.OwnerID; | ||
915 | LLUUID objectID = m_host.UUID; | ||
916 | LLUUID soundID = LLUUID.Zero; | ||
917 | byte flags = 0; | ||
918 | |||
919 | if (!LLUUID.TryParse(sound, out soundID)) | ||
920 | { | ||
921 | //Trys to fetch sound id from prim's inventory. | ||
922 | //Prim's inventory doesn't support non script items yet | ||
923 | SceneObjectPart op = World.GetSceneObjectPart(objectID); | ||
924 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | ||
925 | { | ||
926 | if (item.Value.Name == sound) | ||
927 | { | ||
928 | soundID = item.Value.ItemID; | ||
929 | break; | ||
930 | } | ||
931 | } | ||
932 | } | ||
933 | |||
934 | List<ScenePresence> avatarts = World.GetAvatars(); | ||
935 | foreach (ScenePresence p in avatarts) | ||
936 | { | ||
937 | // TODO: some filtering by distance of avatar | ||
938 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags); | ||
939 | } | ||
907 | } | 940 | } |
908 | 941 | ||
909 | public void llLoopSound(string sound, double volume) | 942 | public void llLoopSound(string sound, double volume) |
@@ -928,7 +961,38 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
928 | 961 | ||
929 | public void llTriggerSound(string sound, double volume) | 962 | public void llTriggerSound(string sound, double volume) |
930 | { | 963 | { |
931 | NotImplemented("llTriggerSound"); | 964 | if (volume > 1) |
965 | volume = 1; | ||
966 | if (volume < 0) | ||
967 | volume = 0; | ||
968 | |||
969 | LLUUID ownerID = m_host.OwnerID; | ||
970 | LLUUID objectID = m_host.UUID; | ||
971 | LLUUID parentID = this.m_host.GetRootPartUUID(); | ||
972 | LLUUID soundID = LLUUID.Zero; | ||
973 | LLVector3 position = this.m_host.AbsolutePosition; // region local | ||
974 | ulong regionHandle = World.RegionInfo.RegionHandle; | ||
975 | |||
976 | if (!LLUUID.TryParse(sound, out soundID)) | ||
977 | { | ||
978 | // search sound file from inventory | ||
979 | SceneObjectPart op = World.GetSceneObjectPart(objectID); | ||
980 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | ||
981 | { | ||
982 | if (item.Value.Name == sound) | ||
983 | { | ||
984 | soundID = item.Value.ItemID; | ||
985 | break; | ||
986 | } | ||
987 | } | ||
988 | } | ||
989 | |||
990 | List<ScenePresence> avatarts = World.GetAvatars(); | ||
991 | foreach (ScenePresence p in avatarts) | ||
992 | { | ||
993 | // TODO: some filtering by distance of avatar | ||
994 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); | ||
995 | } | ||
932 | } | 996 | } |
933 | 997 | ||
934 | public void llStopSound() | 998 | public void llStopSound() |
@@ -938,7 +1002,31 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
938 | 1002 | ||
939 | public void llPreloadSound(string sound) | 1003 | public void llPreloadSound(string sound) |
940 | { | 1004 | { |
941 | NotImplemented("llPreloadSound"); | 1005 | LLUUID ownerID = m_host.OwnerID; |
1006 | LLUUID objectID = m_host.UUID; | ||
1007 | LLUUID soundID = LLUUID.Zero; | ||
1008 | |||
1009 | if (!LLUUID.TryParse(sound, out soundID)) | ||
1010 | { | ||
1011 | //Trys to fetch sound id from prim's inventory. | ||
1012 | //Prim's inventory doesn't support non script items yet | ||
1013 | SceneObjectPart op = World.GetSceneObjectPart(objectID); | ||
1014 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | ||
1015 | { | ||
1016 | if (item.Value.Name == sound) | ||
1017 | { | ||
1018 | soundID = item.Value.ItemID; | ||
1019 | break; | ||
1020 | } | ||
1021 | } | ||
1022 | } | ||
1023 | |||
1024 | List<ScenePresence> avatarts = World.GetAvatars(); | ||
1025 | foreach (ScenePresence p in avatarts) | ||
1026 | { | ||
1027 | // TODO: some filtering by distance of avatar | ||
1028 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
1029 | } | ||
942 | } | 1030 | } |
943 | 1031 | ||
944 | public string llGetSubString(string src, int start, int end) | 1032 | public string llGetSubString(string src, int start, int end) |
@@ -3241,4 +3329,4 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
3241 | throw new Exception("LSL Runtime Error: " + msg); | 3329 | throw new Exception("LSL Runtime Error: " + msg); |
3242 | } | 3330 | } |
3243 | } | 3331 | } |
3244 | } \ No newline at end of file | 3332 | } |