From 87a4abac5085f7554699375eaf3d4b6cc621318a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 9 Sep 2014 20:50:41 +0200 Subject: Plumb the rest of the serverside AO --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++ .../Shared/Api/Implementation/LSL_Api.cs | 96 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 10 +++ 4 files changed, 113 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cecb9cf..b6eb4e4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -6037,5 +6037,10 @@ namespace OpenSim.Region.Framework.Scenes Overrides.SetOverride(animState, animID); Animator.SendAnimPack(); } + + public UUID GetAnimationOverride(string animState) + { + return Overrides.GetOverriddenAnimation(animState); + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 04ed0d1..9dcdf5b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -13545,6 +13545,102 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api presence.SetAnimationOverride(state, animID); } + + public void llResetAnimationOverride(LSL_String animState) + { + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); + if (presence == null) + return; + + if (m_item.PermsGranter == UUID.Zero) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return; + } + + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS) == 0) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return; + } + + if (animState == "ALL") + { + presence.SetAnimationOverride("ALL", UUID.Zero); + return; + } + + string state = String.Empty; + + foreach (KeyValuePair kvp in MovementAnimationsForLSL) + { + if (kvp.Value.ToLower() == ((string)animState).ToLower()) + { + state = kvp.Key; + break; + } + } + + if (state == String.Empty) + { + return; + } + + presence.SetAnimationOverride(state, UUID.Zero); + } + + public LSL_String llGetAnimationOverride(LSL_String animState) + { + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); + if (presence == null) + return String.Empty; + + if (m_item.PermsGranter == UUID.Zero) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return String.Empty; + } + + if ((m_item.PermsMask & (ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS | ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION)) == 0) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return String.Empty; + } + + string state = String.Empty; + + foreach (KeyValuePair kvp in MovementAnimationsForLSL) + { + if (kvp.Value.ToLower() == ((string)animState).ToLower()) + { + state = kvp.Key; + break; + } + } + + if (state == String.Empty) + { + return String.Empty; + } + + UUID animID = presence.GetAnimationOverride(state); + if (animID == UUID.Zero) + return animState; + + foreach (KeyValuePair kvp in DefaultAvatarAnimations.AnimsUUID) + { + if (kvp.Value == animID) + return MovementAnimationsForLSL[kvp.Key]; + } + + foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems()) + { + if (item.AssetID == animID) + return item.Name; + } + + return String.Empty; + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 14e659f..8c51564 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -435,5 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); LSL_List llGetPhysicsMaterial(); void llSetAnimationOverride(LSL_String animState, LSL_String anim); + void llResetAnimationOverride(LSL_String anim_state); + LSL_String llGetAnimationOverride(LSL_String anim_state); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 753bbb7..78c41a7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -2019,5 +2019,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_LSL_Functions.llSetAnimationOverride(animState, anim); } + + public void llResetAnimationOverride(LSL_String anim_state) + { + m_LSL_Functions.llResetAnimationOverride(anim_state); + } + + public LSL_String llGetAnimationOverride(LSL_String anim_state) + { + return m_LSL_Functions.llGetAnimationOverride(anim_state); + } } } -- cgit v1.1