diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 113 |
1 files changed, 76 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 86f60bb..28758a9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -111,6 +111,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | STATUS_ROTATE_Z = 0x008, | 111 | STATUS_ROTATE_Z = 0x008, |
112 | } | 112 | } |
113 | 113 | ||
114 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm | ||
115 | public static readonly uint SLAM = 16; | ||
116 | |||
114 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; | 117 | // private PrimCountTaintedDelegate handlerPrimCountTainted = null; |
115 | 118 | ||
116 | /// <summary> | 119 | /// <summary> |
@@ -506,9 +509,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
506 | { | 509 | { |
507 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); | 510 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); |
508 | } | 511 | } |
509 | 512 | ||
510 | |||
511 | |||
512 | private struct avtocrossInfo | 513 | private struct avtocrossInfo |
513 | { | 514 | { |
514 | public ScenePresence av; | 515 | public ScenePresence av; |
@@ -549,10 +550,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
549 | Vector3 newpos = Vector3.Zero; | 550 | Vector3 newpos = Vector3.Zero; |
550 | OpenSim.Services.Interfaces.GridRegion destination = null; | 551 | OpenSim.Services.Interfaces.GridRegion destination = null; |
551 | 552 | ||
553 | if (m_rootPart.DIE_AT_EDGE || m_rootPart.RETURN_AT_EDGE) | ||
554 | { | ||
555 | // this should delete the grp in this case | ||
556 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
557 | // actually assume this sog was removed from simulation | ||
558 | return; | ||
559 | } | ||
560 | |||
552 | if (m_rootPart.KeyframeMotion != null) | 561 | if (m_rootPart.KeyframeMotion != null) |
553 | m_rootPart.KeyframeMotion.StartCrossingCheck(); | 562 | m_rootPart.KeyframeMotion.StartCrossingCheck(); |
554 | 563 | ||
555 | bool canCross = true; | 564 | bool canCross = true; |
565 | |||
556 | foreach (ScenePresence av in m_linkedAvatars) | 566 | foreach (ScenePresence av in m_linkedAvatars) |
557 | { | 567 | { |
558 | // We need to cross these agents. First, let's find | 568 | // We need to cross these agents. First, let's find |
@@ -637,11 +647,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
637 | ScenePresence av = avinfo.av; | 647 | ScenePresence av = avinfo.av; |
638 | av.ParentUUID = UUID.Zero; | 648 | av.ParentUUID = UUID.Zero; |
639 | av.ParentID = avinfo.ParentID; | 649 | av.ParentID = avinfo.ParentID; |
640 | // m_linkedAvatars.Add(av); | 650 | // m_linkedAvatars.Add(av); |
641 | } | 651 | } |
642 | } | 652 | } |
643 | avsToCross.Clear(); | 653 | avsToCross.Clear(); |
644 | |||
645 | } | 654 | } |
646 | else | 655 | else |
647 | { | 656 | { |
@@ -656,16 +665,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | Vector3 oldp = AbsolutePosition; | 665 | Vector3 oldp = AbsolutePosition; |
657 | val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); | 666 | val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); |
658 | val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); | 667 | val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); |
659 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); | 668 | // dont crash land StarShips |
669 | // val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); | ||
660 | } | 670 | } |
661 | } | 671 | } |
662 | 672 | ||
663 | /* don't see the need but worse don't see where is restored to false if things stay in | ||
664 | foreach (SceneObjectPart part in m_parts.GetArray()) | ||
665 | { | ||
666 | part.IgnoreUndoUpdate = true; | ||
667 | } | ||
668 | */ | ||
669 | if (RootPart.GetStatusSandbox()) | 673 | if (RootPart.GetStatusSandbox()) |
670 | { | 674 | { |
671 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | 675 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) |
@@ -680,17 +684,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
680 | } | 684 | } |
681 | } | 685 | } |
682 | 686 | ||
683 | // Restuff the new GroupPosition into each SOP of the linkset. | ||
684 | // This has the affect of resetting and tainting the physics actors. | ||
685 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
686 | bool triggerScriptEvent = m_rootPart.GroupPosition != val; | 687 | bool triggerScriptEvent = m_rootPart.GroupPosition != val; |
687 | if (m_dupeInProgress) | 688 | if (m_dupeInProgress || IsDeleted) |
688 | triggerScriptEvent = false; | 689 | triggerScriptEvent = false; |
690 | |||
691 | m_rootPart.GroupPosition = val; | ||
692 | |||
693 | // Restuff the new GroupPosition into each child SOP of the linkset. | ||
694 | // this is needed because physics may not have linksets but just loose SOPs in world | ||
695 | |||
696 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
697 | |||
689 | foreach (SceneObjectPart part in parts) | 698 | foreach (SceneObjectPart part in parts) |
690 | { | 699 | { |
691 | part.GroupPosition = val; | 700 | if (part != m_rootPart) |
692 | if (triggerScriptEvent) | 701 | part.GroupPosition = val; |
702 | } | ||
703 | |||
704 | foreach (ScenePresence av in m_linkedAvatars) | ||
705 | { | ||
706 | av.sitSOGmoved(); | ||
707 | } | ||
708 | |||
709 | // now that position is changed tell it to scripts | ||
710 | if (triggerScriptEvent) | ||
711 | { | ||
712 | foreach (SceneObjectPart part in parts) | ||
713 | { | ||
693 | part.TriggerScriptChangedEvent(Changed.POSITION); | 714 | part.TriggerScriptChangedEvent(Changed.POSITION); |
715 | } | ||
694 | } | 716 | } |
695 | 717 | ||
696 | /* | 718 | /* |
@@ -744,6 +766,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
744 | { | 766 | { |
745 | if (agent.ParentUUID != UUID.Zero) | 767 | if (agent.ParentUUID != UUID.Zero) |
746 | { | 768 | { |
769 | agent.ClearControls(); | ||
747 | agent.ParentPart = null; | 770 | agent.ParentPart = null; |
748 | // agent.ParentPosition = Vector3.Zero; | 771 | // agent.ParentPosition = Vector3.Zero; |
749 | // agent.ParentUUID = UUID.Zero; | 772 | // agent.ParentUUID = UUID.Zero; |
@@ -751,7 +774,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
751 | } | 774 | } |
752 | 775 | ||
753 | agent.ParentUUID = UUID.Zero; | 776 | agent.ParentUUID = UUID.Zero; |
754 | |||
755 | // agent.Reset(); | 777 | // agent.Reset(); |
756 | // else // Not successful | 778 | // else // Not successful |
757 | // agent.RestoreInCurrentScene(); | 779 | // agent.RestoreInCurrentScene(); |
@@ -891,14 +913,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | } | 913 | } |
892 | } | 914 | } |
893 | } | 915 | } |
894 | 916 | // PlaySoundMasterPrim no longer in use to remove | |
895 | private SceneObjectPart m_PlaySoundMasterPrim = null; | 917 | private SceneObjectPart m_PlaySoundMasterPrim = null; |
896 | public SceneObjectPart PlaySoundMasterPrim | 918 | public SceneObjectPart PlaySoundMasterPrim |
897 | { | 919 | { |
898 | get { return m_PlaySoundMasterPrim; } | 920 | get { return m_PlaySoundMasterPrim; } |
899 | set { m_PlaySoundMasterPrim = value; } | 921 | set { m_PlaySoundMasterPrim = value; } |
900 | } | 922 | } |
901 | 923 | // PlaySoundSlavePrims no longer in use to remove | |
902 | private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); | 924 | private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); |
903 | public List<SceneObjectPart> PlaySoundSlavePrims | 925 | public List<SceneObjectPart> PlaySoundSlavePrims |
904 | { | 926 | { |
@@ -906,6 +928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
906 | set { m_PlaySoundSlavePrims = value; } | 928 | set { m_PlaySoundSlavePrims = value; } |
907 | } | 929 | } |
908 | 930 | ||
931 | // LoopSoundMasterPrim no longer in use to remove | ||
909 | private SceneObjectPart m_LoopSoundMasterPrim = null; | 932 | private SceneObjectPart m_LoopSoundMasterPrim = null; |
910 | public SceneObjectPart LoopSoundMasterPrim | 933 | public SceneObjectPart LoopSoundMasterPrim |
911 | { | 934 | { |
@@ -913,6 +936,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
913 | set { m_LoopSoundMasterPrim = value; } | 936 | set { m_LoopSoundMasterPrim = value; } |
914 | } | 937 | } |
915 | 938 | ||
939 | // m_LoopSoundSlavePrims no longer in use to remove | ||
916 | private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>(); | 940 | private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>(); |
917 | public List<SceneObjectPart> LoopSoundSlavePrims | 941 | public List<SceneObjectPart> LoopSoundSlavePrims |
918 | { | 942 | { |
@@ -1667,7 +1691,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1667 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 1691 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1668 | if (avatar == null) | 1692 | if (avatar == null) |
1669 | return; | 1693 | return; |
1670 | 1694 | m_rootPart.Shape.LastAttachPoint = m_rootPart.Shape.State; | |
1695 | m_rootPart.AttachedPos = m_rootPart.OffsetPosition; | ||
1671 | avatar.RemoveAttachment(this); | 1696 | avatar.RemoveAttachment(this); |
1672 | 1697 | ||
1673 | Vector3 detachedpos = new Vector3(127f,127f,127f); | 1698 | Vector3 detachedpos = new Vector3(127f,127f,127f); |
@@ -1820,11 +1845,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1820 | // Setting this SOG's absolute position also loops through and sets the positions | 1845 | // Setting this SOG's absolute position also loops through and sets the positions |
1821 | // of the SOP's in this SOG's linkset. This has the side affect of making sure | 1846 | // of the SOP's in this SOG's linkset. This has the side affect of making sure |
1822 | // the physics world matches the simulated world. | 1847 | // the physics world matches the simulated world. |
1823 | AbsolutePosition = AbsolutePosition; // could someone in the know please explain how this works? | 1848 | // AbsolutePosition = AbsolutePosition; // could someone in the know please explain how this works? |
1824 | 1849 | ||
1825 | // teravus: AbsolutePosition is NOT a normal property! | 1850 | // teravus: AbsolutePosition is NOT a normal property! |
1826 | // the code in the getter of AbsolutePosition is significantly different then the code in the setter! | 1851 | // the code in the getter of AbsolutePosition is significantly different then the code in the setter! |
1827 | // jhurliman: Then why is it a property instead of two methods? | 1852 | // jhurliman: Then why is it a property instead of two methods? |
1853 | |||
1854 | // do only what is supposed to do | ||
1855 | Vector3 groupPosition = m_rootPart.GroupPosition; | ||
1856 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
1857 | |||
1858 | foreach (SceneObjectPart part in parts) | ||
1859 | { | ||
1860 | if (part != m_rootPart) | ||
1861 | part.GroupPosition = groupPosition; | ||
1862 | } | ||
1828 | } | 1863 | } |
1829 | 1864 | ||
1830 | public UUID GetPartsFullID(uint localID) | 1865 | public UUID GetPartsFullID(uint localID) |
@@ -1868,11 +1903,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1868 | /// <summary> | 1903 | /// <summary> |
1869 | /// Delete this group from its scene. | 1904 | /// Delete this group from its scene. |
1870 | /// </summary> | 1905 | /// </summary> |
1871 | /// | 1906 | /// <remarks> |
1872 | /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood | 1907 | /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood |
1873 | /// up and all avatars receive notification of its removal. Removal of the scene object from database backup | 1908 | /// up and all avatars receive notification of its removal. Removal of the scene object from database backup |
1874 | /// must be handled by the caller. | 1909 | /// must be handled by the caller. |
1875 | /// | 1910 | /// </remarks> |
1876 | /// <param name="silent">If true then deletion is not broadcast to clients</param> | 1911 | /// <param name="silent">If true then deletion is not broadcast to clients</param> |
1877 | public void DeleteGroupFromScene(bool silent) | 1912 | public void DeleteGroupFromScene(bool silent) |
1878 | { | 1913 | { |
@@ -1901,7 +1936,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1901 | if (!IsAttachment | 1936 | if (!IsAttachment |
1902 | || AttachedAvatar == avatar.ControllingClient.AgentId | 1937 | || AttachedAvatar == avatar.ControllingClient.AgentId |
1903 | || !HasPrivateAttachmentPoint) | 1938 | || !HasPrivateAttachmentPoint) |
1904 | avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); | 1939 | avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId }); |
1905 | } | 1940 | } |
1906 | } | 1941 | } |
1907 | }); | 1942 | }); |
@@ -2109,6 +2144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2109 | 2144 | ||
2110 | if (RootPart.Shape.PCode == 9 && RootPart.Shape.State != 0) | 2145 | if (RootPart.Shape.PCode == 9 && RootPart.Shape.State != 0) |
2111 | { | 2146 | { |
2147 | RootPart.Shape.LastAttachPoint = RootPart.Shape.State; | ||
2112 | RootPart.Shape.State = 0; | 2148 | RootPart.Shape.State = 0; |
2113 | ScheduleGroupForFullUpdate(); | 2149 | ScheduleGroupForFullUpdate(); |
2114 | } | 2150 | } |
@@ -2210,7 +2246,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2210 | if (!userExposed) | 2246 | if (!userExposed) |
2211 | dupe.IsAttachment = true; | 2247 | dupe.IsAttachment = true; |
2212 | 2248 | ||
2213 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 2249 | dupe.m_sittingAvatars = new List<UUID>(); |
2214 | 2250 | ||
2215 | if (!userExposed) | 2251 | if (!userExposed) |
2216 | { | 2252 | { |
@@ -3813,20 +3849,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3813 | /// <summary> | 3849 | /// <summary> |
3814 | /// Update just the root prim position in a linkset | 3850 | /// Update just the root prim position in a linkset |
3815 | /// </summary> | 3851 | /// </summary> |
3816 | /// <param name="pos"></param> | 3852 | /// <param name="newPos"></param> |
3817 | public void UpdateRootPosition(Vector3 pos) | 3853 | public void UpdateRootPosition(Vector3 newPos) |
3818 | { | 3854 | { |
3819 | // needs to be called with phys building true | 3855 | // needs to be called with phys building true |
3820 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 3856 | Vector3 oldPos; |
3821 | Vector3 oldPos = | 3857 | |
3822 | new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, | 3858 | if (IsAttachment) |
3823 | AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, | 3859 | oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim |
3824 | AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); | 3860 | else |
3861 | oldPos = AbsolutePosition + m_rootPart.OffsetPosition; | ||
3862 | |||
3825 | Vector3 diff = oldPos - newPos; | 3863 | Vector3 diff = oldPos - newPos; |
3826 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | ||
3827 | Quaternion partRotation = m_rootPart.RotationOffset; | 3864 | Quaternion partRotation = m_rootPart.RotationOffset; |
3828 | axDiff *= Quaternion.Inverse(partRotation); | 3865 | diff *= Quaternion.Inverse(partRotation); |
3829 | diff = axDiff; | ||
3830 | 3866 | ||
3831 | SceneObjectPart[] parts = m_parts.GetArray(); | 3867 | SceneObjectPart[] parts = m_parts.GetArray(); |
3832 | for (int i = 0; i < parts.Length; i++) | 3868 | for (int i = 0; i < parts.Length; i++) |
@@ -3837,6 +3873,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3837 | } | 3873 | } |
3838 | 3874 | ||
3839 | AbsolutePosition = newPos; | 3875 | AbsolutePosition = newPos; |
3876 | |||
3877 | if (IsAttachment) | ||
3878 | m_rootPart.AttachedPos = newPos; | ||
3840 | 3879 | ||
3841 | HasGroupChanged = true; | 3880 | HasGroupChanged = true; |
3842 | if (m_rootPart.Undoing) | 3881 | if (m_rootPart.Undoing) |