aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-26 17:36:30 +0000
committerTeravus Ovares2008-04-26 17:36:30 +0000
commit323038ceb956fef577ebd83c502cc377bcfe83f9 (patch)
tree926410e63d94006e0d66d9ab24213b9f51519342 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parent* Committing Mantis #1061 - llRegionSay and llSetPrimitiveParams implementati... (diff)
downloadopensim-SC_OLD-323038ceb956fef577ebd83c502cc377bcfe83f9.zip
opensim-SC_OLD-323038ceb956fef577ebd83c502cc377bcfe83f9.tar.gz
opensim-SC_OLD-323038ceb956fef577ebd83c502cc377bcfe83f9.tar.bz2
opensim-SC_OLD-323038ceb956fef577ebd83c502cc377bcfe83f9.tar.xz
* Ooops, attachments now teleport/cross region borders along with your avatar. Those dastardly objects stick to you.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs57
1 files changed, 42 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index fbf0a73..7020eb8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -628,24 +628,39 @@ namespace OpenSim.Region.Environment.Scenes
628 } 628 }
629 629
630 630
631 public void AttachToAgent(LLUUID agentID, uint attachmentpoint) 631 public void AttachToAgent(LLUUID agentID, uint attachmentpoint, LLVector3 AttachOffset)
632 { 632 {
633 ScenePresence avatar = m_scene.GetScenePresence(agentID); 633 ScenePresence avatar = m_scene.GetScenePresence(agentID);
634 if (avatar != null) 634 if (avatar != null)
635 { 635 {
636 DetachFromBackup(this);
636 m_rootPart.m_attachedAvatar = agentID; 637 m_rootPart.m_attachedAvatar = agentID;
637 m_rootPart.SetParentLocalId(avatar.LocalId); 638
638 m_rootPart.SetAttachmentPoint(attachmentpoint); 639
639 m_rootPart.m_IsAttachment = true;
640 if (m_rootPart.PhysActor != null) 640 if (m_rootPart.PhysActor != null)
641 { 641 {
642 m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); 642 m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
643 m_rootPart.PhysActor = null; 643 m_rootPart.PhysActor = null;
644 AbsolutePosition = LLVector3.Zero; 644 AbsolutePosition = AttachOffset;
645 m_rootPart.m_attachedPos = AttachOffset;
645 } 646 }
647 m_rootPart.m_IsAttachment = true;
648
649 m_rootPart.SetParentLocalId(avatar.LocalId);
650 m_rootPart.SetAttachmentPoint(attachmentpoint);
651
652 avatar.AddAttachment(this);
646 m_rootPart.ScheduleFullUpdate(); 653 m_rootPart.ScheduleFullUpdate();
647 } 654 }
648 } 655 }
656 public byte GetAttachmentPoint()
657 {
658 if (m_rootPart != null)
659 {
660 return m_rootPart.Shape.State;
661 }
662 return (byte)0;
663 }
649 664
650 public void DetachToGround() 665 public void DetachToGround()
651 { 666 {
@@ -654,6 +669,7 @@ namespace OpenSim.Region.Environment.Scenes
654 if (avatar != null) 669 if (avatar != null)
655 { 670 {
656 detachedpos = avatar.AbsolutePosition; 671 detachedpos = avatar.AbsolutePosition;
672 avatar.RemoveAttachment(this);
657 } 673 }
658 AbsolutePosition = detachedpos; 674 AbsolutePosition = detachedpos;
659 m_rootPart.m_attachedAvatar = LLUUID.Zero; 675 m_rootPart.m_attachedAvatar = LLUUID.Zero;
@@ -661,6 +677,7 @@ namespace OpenSim.Region.Environment.Scenes
661 m_rootPart.SetAttachmentPoint((byte)0); 677 m_rootPart.SetAttachmentPoint((byte)0);
662 m_rootPart.m_IsAttachment = false; 678 m_rootPart.m_IsAttachment = false;
663 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); 679 m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim);
680 AttachToBackup();
664 m_rootPart.ScheduleFullUpdate(); 681 m_rootPart.ScheduleFullUpdate();
665 } 682 }
666 /// <summary> 683 /// <summary>
@@ -1395,26 +1412,36 @@ namespace OpenSim.Region.Environment.Scenes
1395 1412
1396 lock (m_parts) 1413 lock (m_parts)
1397 { 1414 {
1415 //if (m_rootPart.m_IsAttachment)
1416 //{
1417 //foreach (SceneObjectPart part in m_parts.Values)
1418 //{
1419 //part.SendScheduledUpdates();
1420 //}
1421 //return;
1422 //}
1423
1398 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) 1424 if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
1399 { 1425 {
1400 foreach (SceneObjectPart part in m_parts.Values) 1426 m_rootPart.UpdateFlag = 1;
1401 {
1402 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
1403 }
1404
1405 lastPhysGroupPos = AbsolutePosition; 1427 lastPhysGroupPos = AbsolutePosition;
1406 checkAtTargets();
1407 } 1428 }
1429 //foreach (SceneObjectPart part in m_parts.Values)
1430 //{
1431 //if (part.UpdateFlag == 0) part.UpdateFlag = 1;
1432 //}
1433
1434
1435
1436 checkAtTargets();
1437
1408 1438
1409 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) 1439 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
1410 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) 1440 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
1411 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) 1441 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
1412 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) 1442 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
1413 { 1443 {
1414 foreach (SceneObjectPart part in m_parts.Values) 1444 m_rootPart.UpdateFlag = 1;
1415 {
1416 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
1417 }
1418 1445
1419 lastPhysGroupRot = GroupRotation; 1446 lastPhysGroupRot = GroupRotation;
1420 } 1447 }