Fix LSL animation state reporting and animation state transitions on crossing

avinationmerge
Melanie 2012-06-01 23:04:28 +02:00
parent d8f6faa89e
commit 928e3e9e21
2 changed files with 34 additions and 8 deletions

View File

@ -867,7 +867,7 @@ namespace OpenSim.Region.Framework.Scenes
IsChildAgent = false; IsChildAgent = false;
Animator.TrySetMovementAnimation("SIT"); // Animator.TrySetMovementAnimation("SIT");
} }
else else
{ {

View File

@ -111,6 +111,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected Timer m_ShoutSayTimer; protected Timer m_ShoutSayTimer;
protected int m_SayShoutCount = 0; protected int m_SayShoutCount = 0;
private Dictionary<string, string> MovementAnimationsForLSL =
new Dictionary<string, string> {
{"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) public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
{ {
m_ShoutSayTimer = new Timer(1000); m_ShoutSayTimer = new Timer(1000);
@ -2523,7 +2545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
else else
{ {
vel = m_host.Velocity; vel = m_host.ParentGroup.RootPart.Velocity;
} }
return new LSL_Vector(vel.X, vel.Y, vel.Z); 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) if (m_host.RegionHandle == presence.RegionHandle)
{ {
Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames;
if (presence != null) if (presence != null)
{ {
AnimationSet currentAnims = presence.Animator.Animations; if (presence.SitGround)
string currentAnimationState = String.Empty; return "Sitting on Ground";
if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState)) if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero)
return currentAnimationState; return "Sitting";
string movementAnimation = presence.Animator.CurrentMovementAnimation;
string lslMovementAnimation;
if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation))
return lslMovementAnimation;
} }
} }