Added a (xmlIgnored) SitAnimation property to SceneObjectPart. That allows the setting of the name of the animation to be used when a avatar sits on that object. At some point in the future this should be persisted.

So basically simplifies what a lsl script that detects a avatar sitting on a prim, then stopping the sit animation and playing a custom animation, does.
Also added another ScenePresence.HandleAgentRequestSit() method , that accepts the name of the sit animation. So that modules can override the animation used, when they are doing a server controlled sit.
Started some work on making the stand pose be played as soon as a user logs into a region. Rather than them starting with their arms stretched. This still needs more work
0.6.0-stable
MW 2008-11-04 16:39:28 +00:00
parent f57d1307ab
commit 1c2a0c78d9
2 changed files with 66 additions and 2 deletions

View File

@ -160,6 +160,7 @@ namespace OpenSim.Region.Environment.Scenes
private string m_sitName = String.Empty;
private Quaternion m_sitTargetOrientation = Quaternion.Identity;
private Vector3 m_sitTargetPosition = Vector3.Zero;
private string m_sitAnimation = "SIT";
private string m_text = String.Empty;
private string m_touchName = String.Empty;
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@ -1017,6 +1018,13 @@ if (m_shape != null) {
set { _parentUUID = value; }
}
[XmlIgnore]
public string SitAnimation
{
get { return m_sitAnimation; }
set { m_sitAnimation = value; }
}
#endregion Public Properties with only Get

View File

@ -97,6 +97,8 @@ namespace OpenSim.Region.Environment.Scenes
private uint m_requestedSitTargetID = 0;
private UUID m_requestedSitTargetUUID = UUID.Zero;
private bool m_startAnimationSet = false;
private Vector3 m_requestedSitOffset = new Vector3();
private Vector3 m_LastFinitePos = new Vector3();
@ -172,6 +174,8 @@ namespace OpenSim.Region.Environment.Scenes
private Vector3 m_autoPilotTarget = Vector3.Zero;
private bool m_sitAtAutoTarget = false;
private string m_nextSitAnimation = String.Empty;
// Agent's Draw distance.
protected float m_DrawDistance = 0f;
@ -1323,10 +1327,45 @@ namespace OpenSim.Region.Environment.Scenes
{
StandUp();
}
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_requestedSitOffset = offset;
}
else
{
m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
}
SendSitResponse(remoteClient, targetID, offset);
}
public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
{
if (m_parentID != 0)
{
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)
{
m_requestedSitTargetID = part.LocalId;
@ -1340,6 +1379,18 @@ namespace OpenSim.Region.Environment.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);
@ -1381,7 +1432,7 @@ namespace OpenSim.Region.Environment.Scenes
Velocity = new Vector3(0, 0, 0);
RemoveFromPhysicalScene();
TrySetMovementAnimation("SIT");
TrySetMovementAnimation(sitAnimation);
SendFullUpdateToAllClients();
// This may seem stupid, but Our Full updates don't send avatar rotation :P
// So we're also sending a terse update (which has avatar rotation)
@ -1897,6 +1948,11 @@ namespace OpenSim.Region.Environment.Scenes
SendAppearanceToAllOtherAgents();
SendWearables();
if (!m_startAnimationSet)
{
UpdateMovementAnimations();
m_startAnimationSet = true;
}
}
public void SetWearable(int wearableId, AvatarWearable wearable)