aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs61
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs22
4 files changed, 40 insertions, 92 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a3206015..3cd4a10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -230,27 +230,9 @@ namespace OpenSim.Region.Framework.Scenes
230 if (sp.IsChildAgent) 230 if (sp.IsChildAgent)
231 continue; 231 continue;
232 232
233 if (sp.ParentID != 0) 233 coarseLocations.Add(sp.AbsolutePosition);
234 { 234
235 // sitting avatar 235 avatarUUIDs.Add(sp.UUID);
236 SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
237 if (sop != null)
238 {
239 coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition);
240 avatarUUIDs.Add(sp.UUID);
241 }
242 else
243 {
244 // we can't find the parent.. ! arg!
245 coarseLocations.Add(sp.AbsolutePosition);
246 avatarUUIDs.Add(sp.UUID);
247 }
248 }
249 else
250 {
251 coarseLocations.Add(sp.AbsolutePosition);
252 avatarUUIDs.Add(sp.UUID);
253 }
254 } 236 }
255 } 237 }
256 238
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4190cf6..c4aaebe 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -438,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
438 { 438 {
439 get 439 get
440 { 440 {
441 if (PhysicsActor != null && m_parentID == 0) 441 if (PhysicsActor != null)
442 { 442 {
443 m_pos = PhysicsActor.Position; 443 m_pos = PhysicsActor.Position;
444 444
@@ -461,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
461 // in the sim unless the avatar is on a sit target. While 461 // in the sim unless the avatar is on a sit target. While
462 // on a sit target, m_pos will contain the desired offset 462 // on a sit target, m_pos will contain the desired offset
463 // without the parent rotation applied. 463 // without the parent rotation applied.
464 if (ParentID != 0) 464 SceneObjectPart sitPart = ParentPart;
465 { 465
466 SceneObjectPart part = ParentPart; 466 if (sitPart != null)
467 return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); 467 return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
468 }
469 } 468 }
469
470 return m_pos; 470 return m_pos;
471 } 471 }
472 set 472 set
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
483 } 483 }
484 } 484 }
485 485
486 // Don't update while sitting 486 // Don't update while sitting. The PhysicsActor above is null whilst sitting.
487 if (ParentID == 0) 487 if (ParentID == 0)
488 { 488 {
489 m_pos = value; 489 m_pos = value;
@@ -510,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
510 // There is no offset position when not seated 510 // There is no offset position when not seated
511 if (ParentID == 0) 511 if (ParentID == 0)
512 return; 512 return;
513
513 m_pos = value; 514 m_pos = value;
514 } 515 }
515 } 516 }
@@ -568,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
568 569
569 public bool IsChildAgent { get; set; } 570 public bool IsChildAgent { get; set; }
570 571
571 public uint ParentID 572 /// <summary>
572 { 573 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
573 get { return m_parentID; } 574 /// </summary>
574 set { m_parentID = value; } 575 public uint ParentID { get; set; }
575 }
576 private uint m_parentID;
577 576
578 public UUID ParentUUID 577 public UUID ParentUUID
579 { 578 {
@@ -582,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
582 } 581 }
583 private UUID m_parentUUID = UUID.Zero; 582 private UUID m_parentUUID = UUID.Zero;
584 583
585 public SceneObjectPart ParentPart 584 /// <summary>
586 { 585 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
587 get { return m_parentPart; } 586 /// </summary>
588 set { m_parentPart = value; } 587 /// <remarks>
589 } 588 /// If you use this property then you must take a reference since another thread could set it to null.
590 private SceneObjectPart m_parentPart = null; 589 /// </remarks>
590 public SceneObjectPart ParentPart { get; set; }
591 591
592 public float Health 592 public float Health
593 { 593 {
@@ -2285,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2287 } 2287 }
2288 }
2289 else
2290 {
2291 return;
2292 }
2293
2294 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2295 if (ParentPart == null)
2296 return;
2297 2288
2298 ParentID = m_requestedSitTargetID; 2289 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2290 ParentID = m_requestedSitTargetID;
2299 2291
2300 Velocity = Vector3.Zero; 2292 Velocity = Vector3.Zero;
2301 RemoveFromPhysicalScene(); 2293 RemoveFromPhysicalScene();
2302 2294
2303 Animator.TrySetMovementAnimation(sitAnimation); 2295 Animator.TrySetMovementAnimation(sitAnimation);
2304 SendAvatarDataToAllAgents(); 2296 SendAvatarDataToAllAgents();
2297 }
2305 } 2298 }
2306 2299
2307 public void HandleAgentSitOnGround() 2300 public void HandleAgentSitOnGround()
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 3c36943..9d52a8f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -630,33 +630,16 @@ namespace OpenSim.Region.RegionCombinerModule
630 630
631 List<Vector3> CoarseLocations = new List<Vector3>(); 631 List<Vector3> CoarseLocations = new List<Vector3>();
632 List<UUID> AvatarUUIDs = new List<UUID>(); 632 List<UUID> AvatarUUIDs = new List<UUID>();
633
633 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) 634 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
634 { 635 {
635 if (sp.UUID != presence.UUID) 636 if (sp.UUID != presence.UUID)
636 { 637 {
637 if (sp.ParentID != 0) 638 CoarseLocations.Add(sp.AbsolutePosition);
638 { 639 AvatarUUIDs.Add(sp.UUID);
639 // sitting avatar
640 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
641 if (sop != null)
642 {
643 CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
644 AvatarUUIDs.Add(sp.UUID);
645 }
646 else
647 {
648 // we can't find the parent.. ! arg!
649 CoarseLocations.Add(sp.AbsolutePosition);
650 AvatarUUIDs.Add(sp.UUID);
651 }
652 }
653 else
654 {
655 CoarseLocations.Add(sp.AbsolutePosition);
656 AvatarUUIDs.Add(sp.UUID);
657 }
658 } 640 }
659 }); 641 });
642
660 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence); 643 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
661 } 644 }
662 645
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6d4072c..e2d17a7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4213 List<String> nametable = new List<String>(); 4213 List<String> nametable = new List<String>();
4214 World.ForEachRootScenePresence(delegate(ScenePresence presence) 4214 World.ForEachRootScenePresence(delegate(ScenePresence presence)
4215 { 4215 {
4216 if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) 4216 SceneObjectPart sitPart = presence.ParentPart;
4217 if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
4217 nametable.Add(presence.ControllingClient.Name); 4218 nametable.Add(presence.ControllingClient.Name);
4218 }); 4219 });
4219 4220
@@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4844 4845
4845 // Find pushee position 4846 // Find pushee position
4846 // Pushee Linked? 4847 // Pushee Linked?
4847 if (pusheeav.ParentID != 0) 4848 SceneObjectPart sitPart = pusheeav.ParentPart;
4848 { 4849 if (sitPart != null)
4849 SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); 4850 PusheePos = sitPart.AbsolutePosition;
4850 if (parentobj != null)
4851 {
4852 PusheePos = parentobj.AbsolutePosition;
4853 }
4854 else
4855 {
4856 PusheePos = pusheeav.AbsolutePosition;
4857 }
4858 }
4859 else 4851 else
4860 {
4861 PusheePos = pusheeav.AbsolutePosition; 4852 PusheePos = pusheeav.AbsolutePosition;
4862 }
4863 } 4853 }
4864 4854
4865 if (!pusheeIsAvatar) 4855 if (!pusheeIsAvatar)
@@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6067 flags |= ScriptBaseClass.AGENT_IN_AIR; 6057 flags |= ScriptBaseClass.AGENT_IN_AIR;
6068 } 6058 }
6069 6059
6070 if (agent.ParentID != 0) 6060 if (agent.ParentPart != null)
6071 { 6061 {
6072 flags |= ScriptBaseClass.AGENT_ON_OBJECT; 6062 flags |= ScriptBaseClass.AGENT_ON_OBJECT;
6073 flags |= ScriptBaseClass.AGENT_SITTING; 6063 flags |= ScriptBaseClass.AGENT_SITTING;