Rework some of the animation logic in an attempt to resolve #1318

0.6.0-stable
Jeff Ames 2008-05-19 04:14:43 +00:00
parent 7ed86b429a
commit dfe8e2c502
1 changed files with 26 additions and 39 deletions

View File

@ -873,11 +873,8 @@ namespace OpenSim.Region.Environment.Scenes
// Cause the avatar to stop flying if it's colliding // Cause the avatar to stop flying if it's colliding
// with something with the down arrow pressed. // with something with the down arrow pressed.
// Skip if there's no physicsactor
if (m_physicsActor != null)
{
// Only do this if we're flying // Only do this if we're flying
if (m_physicsActor.Flying) if (m_physicsActor != null && m_physicsActor.Flying)
{ {
// Are the landing controls requirements filled? // Are the landing controls requirements filled?
bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
@ -886,14 +883,11 @@ namespace OpenSim.Region.Environment.Scenes
// Are the collision requirements fulfilled? // Are the collision requirements fulfilled?
bool colliding = (m_physicsActor.IsColliding == true); bool colliding = (m_physicsActor.IsColliding == true);
if (m_physicsActor.Flying && colliding && controlland) if (m_physicsActor.Flying && colliding && controlland)
{ {
StopFlying(); StopFlying();
} }
} }
}
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{ {
@ -949,10 +943,6 @@ namespace OpenSim.Region.Environment.Scenes
private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset)
{ {
bool autopilot = true; bool autopilot = true;
LLVector3 pos = new LLVector3(); LLVector3 pos = new LLVector3();
LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1);
@ -1181,21 +1171,20 @@ namespace OpenSim.Region.Environment.Scenes
if (m_movementflag != 0) if (m_movementflag != 0)
{ {
// We are moving // We are moving
if (m_physicsActor.Flying) if (PhysicsActor != null && PhysicsActor.Flying)
{ {
return "FLY"; return "FLY";
} }
else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && else if (PhysicsActor != null && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 &&
PhysicsActor.IsColliding) PhysicsActor.IsColliding)
{ {
return "CROUCHWALK"; return "CROUCHWALK";
} }
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6) else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6)
{ {
// Client is moving and falling at a velocity greater then 6 meters per unit
return "FALLDOWN"; return "FALLDOWN";
} }
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 &&
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{ {
return "JUMP"; return "JUMP";
@ -1212,23 +1201,20 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
// Not moving // Not moving
if (PhysicsActor != null && PhysicsActor.IsColliding)
if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
PhysicsActor.IsColliding)
{ {
return "CROUCH"; return "CROUCH";
} }
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying) else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6 && !PhysicsActor.Flying)
{ {
return "FALLDOWN"; return "FALLDOWN";
} }
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 && !PhysicsActor.Flying)
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{ {
// This is the standing jump // This is the standing jump
return "JUMP"; return "JUMP";
} }
else if (m_physicsActor.Flying) else if (PhysicsActor != null && PhysicsActor.Flying)
{ {
return "HOVER"; return "HOVER";
} }
@ -1962,6 +1948,7 @@ namespace OpenSim.Region.Environment.Scenes
Health = health; Health = health;
ControllingClient.SendHealth(Health); ControllingClient.SendHealth(Health);
} }
internal void Close() internal void Close()
{ {
lock (m_attachments) lock (m_attachments)
@ -2009,6 +1996,7 @@ namespace OpenSim.Region.Environment.Scenes
DefaultTexture = textu.ToBytes(); DefaultTexture = textu.ToBytes();
} }
} }
public void AddAttachment(SceneObjectGroup gobj) public void AddAttachment(SceneObjectGroup gobj)
{ {
lock (m_attachments) lock (m_attachments)
@ -2016,6 +2004,7 @@ namespace OpenSim.Region.Environment.Scenes
m_attachments.Add(gobj); m_attachments.Add(gobj);
} }
} }
public void RemoveAttachment(SceneObjectGroup gobj) public void RemoveAttachment(SceneObjectGroup gobj)
{ {
lock (m_attachments) lock (m_attachments)
@ -2026,6 +2015,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void CrossAttachmentsIntoNewRegion(ulong regionHandle) public void CrossAttachmentsIntoNewRegion(ulong regionHandle)
{ {
lock (m_attachments) lock (m_attachments)
@ -2045,8 +2035,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_attachments.Clear(); m_attachments.Clear();
} }
} }
public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
{ {
m_controllingClient = client; m_controllingClient = client;
@ -2390,7 +2380,6 @@ namespace OpenSim.Region.Environment.Scenes
public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID) public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID)
{ {
ScriptControllers obj = new ScriptControllers(); ScriptControllers obj = new ScriptControllers();
obj.ignoreControls = ScriptControlled.CONTROL_ZERO; obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
obj.eventControls = ScriptControlled.CONTROL_ZERO; obj.eventControls = ScriptControlled.CONTROL_ZERO;
@ -2439,9 +2428,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
} }
public void HandleForceReleaseControls(IClientAPI remoteClient, LLUUID agentID) public void HandleForceReleaseControls(IClientAPI remoteClient, LLUUID agentID)
{ {
IgnoredControls = ScriptControlled.CONTROL_ZERO; IgnoredControls = ScriptControlled.CONTROL_ZERO;
@ -2537,7 +2525,6 @@ namespace OpenSim.Region.Environment.Scenes
change |= DCF; change |= DCF;
continue; continue;
} }
} }
lock (scriptedcontrols) lock (scriptedcontrols)
@ -2555,8 +2542,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
LastCommands = allflags; LastCommands = allflags;
} }
internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored) internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored)
{ {
if (Ignored == ScriptControlled.CONTROL_ZERO) if (Ignored == ScriptControlled.CONTROL_ZERO)