Implement most effects of AGENT_CONTROL_STOP

AGENT_CONTROL_STOP is specified to SP.HandleAgentUpdate if the user holds down the space bar on a viewer.
For a stopped avatar, this prevents fly or walk/run (though not rotate) until released.
For a walking/running avatar, this reduces movement to half speed.
For a flying avatar, this stops the avatar.
These are observed behaviours on the LL grid - there was no previous OpenSimulator implementation
This commit introduces an optional parameter to SP.AddNewMovement(), which means that it will no longer compile on .NET 3.5 or earlier versions of Mono than 2.8
Currently, this does not work for jumping, and if used whilst flying the avatar continues the fly animation even though it does not move
This commit is contained in:
Justin Clark-Casey (justincc)
2013-11-30 01:44:30 +00:00
parent 4bd4f1cd83
commit 4cde02a2a3
2 changed files with 104 additions and 44 deletions

View File

@@ -403,11 +403,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
Falling = false;
// Walking / crouchwalking / running
if (move.Z < 0f)
{
return "CROUCHWALK";
else if (m_scenePresence.SetAlwaysRun)
return "RUN";
else
return "WALK";
}
// We need to prevent these animations if the user tries to make their avatar walk or run whilst
// specifying AGENT_CONTROL_STOP (pressing down space on viewers).
else if (!m_scenePresence.AgentControlStopActive)
{
if (m_scenePresence.SetAlwaysRun)
return "RUN";
else
return "WALK";
}
}
else if (!m_jumping)
{
@@ -435,6 +442,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <returns>'true' if the animation was changed</returns>
public bool UpdateMovementAnimations()
{
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name);
bool ret = false;
lock (m_animations)
{