diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 29f5a83..c863528 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -991,32 +991,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
991 | 991 | ||
992 | private void AvatarPlayAnimation(string avatar, string animation) | 992 | private void AvatarPlayAnimation(string avatar, string animation) |
993 | { | 993 | { |
994 | UUID avatarID = (UUID)avatar; | ||
995 | |||
996 | m_host.AddScriptLPS(1); | 994 | m_host.AddScriptLPS(1); |
997 | if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) | 995 | |
996 | UUID avatarID; | ||
997 | if(!UUID.TryParse(avatar, out avatarID)) | ||
998 | return; | ||
999 | |||
1000 | if(!World.Entities.ContainsKey(avatarID)) | ||
1001 | return; | ||
1002 | |||
1003 | ScenePresence target = null; | ||
1004 | if ((World.Entities[avatarID] is ScenePresence)) | ||
1005 | target = (ScenePresence)World.Entities[avatarID]; | ||
1006 | |||
1007 | if (target == null) | ||
1008 | return; | ||
1009 | |||
1010 | UUID animID = UUID.Zero; | ||
1011 | m_host.TaskInventory.LockItemsForRead(true); | ||
1012 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
998 | { | 1013 | { |
999 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 1014 | if (inv.Value.Type == (int)AssetType.Animation) |
1000 | if (target != null) | ||
1001 | { | 1015 | { |
1002 | UUID animID=UUID.Zero; | 1016 | if (inv.Value.Name == animation) |
1003 | m_host.TaskInventory.LockItemsForRead(true); | 1017 | { |
1004 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 1018 | animID = inv.Value.AssetID; |
1005 | { | 1019 | break; |
1006 | if (inv.Value.Name == animation) | 1020 | } |
1007 | { | ||
1008 | if (inv.Value.Type == (int)AssetType.Animation) | ||
1009 | animID = inv.Value.AssetID; | ||
1010 | continue; | ||
1011 | } | ||
1012 | } | ||
1013 | m_host.TaskInventory.LockItemsForRead(false); | ||
1014 | if (animID == UUID.Zero) | ||
1015 | target.Animator.AddAnimation(animation, m_host.UUID); | ||
1016 | else | ||
1017 | target.Animator.AddAnimation(animID, m_host.UUID); | ||
1018 | } | 1021 | } |
1019 | } | 1022 | } |
1023 | m_host.TaskInventory.LockItemsForRead(false); | ||
1024 | |||
1025 | if (animID == UUID.Zero) | ||
1026 | target.Animator.AddAnimation(animation, m_host.UUID); | ||
1027 | else | ||
1028 | target.Animator.AddAnimation(animID, m_host.UUID); | ||
1020 | } | 1029 | } |
1021 | 1030 | ||
1022 | public void osAvatarStopAnimation(string avatar, string animation) | 1031 | public void osAvatarStopAnimation(string avatar, string animation) |