diff options
author | Melanie | 2012-06-01 23:04:28 +0200 |
---|---|---|
committer | Melanie | 2012-06-01 23:04:28 +0200 |
commit | 928e3e9e21f17ee6cfe8850a903acaad490719d1 (patch) | |
tree | 58d5c23e6dbf5ab8d69cd561297697d79ab74276 /OpenSim | |
parent | Fix impersonation, it got broken in a merge (diff) | |
download | opensim-SC-928e3e9e21f17ee6cfe8850a903acaad490719d1.zip opensim-SC-928e3e9e21f17ee6cfe8850a903acaad490719d1.tar.gz opensim-SC-928e3e9e21f17ee6cfe8850a903acaad490719d1.tar.bz2 opensim-SC-928e3e9e21f17ee6cfe8850a903acaad490719d1.tar.xz |
Fix LSL animation state reporting and animation state transitions on crossing
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 40 |
2 files changed, 34 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e2f32dd..2b1fb3d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -867,7 +867,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
867 | 867 | ||
868 | IsChildAgent = false; | 868 | IsChildAgent = false; |
869 | 869 | ||
870 | Animator.TrySetMovementAnimation("SIT"); | 870 | // Animator.TrySetMovementAnimation("SIT"); |
871 | } | 871 | } |
872 | else | 872 | else |
873 | { | 873 | { |
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 | |||
111 | protected Timer m_ShoutSayTimer; | 111 | protected Timer m_ShoutSayTimer; |
112 | protected int m_SayShoutCount = 0; | 112 | protected int m_SayShoutCount = 0; |
113 | 113 | ||
114 | private Dictionary<string, string> MovementAnimationsForLSL = | ||
115 | new Dictionary<string, string> { | ||
116 | {"FLY", "Flying"}, | ||
117 | {"FLYSLOW", "FlyingSlow"}, | ||
118 | {"HOVER_UP", "Hovering Up"}, | ||
119 | {"HOVER_DOWN", "Hovering Down"}, | ||
120 | {"HOVER", "Hovering"}, | ||
121 | {"LAND", "Landing"}, | ||
122 | {"FALLDOWN", "Falling Down"}, | ||
123 | {"PREJUMP", "PreJumping"}, | ||
124 | {"JUMP", "Jumping"}, | ||
125 | {"STANDUP", "Standing Up"}, | ||
126 | {"SOFT_LAND", "Soft Landing"}, | ||
127 | {"STAND", "Standing"}, | ||
128 | {"CROUCHWALK", "CrouchWalking"}, | ||
129 | {"RUN", "Running"}, | ||
130 | {"WALK", "Walking"}, | ||
131 | {"CROUCH", "Crouching"}, | ||
132 | {"TURNLEFT", "Turning Left"}, | ||
133 | {"TURNRIGHT", "Turning Right"} | ||
134 | }; | ||
135 | |||
114 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 136 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
115 | { | 137 | { |
116 | m_ShoutSayTimer = new Timer(1000); | 138 | m_ShoutSayTimer = new Timer(1000); |
@@ -2523,7 +2545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2523 | } | 2545 | } |
2524 | else | 2546 | else |
2525 | { | 2547 | { |
2526 | vel = m_host.Velocity; | 2548 | vel = m_host.ParentGroup.RootPart.Velocity; |
2527 | } | 2549 | } |
2528 | 2550 | ||
2529 | return new LSL_Vector(vel.X, vel.Y, vel.Z); | 2551 | return new LSL_Vector(vel.X, vel.Y, vel.Z); |
@@ -4820,14 +4842,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4820 | 4842 | ||
4821 | if (m_host.RegionHandle == presence.RegionHandle) | 4843 | if (m_host.RegionHandle == presence.RegionHandle) |
4822 | { | 4844 | { |
4823 | Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames; | ||
4824 | |||
4825 | if (presence != null) | 4845 | if (presence != null) |
4826 | { | 4846 | { |
4827 | AnimationSet currentAnims = presence.Animator.Animations; | 4847 | if (presence.SitGround) |
4828 | string currentAnimationState = String.Empty; | 4848 | return "Sitting on Ground"; |
4829 | if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState)) | 4849 | if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero) |
4830 | return currentAnimationState; | 4850 | return "Sitting"; |
4851 | |||
4852 | string movementAnimation = presence.Animator.CurrentMovementAnimation; | ||
4853 | string lslMovementAnimation; | ||
4854 | |||
4855 | if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation)) | ||
4856 | return lslMovementAnimation; | ||
4831 | } | 4857 | } |
4832 | } | 4858 | } |
4833 | 4859 | ||