diff options
author | UbitUmarov | 2018-11-14 19:02:00 +0000 |
---|---|---|
committer | UbitUmarov | 2018-11-14 19:02:00 +0000 |
commit | fad6295398cf0c7bbcc08cfae1efae495bfde29b (patch) | |
tree | 223e7f051306f9c0ab4d135bee0bc4b3d64d7c32 /OpenSim/Region | |
parent | take friends out of basicDOSprot (too little, too late) (diff) | |
download | opensim-SC-fad6295398cf0c7bbcc08cfae1efae495bfde29b.zip opensim-SC-fad6295398cf0c7bbcc08cfae1efae495bfde29b.tar.gz opensim-SC-fad6295398cf0c7bbcc08cfae1efae495bfde29b.tar.bz2 opensim-SC-fad6295398cf0c7bbcc08cfae1efae495bfde29b.tar.xz |
change ossl link sound functions to search for sound both on script host and target prims
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 38 |
2 files changed, 43 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs index f08ba59..94653d5 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs | |||
@@ -93,15 +93,33 @@ namespace OpenSim.Region.Framework.Scenes.Scripting | |||
93 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type) | 93 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type) |
94 | { | 94 | { |
95 | UUID key; | 95 | UUID key; |
96 | if (UUID.TryParse(identifier, out key)) | ||
97 | return key; | ||
96 | 98 | ||
97 | if (!UUID.TryParse(identifier, out key)) | 99 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); |
100 | if (item != null && item.Type == (int)type) | ||
101 | return item.AssetID; | ||
102 | |||
103 | return UUID.Zero; | ||
104 | } | ||
105 | |||
106 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, SceneObjectPart host, string identifier, AssetType type) | ||
107 | { | ||
108 | UUID key; | ||
109 | if (UUID.TryParse(identifier, out key)) | ||
110 | return key; | ||
111 | |||
112 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | ||
113 | if (item != null && item.Type == (int)type) | ||
114 | return item.AssetID; | ||
115 | |||
116 | if (part.LocalId != host.LocalId) | ||
98 | { | 117 | { |
99 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | 118 | item = host.Inventory.GetInventoryItem(identifier); |
100 | if (item != null && item.Type == (int)type) | 119 | if (item != null && item.Type == (int)type) |
101 | key = item.AssetID; | 120 | return item.AssetID; |
102 | } | 121 | } |
103 | 122 | return UUID.Zero; | |
104 | return key; | ||
105 | } | 123 | } |
106 | } | 124 | } |
107 | } \ No newline at end of file | 125 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e0d2e5..a032715 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -4900,7 +4900,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4900 | if(sop == null) | 4900 | if(sop == null) |
4901 | return; | 4901 | return; |
4902 | sop.AdjustSoundGain(volume); | 4902 | sop.AdjustSoundGain(volume); |
4903 | ScriptSleep(100); | ||
4904 | } | 4903 | } |
4905 | 4904 | ||
4906 | public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius) | 4905 | public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius) |
@@ -4909,7 +4908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4909 | SceneObjectPart sop = GetSingleLinkPart(linknum); | 4908 | SceneObjectPart sop = GetSingleLinkPart(linknum); |
4910 | if(sop == null) | 4909 | if(sop == null) |
4911 | return; | 4910 | return; |
4912 | m_host.SoundRadius = radius; | 4911 | sop.SoundRadius = radius; |
4913 | } | 4912 | } |
4914 | 4913 | ||
4915 | public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume) | 4914 | public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume) |
@@ -4923,8 +4922,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4923 | if(sop == null) | 4922 | if(sop == null) |
4924 | return; | 4923 | return; |
4925 | 4924 | ||
4926 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 4925 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
4927 | if(soundID == UUID.Zero) | 4926 | if (soundID == UUID.Zero) |
4928 | return; | 4927 | return; |
4929 | 4928 | ||
4930 | // send the sound, once, to all clients in range | 4929 | // send the sound, once, to all clients in range |
@@ -4942,8 +4941,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4942 | if(sop == null) | 4941 | if(sop == null) |
4943 | return; | 4942 | return; |
4944 | 4943 | ||
4945 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 4944 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
4946 | if(soundID == UUID.Zero) | 4945 | if (soundID == UUID.Zero) |
4947 | return; | 4946 | return; |
4948 | 4947 | ||
4949 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, false,false); | 4948 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, false,false); |
@@ -4953,12 +4952,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4953 | { | 4952 | { |
4954 | m_host.AddScriptLPS(1); | 4953 | m_host.AddScriptLPS(1); |
4955 | 4954 | ||
4955 | if (m_SoundModule == null) | ||
4956 | return; | ||
4957 | |||
4956 | SceneObjectPart sop = GetSingleLinkPart(linknum); | 4958 | SceneObjectPart sop = GetSingleLinkPart(linknum); |
4957 | if(sop == null) | 4959 | if(sop == null) |
4958 | return; | 4960 | return; |
4959 | 4961 | ||
4960 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 4962 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
4961 | if(soundID == UUID.Zero) | 4963 | if (soundID == UUID.Zero) |
4962 | return; | 4964 | return; |
4963 | 4965 | ||
4964 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, true, false); | 4966 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, true, false); |
@@ -4975,8 +4977,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4975 | if(sop == null) | 4977 | if(sop == null) |
4976 | return; | 4978 | return; |
4977 | 4979 | ||
4978 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 4980 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
4979 | if(soundID == UUID.Zero) | 4981 | if (soundID == UUID.Zero) |
4980 | return; | 4982 | return; |
4981 | 4983 | ||
4982 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, false, true); | 4984 | m_SoundModule.LoopSound(sop.UUID, soundID, volume, false, true); |
@@ -4993,8 +4995,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4993 | if(sop == null) | 4995 | if(sop == null) |
4994 | return; | 4996 | return; |
4995 | 4997 | ||
4996 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 4998 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
4997 | if(soundID == UUID.Zero) | 4999 | if (soundID == UUID.Zero) |
4998 | return; | 5000 | return; |
4999 | 5001 | ||
5000 | // send the sound, once, to all clients in range | 5002 | // send the sound, once, to all clients in range |
@@ -5012,8 +5014,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5012 | if(sop == null) | 5014 | if(sop == null) |
5013 | return; | 5015 | return; |
5014 | 5016 | ||
5015 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 5017 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
5016 | if(soundID == UUID.Zero) | 5018 | if (soundID == UUID.Zero) |
5017 | return; | 5019 | return; |
5018 | 5020 | ||
5019 | // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. | 5021 | // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. |
@@ -5032,8 +5034,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5032 | if(sop == null) | 5034 | if(sop == null) |
5033 | return; | 5035 | return; |
5034 | 5036 | ||
5035 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 5037 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
5036 | if(soundID == UUID.Zero) | 5038 | if (soundID == UUID.Zero) |
5037 | return; | 5039 | return; |
5038 | 5040 | ||
5039 | m_SoundModule.TriggerSoundLimited(sop.UUID, soundID, volume, | 5041 | m_SoundModule.TriggerSoundLimited(sop.UUID, soundID, volume, |
@@ -5065,8 +5067,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5065 | if(sop == null) | 5067 | if(sop == null) |
5066 | return; | 5068 | return; |
5067 | 5069 | ||
5068 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); | 5070 | UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); |
5069 | if(soundID == UUID.Zero) | 5071 | if (soundID == UUID.Zero) |
5070 | return; | 5072 | return; |
5071 | 5073 | ||
5072 | m_SoundModule.PreloadSound(sop.UUID, soundID); | 5074 | m_SoundModule.PreloadSound(sop.UUID, soundID); |