aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie Thielker2010-08-08 02:04:37 +0200
committerMelanie Thielker2010-08-08 02:04:37 +0200
commitd2b3d45d7606ff863181c4c0a129f6289451abbc (patch)
tree6b04601ce7c6de1f98c4813dd7359b2458aab4c4 /OpenSim/Region/Framework
parentIn my crusade against facelights, I am striking the killing blow. Add a (diff)
parentIncrease sit distance to 256 meters, but leave the initial autopilot process ... (diff)
downloadopensim-SC-d2b3d45d7606ff863181c4c0a129f6289451abbc.zip
opensim-SC-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.gz
opensim-SC-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.bz2
opensim-SC-d2b3d45d7606ff863181c4c0a129f6289451abbc.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs199
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
3 files changed, 129 insertions, 110 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a828127..0d15cb4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -317,8 +317,8 @@ namespace OpenSim.Region.Framework.Scenes
317 private bool m_scriptListens_notAtTarget = false; 317 private bool m_scriptListens_notAtTarget = false;
318 318
319 private bool m_scriptListens_atRotTarget = false; 319 private bool m_scriptListens_atRotTarget = false;
320 private bool m_scriptListens_notAtRotTarget = false; 320 private bool m_scriptListens_notAtRotTarget = false;
321 321 public bool m_dupeInProgress = false;
322 internal Dictionary<UUID, string> m_savedScriptState = null; 322 internal Dictionary<UUID, string> m_savedScriptState = null;
323 323
324 #region Properties 324 #region Properties
@@ -475,16 +475,21 @@ namespace OpenSim.Region.Framework.Scenes
475 { 475 {
476 part.IgnoreUndoUpdate = false; 476 part.IgnoreUndoUpdate = false;
477 part.StoreUndoState(UndoType.STATE_GROUP_POSITION); 477 part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
478 part.GroupPosition = val; 478 part.GroupPosition = val;
479 part.TriggerScriptChangedEvent(Changed.POSITION); 479 if (!m_dupeInProgress)
480 } 480 {
481 481 part.TriggerScriptChangedEvent(Changed.POSITION);
482 foreach (ScenePresence av in m_linkedAvatars) 482 }
483 { 483 }
484 Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; 484 if (!m_dupeInProgress)
485 av.AbsolutePosition += offset; 485 {
486 av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition 486 foreach (ScenePresence av in m_linkedAvatars)
487 av.SendFullUpdateToAllClients(); 487 {
488 Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition;
489 av.AbsolutePosition += offset;
490 av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
491 av.SendFullUpdateToAllClients();
492 }
488 } 493 }
489 494
490 //if (m_rootPart.PhysActor != null) 495 //if (m_rootPart.PhysActor != null)
@@ -1800,88 +1805,96 @@ namespace OpenSim.Region.Framework.Scenes
1800 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> 1805 /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
1801 /// <returns></returns> 1806 /// <returns></returns>
1802 public SceneObjectGroup Copy(bool userExposed) 1807 public SceneObjectGroup Copy(bool userExposed)
1803 { 1808 {
1804 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1809 SceneObjectGroup dupe;
1805 dupe.m_isBackedUp = false; 1810 try
1806 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); 1811 {
1807 1812 m_dupeInProgress = true;
1808 // Warning, The following code related to previousAttachmentStatus is needed so that clones of 1813 dupe = (SceneObjectGroup)MemberwiseClone();
1809 // attachments do not bordercross while they're being duplicated. This is hacktastic! 1814 dupe.m_isBackedUp = false;
1810 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! 1815 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
1811 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state 1816
1812 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, 1817 // Warning, The following code related to previousAttachmentStatus is needed so that clones of
1813 // then restore it's attachment state 1818 // attachments do not bordercross while they're being duplicated. This is hacktastic!
1814 1819 // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!
1815 // This is only necessary when userExposed is false! 1820 // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state
1816 1821 // (which should be false anyway) set it as an Attachment and then set it's Absolute Position,
1817 bool previousAttachmentStatus = dupe.RootPart.IsAttachment; 1822 // then restore it's attachment state
1818 1823
1819 if (!userExposed) 1824 // This is only necessary when userExposed is false!
1820 dupe.RootPart.IsAttachment = true; 1825
1821 1826 bool previousAttachmentStatus = dupe.RootPart.IsAttachment;
1822 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1827
1823 1828 if (!userExposed)
1824 if (!userExposed) 1829 dupe.RootPart.IsAttachment = true;
1825 { 1830
1826 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1831 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1827 } 1832
1828 1833 if (!userExposed)
1829 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1834 {
1830 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1835 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1831 1836 }
1832 if (userExposed) 1837
1833 dupe.m_rootPart.TrimPermissions(); 1838 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1834 1839 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1835 /// may need to create a new Physics actor. 1840
1836 if (dupe.RootPart.PhysActor != null && userExposed) 1841 if (userExposed)
1837 { 1842 dupe.m_rootPart.TrimPermissions();
1838 PrimitiveBaseShape pbs = dupe.RootPart.Shape; 1843
1839 1844 /// may need to create a new Physics actor.
1840 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( 1845 if (dupe.RootPart.PhysActor != null && userExposed)
1841 dupe.RootPart.Name, 1846 {
1842 pbs, 1847 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
1843 dupe.RootPart.AbsolutePosition, 1848
1844 dupe.RootPart.Scale, 1849 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1845 dupe.RootPart.RotationOffset, 1850 dupe.RootPart.Name,
1846 dupe.RootPart.PhysActor.IsPhysical); 1851 pbs,
1847 1852 dupe.RootPart.AbsolutePosition,
1848 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; 1853 dupe.RootPart.Scale,
1849 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 1854 dupe.RootPart.RotationOffset,
1855 dupe.RootPart.PhysActor.IsPhysical);
1856
1857 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
1858 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1859 }
1860
1861 List<SceneObjectPart> partList;
1862
1863 lockPartsForRead(true);
1864
1865 partList = new List<SceneObjectPart>(m_parts.Values);
1866
1867 lockPartsForRead(false);
1868
1869 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
1870 {
1871 return p1.LinkNum.CompareTo(p2.LinkNum);
1872 }
1873 );
1874
1875 foreach (SceneObjectPart part in partList)
1876 {
1877 if (part.UUID != m_rootPart.UUID)
1878 {
1879 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1880
1881 newPart.LinkNum = part.LinkNum;
1882 }
1883 }
1884
1885 if (userExposed)
1886 {
1887 dupe.UpdateParentIDs();
1888 dupe.HasGroupChanged = true;
1889 dupe.AttachToBackup();
1890
1891 ScheduleGroupForFullUpdate();
1892 }
1893 }
1894 finally
1895 {
1896 m_dupeInProgress = false;
1850 } 1897 }
1851
1852 List<SceneObjectPart> partList;
1853
1854 lockPartsForRead(true);
1855
1856 partList = new List<SceneObjectPart>(m_parts.Values);
1857
1858 lockPartsForRead(false);
1859
1860 partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
1861 {
1862 return p1.LinkNum.CompareTo(p2.LinkNum);
1863 }
1864 );
1865
1866 foreach (SceneObjectPart part in partList)
1867 {
1868 if (part.UUID != m_rootPart.UUID)
1869 {
1870 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1871
1872 newPart.LinkNum = part.LinkNum;
1873 }
1874 }
1875
1876 if (userExposed)
1877 {
1878 dupe.UpdateParentIDs();
1879 dupe.HasGroupChanged = true;
1880 dupe.AttachToBackup();
1881
1882 ScheduleGroupForFullUpdate();
1883 }
1884
1885 return dupe; 1898 return dupe;
1886 } 1899 }
1887 1900
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b0ce450..77581af 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -718,17 +718,20 @@ namespace OpenSim.Region.Framework.Scenes
718 718
719 // Tell the physics engines that this prim changed. 719 // Tell the physics engines that this prim changed.
720 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 720 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
721 } 721 }
722 722
723 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); 723 if (!m_parentGroup.m_dupeInProgress)
724 foreach (ScenePresence av in avs) 724 {
725 { 725 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
726 if (av.LinkedPrim == m_uuid) 726 foreach (ScenePresence av in avs)
727 { 727 {
728 Vector3 offset = (m_offsetPosition - oldpos); 728 if (av.LinkedPrim == m_uuid)
729 av.OffsetPosition += offset; 729 {
730 av.SendFullUpdateToAllClients(); 730 Vector3 offset = (m_offsetPosition - oldpos);
731 } 731 av.OffsetPosition += offset;
732 av.SendFullUpdateToAllClients();
733 }
734 }
732 } 735 }
733 } 736 }
734 TriggerScriptChangedEvent(Changed.POSITION); 737 TriggerScriptChangedEvent(Changed.POSITION);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 56e7e93..cca296e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2007,7 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes
2007 if (autopilot) 2007 if (autopilot)
2008 { // its not a scripted sit 2008 { // its not a scripted sit
2009// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) 2009// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
2010 if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 10.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 10.0f) ) 2010 if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 256.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 256.0f) )
2011 { 2011 {
2012 autopilot = false; // close enough 2012 autopilot = false; // close enough
2013 m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. 2013 m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup.
@@ -2053,9 +2053,13 @@ namespace OpenSim.Region.Framework.Scenes
2053//Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); 2053//Console.WriteLine("Camera Eye ={0}", cameraEyeOffset);
2054 2054
2055 //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child 2055 //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child
2056 ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * part.RotationOffset) + part.OffsetPosition), sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); 2056 Quaternion roffset = Quaternion.Identity;
2057 if (SitTargetisSet)
2058 {
2059 roffset = part.RotationOffset;
2060 }
2061 ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * roffset) + part.OffsetPosition), sitOrientation / part.RotationOffset, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
2057 2062
2058 m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target
2059 // This calls HandleAgentSit twice, once from here, and the client calls 2063 // This calls HandleAgentSit twice, once from here, and the client calls
2060 // HandleAgentSit itself after it gets to the location 2064 // HandleAgentSit itself after it gets to the location
2061 // It doesn't get to the location until we've moved them there though 2065 // It doesn't get to the location until we've moved them there though
@@ -2374,8 +2378,7 @@ namespace OpenSim.Region.Framework.Scenes
2374 m_bodyRot = sitTargetOrient; 2378 m_bodyRot = sitTargetOrient;
2375 m_parentPosition = part.AbsolutePosition; 2379 m_parentPosition = part.AbsolutePosition;
2376 part.IsOccupied = true; 2380 part.IsOccupied = true;
2377 part.ParentGroup.AddAvatar(agentID); 2381 part.ParentGroup.AddAvatar(agentID);
2378Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2379 } 2382 }
2380 else 2383 else
2381 { 2384 {
@@ -2441,7 +2444,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2441 } 2444 }
2442 2445
2443 m_linkedPrim = part.UUID; 2446 m_linkedPrim = part.UUID;
2444 2447 m_offsetRotation = m_offsetRotation / part.RotationOffset;
2445 Velocity = Vector3.Zero; 2448 Velocity = Vector3.Zero;
2446 RemoveFromPhysicalScene(); 2449 RemoveFromPhysicalScene();
2447 Animator.TrySetMovementAnimation(sitAnimation); 2450 Animator.TrySetMovementAnimation(sitAnimation);