From 1c2a0c78d9a7feb96dd1366755d588d03b92fd36 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 4 Nov 2008 16:39:28 +0000 Subject: 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 --- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 60 +++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index d75d8a9..1466778 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -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,17 +1327,52 @@ namespace OpenSim.Region.Environment.Scenes { StandUp(); } + m_nextSitAnimation = "SIT"; //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); - SceneObjectPart part = FindNextAvailableSitTarget(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; + m_requestedSitOffset = offset; + } + else + { m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); } SendSitResponse(remoteClient, targetID, offset); @@ -1341,6 +1380,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); if (m_sitAtAutoTarget || !m_autopilotMoving) @@ -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) -- cgit v1.1