diff options
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 42 |
1 files changed, 40 insertions, 2 deletions
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 | |||
593 | if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) | 593 | if (World.Entities.ContainsKey((UUID)avatar) && World.Entities[avatarID] is ScenePresence) |
594 | { | 594 | { |
595 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 595 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; |
596 | target.AddAnimation(animation, m_host.UUID); | 596 | if (target != null) |
597 | { | ||
598 | UUID animID=UUID.Zero; | ||
599 | lock (m_host.TaskInventory) | ||
600 | { | ||
601 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
602 | { | ||
603 | if (inv.Value.Name == animation) | ||
604 | { | ||
605 | if (inv.Value.Type == (int)AssetType.Animation) | ||
606 | animID = inv.Value.AssetID; | ||
607 | continue; | ||
608 | } | ||
609 | } | ||
610 | } | ||
611 | if (animID == UUID.Zero) | ||
612 | target.AddAnimation(animation, m_host.UUID); | ||
613 | else | ||
614 | target.AddAnimation(animID, m_host.UUID); | ||
615 | } | ||
597 | } | 616 | } |
598 | } | 617 | } |
599 | 618 | ||
@@ -607,7 +626,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
607 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) | 626 | if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) |
608 | { | 627 | { |
609 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; | 628 | ScenePresence target = (ScenePresence)World.Entities[avatarID]; |
610 | target.RemoveAnimation(animation); | 629 | if (target != null) |
630 | { | ||
631 | UUID animID=UUID.Zero; | ||
632 | lock (m_host.TaskInventory) | ||
633 | { | ||
634 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
635 | { | ||
636 | if (inv.Value.Name == animation) | ||
637 | { | ||
638 | if (inv.Value.Type == (int)AssetType.Animation) | ||
639 | animID = inv.Value.AssetID; | ||
640 | continue; | ||
641 | } | ||
642 | } | ||
643 | } | ||
644 | if (animID == UUID.Zero) | ||
645 | target.RemoveAnimation(animation); | ||
646 | else | ||
647 | target.RemoveAnimation(animID); | ||
648 | } | ||
611 | } | 649 | } |
612 | } | 650 | } |
613 | 651 | ||