public void llStopAnimation(string anim)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;
UUID invItemID = InventorySelf();
if (invItemID == UUID.Zero)
return;
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
item = m_host.TaskInventory[InventorySelf()];
}
if (item.PermsGranter == UUID.Zero)
return;
if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{
UUID animID = new UUID();
if (!UUID.TryParse(anim, out animID))
{
animID = InventoryKey(anim, false);
}
IScenePresence presence = World.GetScenePresence(item.PermsGranter);
if (presence != null)
{
if (animID == UUID.Zero)
{
if (UUID.TryParse(anim, out animID))
presence.Animator.RemoveAnimation(animID);
else
{
bool RetVal = presence.Animator.RemoveAnimation(anim);
if (!RetVal)
{
IChatModule chatModule = World.RequestModuleInterface<IChatModule>();
if (chatModule != null)
chatModule.SimChat("Could not find animation '" + anim + "'.",
ChatTypeEnum.DebugChannel, 2147483647, m_host.AbsolutePosition,
m_host.Name, m_host.UUID, false, World);
}
}
}
else
presence.Animator.RemoveAnimation(animID);
}
}
}