aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJeff Ames2007-10-28 03:58:46 +0000
committerJeff Ames2007-10-28 03:58:46 +0000
commit2cf117cc6c2c7cf106fa83785621577a8b713529 (patch)
tree2978d78b209cd891133521e3b7f618af5113e78a
parent*Replaced -useexecutepath with an updated -inifile extension. You can now spe... (diff)
downloadopensim-SC_OLD-2cf117cc6c2c7cf106fa83785621577a8b713529.zip
opensim-SC_OLD-2cf117cc6c2c7cf106fa83785621577a8b713529.tar.gz
opensim-SC_OLD-2cf117cc6c2c7cf106fa83785621577a8b713529.tar.bz2
opensim-SC_OLD-2cf117cc6c2c7cf106fa83785621577a8b713529.tar.xz
Added preliminary support for sitting on prims
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs6
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs18
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs93
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs4
-rw-r--r--bin/data/avataranimations.xml3
6 files changed, 120 insertions, 20 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 0dad91f..7cb18e5 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -169,6 +169,8 @@ namespace OpenSim.Framework.Interfaces
169 public delegate void StatusChange(bool status); 169 public delegate void StatusChange(bool status);
170 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 170 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
171 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 171 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
172 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID);
173 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
172 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); 174 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
173 175
174 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); 176 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
217 event GenericCall OnRequestWearables; 219 event GenericCall OnRequestWearables;
218 event GenericCall2 OnCompleteMovementToRegion; 220 event GenericCall2 OnCompleteMovementToRegion;
219 event UpdateAgent OnAgentUpdate; 221 event UpdateAgent OnAgentUpdate;
222 event AgentRequestSit OnAgentRequestSit;
223 event AgentSit OnAgentSit;
220 event GenericCall OnRequestAvatarsData; 224 event GenericCall OnRequestAvatarsData;
221 event AddNewPrim OnAddPrim; 225 event AddNewPrim OnAddPrim;
222 event ObjectDuplicate OnObjectDuplicate; 226 event ObjectDuplicate OnObjectDuplicate;
@@ -321,7 +325,7 @@ namespace OpenSim.Framework.Interfaces
321 void SendTeleportLocationStart(); 325 void SendTeleportLocationStart();
322 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); 326 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
323 327
324 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry); 328 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID);
325 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); 329 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation);
326 void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); 330 void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
327 331
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index a1e4b56..74f1824 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -54,6 +54,8 @@ namespace OpenSim.Region.ClientStack
54 public event SetAppearance OnSetAppearance; 54 public event SetAppearance OnSetAppearance;
55 public event GenericCall2 OnCompleteMovementToRegion; 55 public event GenericCall2 OnCompleteMovementToRegion;
56 public event UpdateAgent OnAgentUpdate; 56 public event UpdateAgent OnAgentUpdate;
57 public event AgentRequestSit OnAgentRequestSit;
58 public event AgentSit OnAgentSit;
57 public event StartAnim OnStartAnim; 59 public event StartAnim OnStartAnim;
58 public event GenericCall OnRequestAvatarsData; 60 public event GenericCall OnRequestAvatarsData;
59 public event LinkObjects OnLinkObjects; 61 public event LinkObjects OnLinkObjects;
@@ -807,6 +809,19 @@ namespace OpenSim.Region.ClientStack
807 avatarReply.PropertiesData.PartnerID = partnerID; 809 avatarReply.PropertiesData.PartnerID = partnerID;
808 OutPacket(avatarReply); 810 OutPacket(avatarReply);
809 } 811 }
812
813 public void SendSitResponse(LLUUID targetID, LLVector3 offset)
814 {
815 AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
816
817 avatarSitResponse.SitObject.ID = targetID;
818
819 avatarSitResponse.SitTransform.AutoPilot = true;
820 avatarSitResponse.SitTransform.SitPosition = offset;
821 avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f);
822
823 OutPacket(avatarSitResponse);
824 }
810 #endregion 825 #endregion
811 826
812 #region Appearance/ Wearables Methods 827 #region Appearance/ Wearables Methods
@@ -889,7 +904,7 @@ namespace OpenSim.Region.ClientStack
889 /// <param name="avatarID"></param> 904 /// <param name="avatarID"></param>
890 /// <param name="avatarLocalID"></param> 905 /// <param name="avatarLocalID"></param>
891 /// <param name="Pos"></param> 906 /// <param name="Pos"></param>
892 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) 907 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
893 { 908 {
894 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 909 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
895 objupdate.RegionData.RegionHandle = regionHandle; 910 objupdate.RegionData.RegionHandle = regionHandle;
@@ -900,6 +915,7 @@ namespace OpenSim.Region.ClientStack
900 //give this avatar object a local id and assign the user a name 915 //give this avatar object a local id and assign the user a name
901 objupdate.ObjectData[0].ID = avatarLocalID; 916 objupdate.ObjectData[0].ID = avatarLocalID;
902 objupdate.ObjectData[0].FullID = avatarID; 917 objupdate.ObjectData[0].FullID = avatarID;
918 objupdate.ObjectData[0].ParentID = parentID;
903 objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); 919 objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
904 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); 920 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
905 byte[] pb = pos2.GetBytes(); 921 byte[] pb = pos2.GetBytes();
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 05b1118..65a0e44 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework.Inventory;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Region.Environment.Scenes;
37 38
38namespace OpenSim.Region.ClientStack 39namespace OpenSim.Region.ClientStack
39{ 40{
@@ -198,6 +199,21 @@ namespace OpenSim.Region.ClientStack
198 } 199 }
199 } 200 }
200 break; 201 break;
202 case PacketType.AgentRequestSit:
203 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
204 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
205 if (OnAgentRequestSit != null)
206 {
207 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID);
208 }
209 break;
210 case PacketType.AgentSit:
211 if (OnAgentSit != null)
212 {
213 AgentSitPacket agentSit = (AgentSitPacket) Pack;
214 OnAgentSit(this, agentSit.AgentData.AgentID);
215 }
216 break;
201 217
202 #endregion 218 #endregion
203 219
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 256b6b5..716aaa6 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Region.Environment.Scenes
51 private byte m_movementflag = 0; 51 private byte m_movementflag = 0;
52 private readonly List<NewForce> m_forcesList = new List<NewForce>(); 52 private readonly List<NewForce> m_forcesList = new List<NewForce>();
53 private short m_updateCount = 0; 53 private short m_updateCount = 0;
54 private uint m_requestedSitTargetID = 0;
54 55
55 private Quaternion bodyRot; 56 private Quaternion bodyRot;
56 private byte[] m_visualParams; 57 private byte[] m_visualParams;
@@ -216,6 +217,13 @@ namespace OpenSim.Region.Environment.Scenes
216 set { m_isChildAgent = value; } 217 set { m_isChildAgent = value; }
217 } 218 }
218 219
220 private uint m_parentID = 0;
221 public uint ParentID
222 {
223 get { return m_parentID; }
224 set { m_parentID = value; }
225 }
226
219 #endregion 227 #endregion
220 228
221 #region Constructor(s) 229 #region Constructor(s)
@@ -245,6 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
245 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 253 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
246 m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 254 m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
247 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 255 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
256 m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
257 m_controllingClient.OnAgentSit += HandleAgentSit;
248 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 258 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
249 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 259 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
250 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 260 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -454,33 +464,44 @@ namespace OpenSim.Region.Environment.Scenes
454 update_movementflag = true; 464 update_movementflag = true;
455 } 465 }
456 466
467 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
468 {
469 StandUp();
470 update_movementflag = true;
471 }
472
457 if (q != bodyRot) 473 if (q != bodyRot)
458 { 474 {
459 bodyRot = q; 475 bodyRot = q;
460 update_rotation = true; 476 update_rotation = true;
461 } 477 }
462 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 478
479 if (m_parentID == 0)
463 { 480 {
464 if ((flags & (uint)DCF) != 0) 481 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
465 { 482 {
466 DCFlagKeyPressed = true; 483 if ((flags & (uint)DCF) != 0)
467 agent_control_v3 += Dir_Vectors[i];
468 if ((m_movementflag & (uint)DCF) == 0)
469 { 484 {
470 m_movementflag += (byte)(uint)DCF; 485 DCFlagKeyPressed = true;
471 update_movementflag = true; 486 agent_control_v3 += Dir_Vectors[i];
487 if ((m_movementflag & (uint)DCF) == 0)
488 {
489 m_movementflag += (byte)(uint)DCF;
490 update_movementflag = true;
491 }
472 } 492 }
473 } 493 else
474 else
475 {
476 if ((m_movementflag & (uint)DCF) != 0)
477 { 494 {
478 m_movementflag -= (byte)(uint)DCF; 495 if ((m_movementflag & (uint)DCF) != 0)
479 update_movementflag = true; 496 {
497 m_movementflag -= (byte)(uint)DCF;
498 update_movementflag = true;
499 }
480 } 500 }
501 i++;
481 } 502 }
482 i++;
483 } 503 }
504
484 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 505 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
485 { 506 {
486 AddNewMovement(agent_control_v3, q); 507 AddNewMovement(agent_control_v3, q);
@@ -488,6 +509,46 @@ namespace OpenSim.Region.Environment.Scenes
488 UpdateMovementAnimations(update_movementflag); 509 UpdateMovementAnimations(update_movementflag);
489 } 510 }
490 511
512 protected void StandUp()
513 {
514 if (m_parentID != 0)
515 {
516 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
517 if (part != null)
518 AbsolutePosition = part.AbsolutePosition;
519 m_parentID = 0;
520 SendFullUpdateToAllClients();
521 }
522 }
523
524 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID)
525 {
526 if (m_parentID != 0)
527 {
528 StandUp();
529 UpdateMovementAnimations(true);
530 }
531
532 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
533
534 if (part != null)
535 {
536 m_requestedSitTargetID = part.LocalID;
537 }
538 else
539 {
540 MainLog.Instance.Warn("Sit requested on unknown object: " + targetID.ToString());
541 }
542 }
543
544 public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
545 {
546 AbsolutePosition = new LLVector3(0F, 0F, 0F);
547 m_parentID = m_requestedSitTargetID;
548 SendAnimPack(Animations.AnimsLLUUID["SIT"], 1);
549 SendFullUpdateToAllClients();
550 }
551
491 protected void UpdateMovementAnimations(bool update_movementflag) 552 protected void UpdateMovementAnimations(bool update_movementflag)
492 { 553 {
493 if (update_movementflag) 554 if (update_movementflag)
@@ -641,7 +702,7 @@ namespace OpenSim.Region.Environment.Scenes
641 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 702 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
642 { 703 {
643 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, 704 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
644 LocalId, AbsolutePosition, m_textureEntry.ToBytes()); 705 LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID);
645 } 706 }
646 707
647 public void SendFullUpdateToAllClients() 708 public void SendFullUpdateToAllClients()
@@ -667,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes
667 public void SendInitialData() 728 public void SendInitialData()
668 { 729 {
669 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, 730 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
670 AbsolutePosition, m_textureEntry.ToBytes()); 731 AbsolutePosition, m_textureEntry.ToBytes(), m_parentID);
671 if (!m_isChildAgent) 732 if (!m_isChildAgent)
672 { 733 {
673 m_scene.InformClientOfNeighbours(m_controllingClient); 734 m_scene.InformClientOfNeighbours(m_controllingClient);
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 1460b81..7962698 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -68,6 +68,8 @@ namespace SimpleApp
68 public event GenericCall OnRequestWearables; 68 public event GenericCall OnRequestWearables;
69 public event GenericCall2 OnCompleteMovementToRegion; 69 public event GenericCall2 OnCompleteMovementToRegion;
70 public event UpdateAgent OnAgentUpdate; 70 public event UpdateAgent OnAgentUpdate;
71 public event AgentRequestSit OnAgentRequestSit;
72 public event AgentSit OnAgentSit;
71 public event GenericCall OnRequestAvatarsData; 73 public event GenericCall OnRequestAvatarsData;
72 public event AddNewPrim OnAddPrim; 74 public event AddNewPrim OnAddPrim;
73 public event ObjectDuplicate OnObjectDuplicate; 75 public event ObjectDuplicate OnObjectDuplicate;
@@ -179,7 +181,7 @@ namespace SimpleApp
179 public virtual void SendTeleportLocationStart() { } 181 public virtual void SendTeleportLocationStart() { }
180 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 182 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
181 183
182 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } 184 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { }
183 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } 185 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { }
184 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } 186 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { }
185 187
diff --git a/bin/data/avataranimations.xml b/bin/data/avataranimations.xml
index 8a98c62..9995311 100644
--- a/bin/data/avataranimations.xml
+++ b/bin/data/avataranimations.xml
@@ -7,4 +7,5 @@
7 <animation name="STAND">2408fe9e-df1d-1d7d-f4ff-1384fa7b350f</animation> 7 <animation name="STAND">2408fe9e-df1d-1d7d-f4ff-1384fa7b350f</animation>
8 <animation name="WALK">6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0</animation> 8 <animation name="WALK">6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0</animation>
9 <animation name="FLY">aec4610c-757f-bc4e-c092-c6e9caf18daf</animation> 9 <animation name="FLY">aec4610c-757f-bc4e-c092-c6e9caf18daf</animation>
10</animations> \ No newline at end of file 10 <animation name="SIT">1a5fe8ac-a804-8a5d-7cbd-56bd83184568</animation>
11</animations>