From 928e3e9e21f17ee6cfe8850a903acaad490719d1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 1 Jun 2012 23:04:28 +0200 Subject: Fix LSL animation state reporting and animation state transitions on crossing --- .../Shared/Api/Implementation/LSL_Api.cs | 40 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea78dc3..ec0966b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -111,6 +111,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected Timer m_ShoutSayTimer; protected int m_SayShoutCount = 0; + private Dictionary MovementAnimationsForLSL = + new Dictionary { + {"FLY", "Flying"}, + {"FLYSLOW", "FlyingSlow"}, + {"HOVER_UP", "Hovering Up"}, + {"HOVER_DOWN", "Hovering Down"}, + {"HOVER", "Hovering"}, + {"LAND", "Landing"}, + {"FALLDOWN", "Falling Down"}, + {"PREJUMP", "PreJumping"}, + {"JUMP", "Jumping"}, + {"STANDUP", "Standing Up"}, + {"SOFT_LAND", "Soft Landing"}, + {"STAND", "Standing"}, + {"CROUCHWALK", "CrouchWalking"}, + {"RUN", "Running"}, + {"WALK", "Walking"}, + {"CROUCH", "Crouching"}, + {"TURNLEFT", "Turning Left"}, + {"TURNRIGHT", "Turning Right"} + }; + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) { m_ShoutSayTimer = new Timer(1000); @@ -2523,7 +2545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - vel = m_host.Velocity; + vel = m_host.ParentGroup.RootPart.Velocity; } return new LSL_Vector(vel.X, vel.Y, vel.Z); @@ -4820,14 +4842,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.RegionHandle == presence.RegionHandle) { - Dictionary animationstateNames = DefaultAvatarAnimations.AnimStateNames; - if (presence != null) { - AnimationSet currentAnims = presence.Animator.Animations; - string currentAnimationState = String.Empty; - if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState)) - return currentAnimationState; + if (presence.SitGround) + return "Sitting on Ground"; + if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero) + return "Sitting"; + + string movementAnimation = presence.Animator.CurrentMovementAnimation; + string lslMovementAnimation; + + if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation)) + return lslMovementAnimation; } } -- cgit v1.1