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.)
0.6.5-rc1
Charles Krinke 2009-03-15 19:45:42 +00:00
parent 9e4d9e2c3f
commit 9e0329f1dc
1 changed files with 40 additions and 2 deletions

View File

@ -593,7 +593,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence)
{ {
ScenePresence target = (ScenePresence)World.Entities[avatarID]; ScenePresence target = (ScenePresence)World.Entities[avatarID];
if (target != null)
{
UUID animID=UUID.Zero;
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> 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); 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) if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence)
{ {
ScenePresence target = (ScenePresence)World.Entities[avatarID]; ScenePresence target = (ScenePresence)World.Entities[avatarID];
if (target != null)
{
UUID animID=UUID.Zero;
lock (m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> 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); target.RemoveAnimation(animation);
else
target.RemoveAnimation(animID);
}
} }
} }