From 9e0329f1dc9c5853773c9b40336f98254c734141 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 15 Mar 2009 19:45:42 +0000 Subject: Fixes Mantis #3294. Thank you kindly, Godfrey, for a patch that: Attached is a patch which provides osAvatarPlayAnimation() the ability to also trigger animations contained within the same prim as the script, as llStartAnimation() does. (It also modifies osAvatarStopAnimation(), otherwise the script wouldn't be able to stop animations it had started.) --- .../Shared/Api/Implementation/OSSL_Api.cs | 42 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6b3afe0..f4be267 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -593,7 +593,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; - target.AddAnimation(animation, m_host.UUID); + if (target != null) + { + UUID animID=UUID.Zero; + lock (m_host.TaskInventory) + { + foreach (KeyValuePair inv in m_host.TaskInventory) + { + if (inv.Value.Name == animation) + { + if (inv.Value.Type == (int)AssetType.Animation) + animID = inv.Value.AssetID; + continue; + } + } + } + if (animID == UUID.Zero) + target.AddAnimation(animation, m_host.UUID); + else + target.AddAnimation(animID, m_host.UUID); + } } } @@ -607,7 +626,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; - target.RemoveAnimation(animation); + if (target != null) + { + UUID animID=UUID.Zero; + lock (m_host.TaskInventory) + { + foreach (KeyValuePair inv in m_host.TaskInventory) + { + if (inv.Value.Name == animation) + { + if (inv.Value.Type == (int)AssetType.Animation) + animID = inv.Value.AssetID; + continue; + } + } + } + if (animID == UUID.Zero) + target.RemoveAnimation(animation); + else + target.RemoveAnimation(animID); + } } } -- cgit v1.1