diff options
author | Melanie | 2012-04-25 19:09:22 +0100 |
---|---|---|
committer | Melanie | 2012-04-25 19:09:22 +0100 |
commit | 88553bb884c5c8849ec61362e65fe0950c1e3080 (patch) | |
tree | cea887a9eec906ada9c7eaa273c354761bcc1bbe /OpenSim | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.zip opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.gz opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.bz2 opensim-SC_OLD-88553bb884c5c8849ec61362e65fe0950c1e3080.tar.xz |
Port Avination link order to make OpenSim behave like SL. Make Primstar scripts work. Fixes Mantis #5990
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 |
2 files changed, 47 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 49a3485..2686004 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1969,6 +1969,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> | 1969 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
1970 | public void LinkToGroup(SceneObjectGroup objectGroup) | 1970 | public void LinkToGroup(SceneObjectGroup objectGroup) |
1971 | { | 1971 | { |
1972 | LinkToGroup(objectGroup, false); | ||
1973 | } | ||
1974 | |||
1975 | public void LinkToGroup(SceneObjectGroup objectGroup, bool insert) | ||
1976 | { | ||
1972 | // m_log.DebugFormat( | 1977 | // m_log.DebugFormat( |
1973 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", | 1978 | // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", |
1974 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); | 1979 | // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); |
@@ -1979,6 +1984,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1979 | 1984 | ||
1980 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 1985 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
1981 | 1986 | ||
1987 | // physics flags from group to be applied to linked parts | ||
1988 | bool grpusephys = UsesPhysics; | ||
1989 | bool grptemporary = IsTemporary; | ||
1990 | |||
1982 | Vector3 oldGroupPosition = linkPart.GroupPosition; | 1991 | Vector3 oldGroupPosition = linkPart.GroupPosition; |
1983 | Quaternion oldRootRotation = linkPart.RotationOffset; | 1992 | Quaternion oldRootRotation = linkPart.RotationOffset; |
1984 | 1993 | ||
@@ -2002,15 +2011,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2002 | 2011 | ||
2003 | lock (m_parts.SyncRoot) | 2012 | lock (m_parts.SyncRoot) |
2004 | { | 2013 | { |
2005 | int linkNum = PrimCount + 1; | 2014 | int linkNum; |
2015 | if (insert) | ||
2016 | { | ||
2017 | linkNum = 2; | ||
2018 | foreach (SceneObjectPart part in Parts) | ||
2019 | { | ||
2020 | if (part.LinkNum > 1) | ||
2021 | part.LinkNum++; | ||
2022 | } | ||
2023 | } | ||
2024 | else | ||
2025 | { | ||
2026 | linkNum = PrimCount + 1; | ||
2027 | } | ||
2006 | 2028 | ||
2007 | m_parts.Add(linkPart.UUID, linkPart); | 2029 | m_parts.Add(linkPart.UUID, linkPart); |
2008 | 2030 | ||
2009 | linkPart.SetParent(this); | 2031 | linkPart.SetParent(this); |
2010 | linkPart.CreateSelected = true; | 2032 | linkPart.CreateSelected = true; |
2011 | 2033 | ||
2034 | // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now | ||
2035 | linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive); | ||
2036 | if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2037 | { | ||
2038 | linkPart.PhysActor.link(m_rootPart.PhysActor); | ||
2039 | this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor); | ||
2040 | } | ||
2041 | |||
2012 | linkPart.LinkNum = linkNum++; | 2042 | linkPart.LinkNum = linkNum++; |
2013 | linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect); | ||
2014 | 2043 | ||
2015 | SceneObjectPart[] ogParts = objectGroup.Parts; | 2044 | SceneObjectPart[] ogParts = objectGroup.Parts; |
2016 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) | 2045 | Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) |
@@ -2022,7 +2051,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2022 | { | 2051 | { |
2023 | SceneObjectPart part = ogParts[i]; | 2052 | SceneObjectPart part = ogParts[i]; |
2024 | if (part.UUID != objectGroup.m_rootPart.UUID) | 2053 | if (part.UUID != objectGroup.m_rootPart.UUID) |
2054 | { | ||
2025 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); | 2055 | LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); |
2056 | // let physics know | ||
2057 | part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive); | ||
2058 | if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) | ||
2059 | { | ||
2060 | part.PhysActor.link(m_rootPart.PhysActor); | ||
2061 | this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | ||
2062 | } | ||
2063 | } | ||
2026 | part.ClearUndoState(); | 2064 | part.ClearUndoState(); |
2027 | } | 2065 | } |
2028 | } | 2066 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d4c872c..d641958 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -832,8 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
832 | 832 | ||
833 | public void llRegionSayTo(string target, int channel, string msg) | 833 | public void llRegionSayTo(string target, int channel, string msg) |
834 | { | 834 | { |
835 | string error = String.Empty; | ||
836 | |||
837 | if (msg.Length > 1023) | 835 | if (msg.Length > 1023) |
838 | msg = msg.Substring(0, 1023); | 836 | msg = msg.Substring(0, 1023); |
839 | 837 | ||
@@ -3548,7 +3546,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3548 | public void llCreateLink(string target, int parent) | 3546 | public void llCreateLink(string target, int parent) |
3549 | { | 3547 | { |
3550 | m_host.AddScriptLPS(1); | 3548 | m_host.AddScriptLPS(1); |
3551 | |||
3552 | UUID targetID; | 3549 | UUID targetID; |
3553 | 3550 | ||
3554 | if (!UUID.TryParse(target, out targetID)) | 3551 | if (!UUID.TryParse(target, out targetID)) |
@@ -3572,11 +3569,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3572 | 3569 | ||
3573 | if (targetPart.ParentGroup.AttachmentPoint != 0) | 3570 | if (targetPart.ParentGroup.AttachmentPoint != 0) |
3574 | return; // Fail silently if attached | 3571 | return; // Fail silently if attached |
3572 | |||
3573 | if (targetPart.ParentGroup.RootPart.OwnerID != m_host.ParentGroup.RootPart.OwnerID) | ||
3574 | return; | ||
3575 | |||
3575 | SceneObjectGroup parentPrim = null, childPrim = null; | 3576 | SceneObjectGroup parentPrim = null, childPrim = null; |
3576 | 3577 | ||
3577 | if (targetPart != null) | 3578 | if (targetPart != null) |
3578 | { | 3579 | { |
3579 | if (parent != 0) { | 3580 | if (parent != 0) |
3581 | { | ||
3580 | parentPrim = m_host.ParentGroup; | 3582 | parentPrim = m_host.ParentGroup; |
3581 | childPrim = targetPart.ParentGroup; | 3583 | childPrim = targetPart.ParentGroup; |
3582 | } | 3584 | } |
@@ -3588,7 +3590,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3588 | 3590 | ||
3589 | // Required for linking | 3591 | // Required for linking |
3590 | childPrim.RootPart.ClearUpdateSchedule(); | 3592 | childPrim.RootPart.ClearUpdateSchedule(); |
3591 | parentPrim.LinkToGroup(childPrim); | 3593 | parentPrim.LinkToGroup(childPrim, true); |
3592 | } | 3594 | } |
3593 | 3595 | ||
3594 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3596 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |