aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJeff Ames2007-10-28 03:58:46 +0000
committerJeff Ames2007-10-28 03:58:46 +0000
commit2cf117cc6c2c7cf106fa83785621577a8b713529 (patch)
tree2978d78b209cd891133521e3b7f618af5113e78a /OpenSim/Region/Environment
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 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs93
1 files changed, 77 insertions, 16 deletions
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);