mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
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.)
This commit is contained in:
@@ -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<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);
|
||||
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<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);
|
||||
else
|
||||
target.RemoveAnimation(animID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user