Simplify sit code a bit by determining correct animation in HandleSit instead of HandleSitRequest. This eliminates m_nextSitAnimation, an unneeded state-saving variable in ScenePresence

This commit is contained in:
Dan Lake
2012-12-13 13:05:28 -08:00
parent 6f002733b1
commit 88b094cbf7

View File

@@ -212,8 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
private Quaternion m_headrotation = Quaternion.Identity;
private string m_nextSitAnimation = String.Empty;
//PauPaw:Proper PID Controler for autopilot************
public bool MovingToTarget { get; private set; }
public Vector3 MoveToPositionTarget { get; private set; }
@@ -1955,25 +1953,10 @@ namespace OpenSim.Region.Framework.Scenes
StandUp();
}
// if (!String.IsNullOrEmpty(sitAnimation))
// {
// m_nextSitAnimation = sitAnimation;
// }
// else
// {
m_nextSitAnimation = "SIT";
// }
//SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
SceneObjectPart part = FindNextAvailableSitTarget(targetID);
if (part != null)
{
if (!String.IsNullOrEmpty(part.SitAnimation))
{
m_nextSitAnimation = part.SitAnimation;
}
m_requestedSitTargetID = part.LocalId;
m_requestedSitTargetUUID = targetID;
@@ -2187,18 +2170,6 @@ namespace OpenSim.Region.Framework.Scenes
*/
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
{
if (!String.IsNullOrEmpty(m_nextSitAnimation))
{
HandleAgentSit(remoteClient, agentID, m_nextSitAnimation);
}
else
{
HandleAgentSit(remoteClient, agentID, "SIT");
}
}
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
@@ -2246,7 +2217,12 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
RemoveFromPhysicalScene();
String sitAnimation = "SIT";
if (!String.IsNullOrEmpty(part.SitAnimation))
{
sitAnimation = part.SitAnimation;
}
Animator.TrySetMovementAnimation(sitAnimation);
SendAvatarDataToAllAgents();
}