Added preliminary support for sitting on prims
							parent
							
								
									d56da1c831
								
							
						
					
					
						commit
						2cf117cc6c
					
				|  | @ -169,6 +169,8 @@ namespace OpenSim.Framework.Interfaces | |||
|     public delegate void StatusChange(bool status); | ||||
|     public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); | ||||
|     public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); | ||||
|     public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); | ||||
|     public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); | ||||
|     public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); | ||||
| 
 | ||||
|     public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); | ||||
|  | @ -217,6 +219,8 @@ namespace OpenSim.Framework.Interfaces | |||
|         event GenericCall OnRequestWearables; | ||||
|         event GenericCall2 OnCompleteMovementToRegion; | ||||
|         event UpdateAgent OnAgentUpdate; | ||||
|         event AgentRequestSit OnAgentRequestSit; | ||||
|         event AgentSit OnAgentSit; | ||||
|         event GenericCall OnRequestAvatarsData; | ||||
|         event AddNewPrim OnAddPrim; | ||||
|         event ObjectDuplicate OnObjectDuplicate; | ||||
|  | @ -321,7 +325,7 @@ namespace OpenSim.Framework.Interfaces | |||
|         void SendTeleportLocationStart(); | ||||
|         void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); | ||||
| 
 | ||||
|         void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry); | ||||
|         void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID); | ||||
|         void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); | ||||
|         void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); | ||||
| 
 | ||||
|  |  | |||
|  | @ -54,6 +54,8 @@ namespace OpenSim.Region.ClientStack | |||
|         public event SetAppearance OnSetAppearance; | ||||
|         public event GenericCall2 OnCompleteMovementToRegion; | ||||
|         public event UpdateAgent OnAgentUpdate; | ||||
|         public event AgentRequestSit OnAgentRequestSit; | ||||
|         public event AgentSit OnAgentSit; | ||||
|         public event StartAnim OnStartAnim; | ||||
|         public event GenericCall OnRequestAvatarsData; | ||||
|         public event LinkObjects OnLinkObjects; | ||||
|  | @ -807,6 +809,19 @@ namespace OpenSim.Region.ClientStack | |||
|             avatarReply.PropertiesData.PartnerID = partnerID; | ||||
|             OutPacket(avatarReply); | ||||
|         } | ||||
| 
 | ||||
|         public void SendSitResponse(LLUUID targetID, LLVector3 offset) | ||||
|         { | ||||
|             AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); | ||||
| 
 | ||||
|             avatarSitResponse.SitObject.ID = targetID; | ||||
| 
 | ||||
|             avatarSitResponse.SitTransform.AutoPilot = true; | ||||
|             avatarSitResponse.SitTransform.SitPosition = offset; | ||||
|             avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f); | ||||
| 
 | ||||
|             OutPacket(avatarSitResponse); | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|         #region Appearance/ Wearables Methods | ||||
|  | @ -889,7 +904,7 @@ namespace OpenSim.Region.ClientStack | |||
|         /// <param name="avatarID"></param> | ||||
|         /// <param name="avatarLocalID"></param> | ||||
|         /// <param name="Pos"></param> | ||||
|         public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) | ||||
|         public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | ||||
|         { | ||||
|             ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||||
|             objupdate.RegionData.RegionHandle = regionHandle; | ||||
|  | @ -900,6 +915,7 @@ namespace OpenSim.Region.ClientStack | |||
|             //give this avatar object a local id and assign the user a name | ||||
|             objupdate.ObjectData[0].ID = avatarLocalID; | ||||
|             objupdate.ObjectData[0].FullID = avatarID; | ||||
|             objupdate.ObjectData[0].ParentID = parentID; | ||||
|             objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); | ||||
|             LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | ||||
|             byte[] pb = pos2.GetBytes(); | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ using OpenSim.Framework.Inventory; | |||
| using OpenSim.Framework.Types; | ||||
| using OpenSim.Framework.Utilities; | ||||
| using OpenSim.Framework.Interfaces; | ||||
| using OpenSim.Region.Environment.Scenes; | ||||
| 
 | ||||
| namespace OpenSim.Region.ClientStack | ||||
| { | ||||
|  | @ -198,6 +199,21 @@ namespace OpenSim.Region.ClientStack | |||
|                             } | ||||
|                         } | ||||
|                         break; | ||||
|                     case PacketType.AgentRequestSit: | ||||
|                         AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; | ||||
|                         SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); | ||||
|                         if (OnAgentRequestSit != null) | ||||
|                         { | ||||
|                             OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID); | ||||
|                         } | ||||
|                         break; | ||||
|                     case PacketType.AgentSit: | ||||
|                         if (OnAgentSit != null) | ||||
|                         { | ||||
|                             AgentSitPacket agentSit = (AgentSitPacket) Pack; | ||||
|                             OnAgentSit(this, agentSit.AgentData.AgentID); | ||||
|                         } | ||||
|                         break; | ||||
| 
 | ||||
|                     #endregion | ||||
| 
 | ||||
|  |  | |||
|  | @ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
|         private byte m_movementflag = 0; | ||||
|         private readonly List<NewForce> m_forcesList = new List<NewForce>(); | ||||
|         private short m_updateCount = 0; | ||||
|         private uint m_requestedSitTargetID = 0; | ||||
| 
 | ||||
|         private Quaternion bodyRot; | ||||
|         private byte[] m_visualParams; | ||||
|  | @ -216,6 +217,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
|             set { m_isChildAgent = value; } | ||||
|         } | ||||
| 
 | ||||
|         private uint m_parentID = 0; | ||||
|         public uint ParentID | ||||
|         { | ||||
|             get { return m_parentID; } | ||||
|             set { m_parentID = value; } | ||||
|         } | ||||
| 
 | ||||
|         #endregion | ||||
| 
 | ||||
|         #region Constructor(s) | ||||
|  | @ -245,6 +253,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
|             m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | ||||
|             m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | ||||
|             m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | ||||
|             m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; | ||||
|             m_controllingClient.OnAgentSit += HandleAgentSit; | ||||
|             // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | ||||
|             // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | ||||
|             //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | ||||
|  | @ -454,11 +464,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
|                 update_movementflag = true; | ||||
|             } | ||||
| 
 | ||||
|             if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | ||||
|             { | ||||
|                 StandUp(); | ||||
|                 update_movementflag = true; | ||||
|             } | ||||
| 
 | ||||
|             if (q != bodyRot) | ||||
|             { | ||||
|                 bodyRot = q; | ||||
|                 update_rotation = true; | ||||
|             } | ||||
| 
 | ||||
|             if (m_parentID == 0) | ||||
|             { | ||||
|                 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) | ||||
|                 { | ||||
|                     if ((flags & (uint)DCF) != 0) | ||||
|  | @ -481,6 +500,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
|                     } | ||||
|                     i++; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) | ||||
|             { | ||||
|                 AddNewMovement(agent_control_v3, q); | ||||
|  | @ -488,6 +509,46 @@ namespace OpenSim.Region.Environment.Scenes | |||
|             UpdateMovementAnimations(update_movementflag); | ||||
|         } | ||||
| 
 | ||||
|         protected void StandUp() | ||||
|         { | ||||
|             if (m_parentID != 0) | ||||
|             { | ||||
|                 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | ||||
|                 if (part != null) | ||||
|                     AbsolutePosition = part.AbsolutePosition; | ||||
|                 m_parentID = 0; | ||||
|                 SendFullUpdateToAllClients(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID) | ||||
|         { | ||||
|             if (m_parentID != 0) | ||||
|             { | ||||
|                 StandUp(); | ||||
|                 UpdateMovementAnimations(true); | ||||
|             } | ||||
| 
 | ||||
|             SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | ||||
| 
 | ||||
|             if (part != null) | ||||
|             { | ||||
|                 m_requestedSitTargetID = part.LocalID; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID) | ||||
|         { | ||||
|             AbsolutePosition = new LLVector3(0F, 0F, 0F); | ||||
|             m_parentID = m_requestedSitTargetID; | ||||
|             SendAnimPack(Animations.AnimsLLUUID["SIT"], 1); | ||||
|             SendFullUpdateToAllClients(); | ||||
|         } | ||||
| 
 | ||||
|         protected void UpdateMovementAnimations(bool update_movementflag) | ||||
|         { | ||||
|             if (update_movementflag) | ||||
|  | @ -641,7 +702,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
|         public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | ||||
|         { | ||||
|             remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | ||||
|                                                           LocalId, AbsolutePosition, m_textureEntry.ToBytes()); | ||||
|                                                             LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); | ||||
|         } | ||||
| 
 | ||||
|         public void SendFullUpdateToAllClients() | ||||
|  | @ -667,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
|         public void SendInitialData() | ||||
|         { | ||||
|             m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, | ||||
|                                              AbsolutePosition, m_textureEntry.ToBytes()); | ||||
|                                                AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); | ||||
|             if (!m_isChildAgent) | ||||
|             { | ||||
|                 m_scene.InformClientOfNeighbours(m_controllingClient); | ||||
|  |  | |||
|  | @ -68,6 +68,8 @@ namespace SimpleApp | |||
|         public event GenericCall OnRequestWearables; | ||||
|         public event GenericCall2 OnCompleteMovementToRegion; | ||||
|         public event UpdateAgent OnAgentUpdate; | ||||
|         public event AgentRequestSit OnAgentRequestSit; | ||||
|         public event AgentSit OnAgentSit; | ||||
|         public event GenericCall OnRequestAvatarsData; | ||||
|         public event AddNewPrim OnAddPrim; | ||||
|         public event ObjectDuplicate OnObjectDuplicate; | ||||
|  | @ -179,7 +181,7 @@ namespace SimpleApp | |||
|         public virtual void SendTeleportLocationStart() { } | ||||
|         public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } | ||||
| 
 | ||||
|         public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } | ||||
|         public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { } | ||||
|         public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } | ||||
|         public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,4 +7,5 @@ | |||
| 	<animation name="STAND">2408fe9e-df1d-1d7d-f4ff-1384fa7b350f</animation> | ||||
| 	<animation name="WALK">6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0</animation> | ||||
| 	<animation name="FLY">aec4610c-757f-bc4e-c092-c6e9caf18daf</animation> | ||||
| 	<animation name="SIT">1a5fe8ac-a804-8a5d-7cbd-56bd83184568</animation> | ||||
| </animations> | ||||
		Loading…
	
		Reference in New Issue
	
	 Jeff Ames
						Jeff Ames