diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e2f32dd251..2b1fb3d7d8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -867,7 +867,7 @@ namespace OpenSim.Region.Framework.Scenes IsChildAgent = false; - Animator.TrySetMovementAnimation("SIT"); +// Animator.TrySetMovementAnimation("SIT"); } else { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea78dc34cc..ec0966b29f 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; } }