aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-01 01:22:28 +0100
committerJustin Clark-Casey (justincc)2011-09-01 01:22:28 +0100
commit095b3e5756bb3160b30c9c5670ba008fa13d2e66 (patch)
tree0052b92cf46d42d714740bb4c7404edbdbaea0de /OpenSim/Region
parentFix a bug where the non-root parts of rezzed objects that had previously been... (diff)
downloadopensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.zip
opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.gz
opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.bz2
opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.xz
Remove pointless cluttering SOP.ParentGroup != null checks.
The only times when ParentGroup might be null is during regression tests (which might not be a valid thing) and when scene objects are being constructed from the database. At all other times it's not possible for a SOP not to have a SOG parent.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs282
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs157
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs4
16 files changed, 274 insertions, 424 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 661e9db..e9ee7be 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4756,10 +4756,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4756 { 4756 {
4757 SceneObjectPart part = (SceneObjectPart)entity; 4757 SceneObjectPart part = (SceneObjectPart)entity;
4758 4758
4759 if (part.ParentGroup != null) 4759 attachPoint = part.ParentGroup.AttachmentPoint;
4760 attachPoint = part.ParentGroup.AttachmentPoint;
4761 else
4762 attachPoint = 0;
4763 4760
4764// m_log.DebugFormat( 4761// m_log.DebugFormat(
4765// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}", 4762// "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}",
@@ -4921,7 +4918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4921 //update.JointType = 0; 4918 //update.JointType = 0;
4922 update.Material = data.Material; 4919 update.Material = data.Material;
4923 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 4920 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
4924 if (data.ParentGroup != null && data.ParentGroup.IsAttachment) 4921 if (data.ParentGroup.IsAttachment)
4925 { 4922 {
4926 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID); 4923 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
4927 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16)); 4924 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 3aed6ba..d0605e3 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -851,41 +851,35 @@ namespace OpenSim.Region.CoreModules.World.Estate
851 SceneObjectPart prt = Scene.GetSceneObjectPart(obj); 851 SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
852 if (prt != null) 852 if (prt != null)
853 { 853 {
854 if (prt.ParentGroup != null) 854 SceneObjectGroup sog = prt.ParentGroup;
855 LandStatReportItem lsri = new LandStatReportItem();
856 lsri.LocationX = sog.AbsolutePosition.X;
857 lsri.LocationY = sog.AbsolutePosition.Y;
858 lsri.LocationZ = sog.AbsolutePosition.Z;
859 lsri.Score = SceneData[obj];
860 lsri.TaskID = sog.UUID;
861 lsri.TaskLocalID = sog.LocalId;
862 lsri.TaskName = sog.GetPartName(obj);
863 lsri.OwnerName = "waiting";
864 lock (uuidNameLookupList)
865 uuidNameLookupList.Add(sog.OwnerID);
866
867 if (filter.Length != 0)
855 { 868 {
856 SceneObjectGroup sog = prt.ParentGroup; 869 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
857 if (sog != null)
858 { 870 {
859 LandStatReportItem lsri = new LandStatReportItem(); 871 }
860 lsri.LocationX = sog.AbsolutePosition.X; 872 else
861 lsri.LocationY = sog.AbsolutePosition.Y; 873 {
862 lsri.LocationZ = sog.AbsolutePosition.Z; 874 continue;
863 lsri.Score = SceneData[obj];
864 lsri.TaskID = sog.UUID;
865 lsri.TaskLocalID = sog.LocalId;
866 lsri.TaskName = sog.GetPartName(obj);
867 lsri.OwnerName = "waiting";
868 lock (uuidNameLookupList)
869 uuidNameLookupList.Add(sog.OwnerID);
870
871 if (filter.Length != 0)
872 {
873 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
874 {
875 }
876 else
877 {
878 continue;
879 }
880 }
881
882 SceneReport.Add(lsri);
883 } 875 }
884 } 876 }
885 }
886 877
878 SceneReport.Add(lsri);
879 }
887 } 880 }
888 } 881 }
882
889 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); 883 remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
890 884
891 if (uuidNameLookupList.Count > 0) 885 if (uuidNameLookupList.Count > 0)
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index be399ff..8b78701 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) 85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
86 { 86 {
87 SceneObjectPart part = m_scene.GetSceneObjectPart(localID); 87 SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
88 if (part == null || part.ParentGroup == null) 88 if (part == null)
89 return; 89 return;
90 90
91 if (part.ParentGroup.IsDeleted) 91 if (part.ParentGroup.IsDeleted)
@@ -111,9 +111,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
111 if (part == null) 111 if (part == null)
112 return false; 112 return false;
113 113
114 if (part.ParentGroup == null)
115 return false;
116
117 SceneObjectGroup group = part.ParentGroup; 114 SceneObjectGroup group = part.ParentGroup;
118 115
119 switch (saleType) 116 switch (saleType)
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7cb3751..b9bd9a4 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1131,7 +1131,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1131 SceneObjectPart part = scene.GetSceneObjectPart(objectID); 1131 SceneObjectPart part = scene.GetSceneObjectPart(objectID);
1132 if (part.OwnerID != moverID) 1132 if (part.OwnerID != moverID)
1133 { 1133 {
1134 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) 1134 if (!part.ParentGroup.IsDeleted)
1135 { 1135 {
1136 if (part.ParentGroup.IsAttachment) 1136 if (part.ParentGroup.IsAttachment)
1137 return false; 1137 return false;
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 33407ec..1b10e3c 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -208,8 +208,7 @@ namespace OpenSim.Region.Framework.Scenes
208 if (entity is SceneObjectPart) 208 if (entity is SceneObjectPart)
209 { 209 {
210 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; 210 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
211 if (group != null) 211 entityPos = group.AbsolutePosition;
212 entityPos = group.AbsolutePosition;
213 } 212 }
214 213
215 // Use the camera position for local agents and avatar position for remote agents 214 // Use the camera position for local agents and avatar position for remote agents
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index addc20c..4700c3b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -225,16 +225,8 @@ namespace OpenSim.Region.Framework.Scenes
225 SceneObjectPart part = GetSceneObjectPart(primId); 225 SceneObjectPart part = GetSceneObjectPart(primId);
226 if (part == null) 226 if (part == null)
227 return new ArrayList(); 227 return new ArrayList();
228 SceneObjectGroup group = part.ParentGroup;
229 if (null == group)
230 {
231 m_log.ErrorFormat(
232 "[PRIM INVENTORY]: " +
233 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
234 itemId, primId);
235 228
236 return new ArrayList(); 229 SceneObjectGroup group = part.ParentGroup;
237 }
238 230
239 // Retrieve item 231 // Retrieve item
240 TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); 232 TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId);
@@ -971,33 +963,23 @@ namespace OpenSim.Region.Framework.Scenes
971 SceneObjectPart part = GetSceneObjectPart(localID); 963 SceneObjectPart part = GetSceneObjectPart(localID);
972 if (part == null) 964 if (part == null)
973 return; 965 return;
966
974 SceneObjectGroup group = part.ParentGroup; 967 SceneObjectGroup group = part.ParentGroup;
975 if (group != null) 968 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
976 { 969 return;
977 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) 970
978 return; 971 TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
979 972 if (item == null)
980 TaskInventoryItem item = group.GetInventoryItem(localID, itemID); 973 return;
981 if (item == null)
982 return;
983 974
984 if (item.Type == 10) 975 if (item.Type == 10)
985 {
986 part.RemoveScriptEvents(itemID);
987 EventManager.TriggerRemoveScript(localID, itemID);
988 }
989
990 group.RemoveInventoryItem(localID, itemID);
991 part.GetProperties(remoteClient);
992 }
993 else
994 { 976 {
995 m_log.ErrorFormat( 977 part.RemoveScriptEvents(itemID);
996 "[PRIM INVENTORY]: " + 978 EventManager.TriggerRemoveScript(localID, itemID);
997 "Removal of item {0} requested of prim {1} but this prim does not exist",
998 itemID,
999 localID);
1000 } 979 }
980
981 group.RemoveInventoryItem(localID, itemID);
982 part.GetProperties(remoteClient);
1001 } 983 }
1002 984
1003 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) 985 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
@@ -1770,7 +1752,7 @@ namespace OpenSim.Region.Framework.Scenes
1770 continue; 1752 continue;
1771 1753
1772 // Already deleted by someone else 1754 // Already deleted by someone else
1773 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1755 if (part.ParentGroup.IsDeleted)
1774 continue; 1756 continue;
1775 1757
1776 // Can't delete child prims 1758 // Can't delete child prims
@@ -2034,6 +2016,7 @@ namespace OpenSim.Region.Framework.Scenes
2034 SceneObjectPart part = GetSceneObjectPart(localID); 2016 SceneObjectPart part = GetSceneObjectPart(localID);
2035 if (part == null) 2017 if (part == null)
2036 continue; 2018 continue;
2019
2037 if (!groups.Contains(part.ParentGroup)) 2020 if (!groups.Contains(part.ParentGroup))
2038 groups.Add(part.ParentGroup); 2021 groups.Add(part.ParentGroup);
2039 } 2022 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9368285..7f5aea7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3012,58 +3012,51 @@ namespace OpenSim.Region.Framework.Scenes
3012 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); 3012 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z);
3013 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); 3013 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z);
3014 3014
3015 if (target2.ParentGroup != null) 3015 pos = target2.AbsolutePosition;
3016 { 3016 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3017 pos = target2.AbsolutePosition;
3018 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3019 3017
3020 // TODO: Raytrace better here 3018 // TODO: Raytrace better here
3021 3019
3022 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); 3020 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection));
3023 Ray NewRay = new Ray(AXOrigin, AXdirection); 3021 Ray NewRay = new Ray(AXOrigin, AXdirection);
3024 3022
3025 // Ray Trace against target here 3023 // Ray Trace against target here
3026 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); 3024 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
3027 3025
3028 // Un-comment out the following line to Get Raytrace results printed to the console. 3026 // Un-comment out the following line to Get Raytrace results printed to the console.
3029 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 3027 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
3030 float ScaleOffset = 0.5f; 3028 float ScaleOffset = 0.5f;
3031 3029
3032 // If we hit something 3030 // If we hit something
3033 if (ei.HitTF) 3031 if (ei.HitTF)
3032 {
3033 Vector3 scale = target.Scale;
3034 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
3035 if (scaleComponent.X != 0) ScaleOffset = scale.X;
3036 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
3037 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
3038 ScaleOffset = Math.Abs(ScaleOffset);
3039 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
3040 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
3041 Vector3 offset = normal * (ScaleOffset / 2f);
3042 pos = intersectionpoint + offset;
3043
3044 // stick in offset format from the original prim
3045 pos = pos - target.ParentGroup.AbsolutePosition;
3046 if (CopyRotates)
3034 { 3047 {
3035 Vector3 scale = target.Scale; 3048 Quaternion worldRot = target2.GetWorldRotation();
3036 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z);
3037 if (scaleComponent.X != 0) ScaleOffset = scale.X;
3038 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
3039 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
3040 ScaleOffset = Math.Abs(ScaleOffset);
3041 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
3042 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z);
3043 Vector3 offset = normal * (ScaleOffset / 2f);
3044 pos = intersectionpoint + offset;
3045
3046 // stick in offset format from the original prim
3047 pos = pos - target.ParentGroup.AbsolutePosition;
3048 if (CopyRotates)
3049 {
3050 Quaternion worldRot = target2.GetWorldRotation();
3051 3049
3052 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3050 // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3053 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); 3051 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
3054 //obj.Rotation = worldRot; 3052 //obj.Rotation = worldRot;
3055 //obj.UpdateGroupRotationR(worldRot); 3053 //obj.UpdateGroupRotationR(worldRot);
3056 } 3054 }
3057 else 3055 else
3058 { 3056 {
3059 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); 3057 m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
3060 }
3061 } 3058 }
3062
3063 return;
3064 } 3059 }
3065
3066 return;
3067 } 3060 }
3068 } 3061 }
3069 3062
@@ -3233,12 +3226,13 @@ namespace OpenSim.Region.Framework.Scenes
3233 SceneObjectPart part = GetSceneObjectPart(localID); 3226 SceneObjectPart part = GetSceneObjectPart(localID);
3234 if (part != null) // It is a prim 3227 if (part != null) // It is a prim
3235 { 3228 {
3236 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid 3229 if (!part.ParentGroup.IsDeleted) // Valid
3237 { 3230 {
3238 if (part.ParentGroup.RootPart != part) // Child part 3231 if (part.ParentGroup.RootPart != part) // Child part
3239 return; 3232 return;
3240 } 3233 }
3241 } 3234 }
3235
3242 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); 3236 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
3243 } 3237 }
3244 3238
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 76ed55c..17a1bcc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1630,27 +1630,18 @@ namespace OpenSim.Region.Framework.Scenes
1630 SceneObjectGroup parentGroup = root.ParentGroup; 1630 SceneObjectGroup parentGroup = root.ParentGroup;
1631 1631
1632 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1632 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1633 if (parentGroup != null)
1634 {
1635 // We do this in reverse to get the link order of the prims correct
1636 for (int i = children.Count - 1; i >= 0; i--)
1637 {
1638 SceneObjectGroup child = children[i].ParentGroup;
1639 1633
1640 if (child != null) 1634 // We do this in reverse to get the link order of the prims correct
1641 { 1635 for (int i = children.Count - 1; i >= 0; i--)
1642 // Make sure no child prim is set for sale
1643 // So that, on delink, no prims are unwittingly
1644 // left for sale and sold off
1645 child.RootPart.ObjectSaleType = 0;
1646 child.RootPart.SalePrice = 10;
1647 childGroups.Add(child);
1648 }
1649 }
1650 }
1651 else
1652 { 1636 {
1653 return; // parent is null so not in this region 1637 SceneObjectGroup child = children[i].ParentGroup;
1638
1639 // Make sure no child prim is set for sale
1640 // So that, on delink, no prims are unwittingly
1641 // left for sale and sold off
1642 child.RootPart.ObjectSaleType = 0;
1643 child.RootPart.SalePrice = 10;
1644 childGroups.Add(child);
1654 } 1645 }
1655 1646
1656 foreach (SceneObjectGroup child in childGroups) 1647 foreach (SceneObjectGroup child in childGroups)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 71023a9..4e7504a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -302,7 +302,6 @@ namespace OpenSim.Region.Framework.Scenes
302 protected string m_name; 302 protected string m_name;
303 protected Vector3 m_offsetPosition; 303 protected Vector3 m_offsetPosition;
304 304
305 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
306 protected SceneObjectGroup m_parentGroup; 305 protected SceneObjectGroup m_parentGroup;
307 protected byte[] m_particleSystem = Utils.EmptyBytes; 306 protected byte[] m_particleSystem = Utils.EmptyBytes;
308 protected ulong m_regionHandle; 307 protected ulong m_regionHandle;
@@ -592,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
592 set 591 set
593 { 592 {
594 m_passTouches = value; 593 m_passTouches = value;
594
595 if (ParentGroup != null) 595 if (ParentGroup != null)
596 ParentGroup.HasGroupChanged = true; 596 ParentGroup.HasGroupChanged = true;
597 } 597 }
@@ -759,13 +759,10 @@ namespace OpenSim.Region.Framework.Scenes
759 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too 759 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
760 if (m_sitTargetAvatar != UUID.Zero) 760 if (m_sitTargetAvatar != UUID.Zero)
761 { 761 {
762 if (m_parentGroup != null) // TODO can there be a SOP without a SOG? 762 ScenePresence avatar;
763 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
763 { 764 {
764 ScenePresence avatar; 765 avatar.ParentPosition = GetWorldPosition();
765 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
766 {
767 avatar.ParentPosition = GetWorldPosition();
768 }
769 } 766 }
770 } 767 }
771 } 768 }
@@ -854,7 +851,9 @@ namespace OpenSim.Region.Framework.Scenes
854 actor.Orientation = resultingrotation; 851 actor.Orientation = resultingrotation;
855 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); 852 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
856 } 853 }
857 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 854
855 if (m_parentGroup != null)
856 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
858 //} 857 //}
859 } 858 }
860 catch (Exception ex) 859 catch (Exception ex)
@@ -862,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes
862 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); 861 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
863 } 862 }
864 } 863 }
865
866 } 864 }
867 } 865 }
868 866
@@ -1018,7 +1016,7 @@ namespace OpenSim.Region.Framework.Scenes
1018 m_shape.Scale = value; 1016 m_shape.Scale = value;
1019 1017
1020 PhysicsActor actor = PhysActor; 1018 PhysicsActor actor = PhysActor;
1021 if (actor != null && m_parentGroup != null) 1019 if (actor != null)
1022 { 1020 {
1023 if (m_parentGroup.Scene != null) 1021 if (m_parentGroup.Scene != null)
1024 { 1022 {
@@ -1059,7 +1057,7 @@ namespace OpenSim.Region.Framework.Scenes
1059 set 1057 set
1060 { 1058 {
1061 m_mediaUrl = value; 1059 m_mediaUrl = value;
1062 1060
1063 if (ParentGroup != null) 1061 if (ParentGroup != null)
1064 ParentGroup.HasGroupChanged = true; 1062 ParentGroup.HasGroupChanged = true;
1065 } 1063 }
@@ -1107,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
1107 set { m_sitTargetOrientation = value; } 1105 set { m_sitTargetOrientation = value; }
1108 } 1106 }
1109 1107
1110
1111 public Vector3 SitTargetPosition 1108 public Vector3 SitTargetPosition
1112 { 1109 {
1113 get { return m_sitTargetPosition; } 1110 get { return m_sitTargetPosition; }
@@ -1262,7 +1259,7 @@ namespace OpenSim.Region.Framework.Scenes
1262 { 1259 {
1263 get 1260 get
1264 { 1261 {
1265 if (ParentGroup != null && ParentGroup.Scene != null) 1262 if (ParentGroup.Scene != null)
1266 return ParentGroup.Scene.RegionInfo.RegionID; 1263 return ParentGroup.Scene.RegionInfo.RegionID;
1267 else 1264 else
1268 return UUID.Zero; 1265 return UUID.Zero;
@@ -1277,14 +1274,13 @@ namespace OpenSim.Region.Framework.Scenes
1277 get 1274 get
1278 { 1275 {
1279 if (ParentGroup != null) 1276 if (ParentGroup != null)
1280 {
1281 _parentUUID = ParentGroup.UUID; 1277 _parentUUID = ParentGroup.UUID;
1282 } 1278
1283 return _parentUUID; 1279 return _parentUUID;
1284 } 1280 }
1281
1285 set { _parentUUID = value; } 1282 set { _parentUUID = value; }
1286 } 1283 }
1287
1288 1284
1289 public string SitAnimation 1285 public string SitAnimation
1290 { 1286 {
@@ -1514,10 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
1514 impulse = newimpulse; 1510 impulse = newimpulse;
1515 } 1511 }
1516 1512
1517 if (m_parentGroup != null) 1513 m_parentGroup.applyAngularImpulse(impulse);
1518 {
1519 m_parentGroup.applyAngularImpulse(impulse);
1520 }
1521 } 1514 }
1522 1515
1523 /// <summary> 1516 /// <summary>
@@ -1540,10 +1533,7 @@ namespace OpenSim.Region.Framework.Scenes
1540 impulse = newimpulse; 1533 impulse = newimpulse;
1541 } 1534 }
1542 1535
1543 if (m_parentGroup != null) 1536 m_parentGroup.setAngularImpulse(impulse);
1544 {
1545 m_parentGroup.setAngularImpulse(impulse);
1546 }
1547 } 1537 }
1548 1538
1549 public Vector3 GetTorque() 1539 public Vector3 GetTorque()
@@ -1951,8 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes
1951 1941
1952 public bool GetDieAtEdge() 1942 public bool GetDieAtEdge()
1953 { 1943 {
1954 if (m_parentGroup == null)
1955 return false;
1956 if (m_parentGroup.IsDeleted) 1944 if (m_parentGroup.IsDeleted)
1957 return false; 1945 return false;
1958 1946
@@ -1961,8 +1949,6 @@ namespace OpenSim.Region.Framework.Scenes
1961 1949
1962 public bool GetReturnAtEdge() 1950 public bool GetReturnAtEdge()
1963 { 1951 {
1964 if (m_parentGroup == null)
1965 return false;
1966 if (m_parentGroup.IsDeleted) 1952 if (m_parentGroup.IsDeleted)
1967 return false; 1953 return false;
1968 1954
@@ -1971,8 +1957,6 @@ namespace OpenSim.Region.Framework.Scenes
1971 1957
1972 public void SetReturnAtEdge(bool p) 1958 public void SetReturnAtEdge(bool p)
1973 { 1959 {
1974 if (m_parentGroup == null)
1975 return;
1976 if (m_parentGroup.IsDeleted) 1960 if (m_parentGroup.IsDeleted)
1977 return; 1961 return;
1978 1962
@@ -1981,8 +1965,6 @@ namespace OpenSim.Region.Framework.Scenes
1981 1965
1982 public bool GetBlockGrab() 1966 public bool GetBlockGrab()
1983 { 1967 {
1984 if (m_parentGroup == null)
1985 return false;
1986 if (m_parentGroup.IsDeleted) 1968 if (m_parentGroup.IsDeleted)
1987 return false; 1969 return false;
1988 1970
@@ -1991,8 +1973,6 @@ namespace OpenSim.Region.Framework.Scenes
1991 1973
1992 public void SetBlockGrab(bool p) 1974 public void SetBlockGrab(bool p)
1993 { 1975 {
1994 if (m_parentGroup == null)
1995 return;
1996 if (m_parentGroup.IsDeleted) 1976 if (m_parentGroup.IsDeleted)
1997 return; 1977 return;
1998 1978
@@ -2001,8 +1981,6 @@ namespace OpenSim.Region.Framework.Scenes
2001 1981
2002 public void SetStatusSandbox(bool p) 1982 public void SetStatusSandbox(bool p)
2003 { 1983 {
2004 if (m_parentGroup == null)
2005 return;
2006 if (m_parentGroup.IsDeleted) 1984 if (m_parentGroup.IsDeleted)
2007 return; 1985 return;
2008 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; 1986 StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition;
@@ -2011,8 +1989,6 @@ namespace OpenSim.Region.Framework.Scenes
2011 1989
2012 public bool GetStatusSandbox() 1990 public bool GetStatusSandbox()
2013 { 1991 {
2014 if (m_parentGroup == null)
2015 return false;
2016 if (m_parentGroup.IsDeleted) 1992 if (m_parentGroup.IsDeleted)
2017 return false; 1993 return false;
2018 1994
@@ -2090,11 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
2090 2066
2091 public UUID GetRootPartUUID() 2067 public UUID GetRootPartUUID()
2092 { 2068 {
2093 if (m_parentGroup != null) 2069 return m_parentGroup.UUID;
2094 {
2095 return m_parentGroup.UUID;
2096 }
2097 return UUID.Zero;
2098 } 2070 }
2099 2071
2100 /// <summary> 2072 /// <summary>
@@ -2220,8 +2192,6 @@ namespace OpenSim.Region.Framework.Scenes
2220 m_lastColliders.Remove(localID); 2192 m_lastColliders.Remove(localID);
2221 } 2193 }
2222 2194
2223 if (m_parentGroup == null)
2224 return;
2225 if (m_parentGroup.IsDeleted) 2195 if (m_parentGroup.IsDeleted)
2226 return; 2196 return;
2227 2197
@@ -2242,9 +2212,6 @@ namespace OpenSim.Region.Framework.Scenes
2242 { 2212 {
2243 if (localId == 0) 2213 if (localId == 0)
2244 continue; 2214 continue;
2245 // always running this check because if the user deletes the object it would return a null reference.
2246 if (m_parentGroup == null)
2247 return;
2248 2215
2249 if (m_parentGroup.Scene == null) 2216 if (m_parentGroup.Scene == null)
2250 return; 2217 return;
@@ -2253,7 +2220,8 @@ namespace OpenSim.Region.Framework.Scenes
2253 string data = ""; 2220 string data = "";
2254 if (obj != null) 2221 if (obj != null)
2255 { 2222 {
2256 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2223 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
2224 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2257 { 2225 {
2258 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2226 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2259 //If it is 1, it is to accept ONLY collisions from this object 2227 //If it is 1, it is to accept ONLY collisions from this object
@@ -2300,7 +2268,8 @@ namespace OpenSim.Region.Framework.Scenes
2300 { 2268 {
2301 if (av.LocalId == localId) 2269 if (av.LocalId == localId)
2302 { 2270 {
2303 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2271 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2272 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2304 { 2273 {
2305 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2274 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2306 //If it is 1, it is to accept ONLY collisions from this avatar 2275 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2348,12 +2317,10 @@ namespace OpenSim.Region.Framework.Scenes
2348 if (colliding.Count > 0) 2317 if (colliding.Count > 0)
2349 { 2318 {
2350 StartCollidingMessage.Colliders = colliding; 2319 StartCollidingMessage.Colliders = colliding;
2351 // always running this check because if the user deletes the object it would return a null reference.
2352 if (m_parentGroup == null)
2353 return;
2354 2320
2355 if (m_parentGroup.Scene == null) 2321 if (m_parentGroup.Scene == null)
2356 return; 2322 return;
2323
2357 if (m_parentGroup.PassCollision == true) 2324 if (m_parentGroup.PassCollision == true)
2358 { 2325 {
2359 //TODO: Add pass to root prim! 2326 //TODO: Add pass to root prim!
@@ -2374,9 +2341,6 @@ namespace OpenSim.Region.Framework.Scenes
2374 // always running this check because if the user deletes the object it would return a null reference. 2341 // always running this check because if the user deletes the object it would return a null reference.
2375 if (localId == 0) 2342 if (localId == 0)
2376 continue; 2343 continue;
2377
2378 if (m_parentGroup == null)
2379 return;
2380 2344
2381 if (m_parentGroup.Scene == null) 2345 if (m_parentGroup.Scene == null)
2382 return; 2346 return;
@@ -2385,7 +2349,8 @@ namespace OpenSim.Region.Framework.Scenes
2385 string data = ""; 2349 string data = "";
2386 if (obj != null) 2350 if (obj != null)
2387 { 2351 {
2388 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) 2352 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
2353 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2389 { 2354 {
2390 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2355 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2391 //If it is 1, it is to accept ONLY collisions from this object 2356 //If it is 1, it is to accept ONLY collisions from this object
@@ -2432,7 +2397,8 @@ namespace OpenSim.Region.Framework.Scenes
2432 { 2397 {
2433 if (av.LocalId == localId) 2398 if (av.LocalId == localId)
2434 { 2399 {
2435 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2400 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2401 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2436 { 2402 {
2437 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2403 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2438 //If it is 1, it is to accept ONLY collisions from this avatar 2404 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2480,9 +2446,6 @@ namespace OpenSim.Region.Framework.Scenes
2480 if (colliding.Count > 0) 2446 if (colliding.Count > 0)
2481 { 2447 {
2482 CollidingMessage.Colliders = colliding; 2448 CollidingMessage.Colliders = colliding;
2483 // always running this check because if the user deletes the object it would return a null reference.
2484 if (m_parentGroup == null)
2485 return;
2486 2449
2487 if (m_parentGroup.Scene == null) 2450 if (m_parentGroup.Scene == null)
2488 return; 2451 return;
@@ -2503,11 +2466,9 @@ namespace OpenSim.Region.Framework.Scenes
2503 if (localId == 0) 2466 if (localId == 0)
2504 continue; 2467 continue;
2505 2468
2506 // always running this check because if the user deletes the object it would return a null reference.
2507 if (m_parentGroup == null)
2508 return;
2509 if (m_parentGroup.Scene == null) 2469 if (m_parentGroup.Scene == null)
2510 return; 2470 return;
2471
2511 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2472 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2512 string data = ""; 2473 string data = "";
2513 if (obj != null) 2474 if (obj != null)
@@ -2559,7 +2520,8 @@ namespace OpenSim.Region.Framework.Scenes
2559 { 2520 {
2560 if (av.LocalId == localId) 2521 if (av.LocalId == localId)
2561 { 2522 {
2562 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2523 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString())
2524 || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2563 { 2525 {
2564 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); 2526 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
2565 //If it is 1, it is to accept ONLY collisions from this avatar 2527 //If it is 1, it is to accept ONLY collisions from this avatar
@@ -2608,9 +2570,6 @@ namespace OpenSim.Region.Framework.Scenes
2608 if (colliding.Count > 0) 2570 if (colliding.Count > 0)
2609 { 2571 {
2610 EndCollidingMessage.Colliders = colliding; 2572 EndCollidingMessage.Colliders = colliding;
2611 // always running this check because if the user deletes the object it would return a null reference.
2612 if (m_parentGroup == null)
2613 return;
2614 2573
2615 if (m_parentGroup.Scene == null) 2574 if (m_parentGroup.Scene == null)
2616 return; 2575 return;
@@ -2619,6 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes
2619 } 2578 }
2620 } 2579 }
2621 } 2580 }
2581
2622 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) 2582 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2623 { 2583 {
2624 if (startedColliders.Count > 0) 2584 if (startedColliders.Count > 0)
@@ -2646,9 +2606,6 @@ namespace OpenSim.Region.Framework.Scenes
2646 if (colliding.Count > 0) 2606 if (colliding.Count > 0)
2647 { 2607 {
2648 LandStartCollidingMessage.Colliders = colliding; 2608 LandStartCollidingMessage.Colliders = colliding;
2649 // always running this check because if the user deletes the object it would return a null reference.
2650 if (m_parentGroup == null)
2651 return;
2652 2609
2653 if (m_parentGroup.Scene == null) 2610 if (m_parentGroup.Scene == null)
2654 return; 2611 return;
@@ -2657,6 +2614,7 @@ namespace OpenSim.Region.Framework.Scenes
2657 } 2614 }
2658 } 2615 }
2659 } 2616 }
2617
2660 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) 2618 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2661 { 2619 {
2662 if (m_lastColliders.Count > 0) 2620 if (m_lastColliders.Count > 0)
@@ -2684,9 +2642,6 @@ namespace OpenSim.Region.Framework.Scenes
2684 if (colliding.Count > 0) 2642 if (colliding.Count > 0)
2685 { 2643 {
2686 LandCollidingMessage.Colliders = colliding; 2644 LandCollidingMessage.Colliders = colliding;
2687 // always running this check because if the user deletes the object it would return a null reference.
2688 if (m_parentGroup == null)
2689 return;
2690 2645
2691 if (m_parentGroup.Scene == null) 2646 if (m_parentGroup.Scene == null)
2692 return; 2647 return;
@@ -2695,6 +2650,7 @@ namespace OpenSim.Region.Framework.Scenes
2695 } 2650 }
2696 } 2651 }
2697 } 2652 }
2653
2698 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) 2654 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2699 { 2655 {
2700 if (endedColliders.Count > 0) 2656 if (endedColliders.Count > 0)
@@ -2722,9 +2678,6 @@ namespace OpenSim.Region.Framework.Scenes
2722 if (colliding.Count > 0) 2678 if (colliding.Count > 0)
2723 { 2679 {
2724 LandEndCollidingMessage.Colliders = colliding; 2680 LandEndCollidingMessage.Colliders = colliding;
2725 // always running this check because if the user deletes the object it would return a null reference.
2726 if (m_parentGroup == null)
2727 return;
2728 2681
2729 if (m_parentGroup.Scene == null) 2682 if (m_parentGroup.Scene == null)
2730 return; 2683 return;
@@ -2748,10 +2701,12 @@ namespace OpenSim.Region.Framework.Scenes
2748 { 2701 {
2749 if (PhysActor != null) 2702 if (PhysActor != null)
2750 { 2703 {
2751
2752 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); 2704 Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
2753 2705
2754 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) 2706 if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
2707 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
2708 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E)
2709 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
2755 { 2710 {
2756 m_parentGroup.AbsolutePosition = newpos; 2711 m_parentGroup.AbsolutePosition = newpos;
2757 return; 2712 return;
@@ -2909,11 +2864,11 @@ namespace OpenSim.Region.Framework.Scenes
2909 public void ScheduleFullUpdate() 2864 public void ScheduleFullUpdate()
2910 { 2865 {
2911// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); 2866// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId);
2912 2867
2913 if (m_parentGroup != null) 2868 if (m_parentGroup == null)
2914 { 2869 return;
2915 m_parentGroup.QueueForUpdateCheck(); 2870
2916 } 2871 m_parentGroup.QueueForUpdateCheck();
2917 2872
2918 int timeNow = Util.UnixTimeSinceEpoch(); 2873 int timeNow = Util.UnixTimeSinceEpoch();
2919 2874
@@ -2942,13 +2897,14 @@ namespace OpenSim.Region.Framework.Scenes
2942 /// </summary> 2897 /// </summary>
2943 public void ScheduleTerseUpdate() 2898 public void ScheduleTerseUpdate()
2944 { 2899 {
2900 if (m_parentGroup == null)
2901 return;
2902
2945 if (m_updateFlag < 1) 2903 if (m_updateFlag < 1)
2946 { 2904 {
2947 if (m_parentGroup != null) 2905 m_parentGroup.HasGroupChanged = true;
2948 { 2906 m_parentGroup.QueueForUpdateCheck();
2949 m_parentGroup.HasGroupChanged = true; 2907
2950 m_parentGroup.QueueForUpdateCheck();
2951 }
2952 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); 2908 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
2953 m_updateFlag = 1; 2909 m_updateFlag = 1;
2954 2910
@@ -2960,10 +2916,7 @@ namespace OpenSim.Region.Framework.Scenes
2960 2916
2961 public void ScriptSetPhysicsStatus(bool UsePhysics) 2917 public void ScriptSetPhysicsStatus(bool UsePhysics)
2962 { 2918 {
2963 if (m_parentGroup == null) 2919 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2964 DoPhysicsPropertyUpdate(UsePhysics, false);
2965 else
2966 m_parentGroup.ScriptSetPhysicsStatus(UsePhysics);
2967 } 2920 }
2968 2921
2969 /// <summary> 2922 /// <summary>
@@ -3003,6 +2956,9 @@ namespace OpenSim.Region.Framework.Scenes
3003 /// <param name="clientFlags"></param> 2956 /// <param name="clientFlags"></param>
3004 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) 2957 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
3005 { 2958 {
2959 if (m_parentGroup == null)
2960 return;
2961
3006// m_log.DebugFormat( 2962// m_log.DebugFormat(
3007// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); 2963// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
3008 2964
@@ -3028,6 +2984,9 @@ namespace OpenSim.Region.Framework.Scenes
3028 /// </summary> 2984 /// </summary>
3029 public void SendFullUpdateToAllClients() 2985 public void SendFullUpdateToAllClients()
3030 { 2986 {
2987 if (m_parentGroup == null)
2988 return;
2989
3031 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 2990 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3032 { 2991 {
3033 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); 2992 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
@@ -3040,6 +2999,9 @@ namespace OpenSim.Region.Framework.Scenes
3040 /// <param name="agentID"></param> 2999 /// <param name="agentID"></param>
3041 public void SendFullUpdateToAllClientsExcept(UUID agentID) 3000 public void SendFullUpdateToAllClientsExcept(UUID agentID)
3042 { 3001 {
3002 if (m_parentGroup == null)
3003 return;
3004
3043 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 3005 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3044 { 3006 {
3045 // Ugly reference :( 3007 // Ugly reference :(
@@ -3068,6 +3030,9 @@ namespace OpenSim.Region.Framework.Scenes
3068 /// <param name="clientFlags"></param> 3030 /// <param name="clientFlags"></param>
3069 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) 3031 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
3070 { 3032 {
3033 if (ParentGroup == null)
3034 return;
3035
3071 // Suppress full updates during attachment editing 3036 // Suppress full updates during attachment editing
3072 // 3037 //
3073 if (ParentGroup.IsSelected && ParentGroup.IsAttachment) 3038 if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
@@ -3250,10 +3215,7 @@ namespace OpenSim.Region.Framework.Scenes
3250 3215
3251 public void SetAxisRotation(int axis, int rotate) 3216 public void SetAxisRotation(int axis, int rotate)
3252 { 3217 {
3253 if (m_parentGroup != null) 3218 m_parentGroup.SetAxisRotation(axis, rotate);
3254 {
3255 m_parentGroup.SetAxisRotation(axis, rotate);
3256 }
3257 3219
3258 //Cannot use ScriptBaseClass constants as no referance to it currently. 3220 //Cannot use ScriptBaseClass constants as no referance to it currently.
3259 if (axis == 2)//STATUS_ROTATE_X 3221 if (axis == 2)//STATUS_ROTATE_X
@@ -3276,8 +3238,6 @@ namespace OpenSim.Region.Framework.Scenes
3276 3238
3277 public void SetDieAtEdge(bool p) 3239 public void SetDieAtEdge(bool p)
3278 { 3240 {
3279 if (m_parentGroup == null)
3280 return;
3281 if (m_parentGroup.IsDeleted) 3241 if (m_parentGroup.IsDeleted)
3282 return; 3242 return;
3283 3243
@@ -3530,7 +3490,7 @@ namespace OpenSim.Region.Framework.Scenes
3530 } 3490 }
3531 3491
3532 /// <summary> 3492 /// <summary>
3533 /// 3493 /// Set the parent group of this prim.
3534 /// </summary> 3494 /// </summary>
3535 public void SetParent(SceneObjectGroup parent) 3495 public void SetParent(SceneObjectGroup parent)
3536 { 3496 {
@@ -3587,8 +3547,11 @@ namespace OpenSim.Region.Framework.Scenes
3587 { 3547 {
3588 Text = text; 3548 Text = text;
3589 3549
3590 ParentGroup.HasGroupChanged = true; 3550 if (ParentGroup != null)
3591 ScheduleFullUpdate(); 3551 {
3552 ParentGroup.HasGroupChanged = true;
3553 ScheduleFullUpdate();
3554 }
3592 } 3555 }
3593 3556
3594 public void StopLookAt() 3557 public void StopLookAt()
@@ -3632,7 +3595,7 @@ namespace OpenSim.Region.Framework.Scenes
3632 { 3595 {
3633 if (!IgnoreUndoUpdate) 3596 if (!IgnoreUndoUpdate)
3634 { 3597 {
3635 if (m_parentGroup != null) 3598 if (ParentGroup != null)
3636 { 3599 {
3637 lock (m_undo) 3600 lock (m_undo)
3638 { 3601 {
@@ -3644,31 +3607,31 @@ namespace OpenSim.Region.Framework.Scenes
3644 // TODO: May need to fix for group comparison 3607 // TODO: May need to fix for group comparison
3645 if (last.Compare(this)) 3608 if (last.Compare(this))
3646 { 3609 {
3647// m_log.DebugFormat( 3610 // m_log.DebugFormat(
3648// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", 3611 // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3649// Name, LocalId, m_undo.Count); 3612 // Name, LocalId, m_undo.Count);
3650 3613
3651 return; 3614 return;
3652 } 3615 }
3653 } 3616 }
3654 } 3617 }
3655 3618
3656// m_log.DebugFormat( 3619 // m_log.DebugFormat(
3657// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", 3620 // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
3658// Name, LocalId, forGroup, m_undo.Count); 3621 // Name, LocalId, forGroup, m_undo.Count);
3659 3622
3660 if (m_parentGroup.GetSceneMaxUndo() > 0) 3623 if (m_parentGroup.GetSceneMaxUndo() > 0)
3661 { 3624 {
3662 UndoState nUndo = new UndoState(this, forGroup); 3625 UndoState nUndo = new UndoState(this, forGroup);
3663 3626
3664 m_undo.Push(nUndo); 3627 m_undo.Push(nUndo);
3665 3628
3666 if (m_redo.Count > 0) 3629 if (m_redo.Count > 0)
3667 m_redo.Clear(); 3630 m_redo.Clear();
3668 3631
3669// m_log.DebugFormat( 3632 // m_log.DebugFormat(
3670// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", 3633 // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
3671// Name, LocalId, forGroup, m_undo.Count); 3634 // Name, LocalId, forGroup, m_undo.Count);
3672 } 3635 }
3673 } 3636 }
3674 } 3637 }
@@ -4245,8 +4208,11 @@ namespace OpenSim.Region.Framework.Scenes
4245 } 4208 }
4246 } 4209 }
4247 4210
4248 ParentGroup.HasGroupChanged = true; 4211 if (ParentGroup != null)
4249 ScheduleFullUpdate(); 4212 {
4213 ParentGroup.HasGroupChanged = true;
4214 ScheduleFullUpdate();
4215 }
4250 } 4216 }
4251 4217
4252 public void UpdateGroupPosition(Vector3 pos) 4218 public void UpdateGroupPosition(Vector3 pos)
@@ -4450,14 +4416,12 @@ namespace OpenSim.Region.Framework.Scenes
4450 if (!wasUsingPhysics) 4416 if (!wasUsingPhysics)
4451 { 4417 {
4452 DoPhysicsPropertyUpdate(UsePhysics, false); 4418 DoPhysicsPropertyUpdate(UsePhysics, false);
4453 if (m_parentGroup != null) 4419
4420 if (!m_parentGroup.IsDeleted)
4454 { 4421 {
4455 if (!m_parentGroup.IsDeleted) 4422 if (LocalId == m_parentGroup.RootPart.LocalId)
4456 { 4423 {
4457 if (LocalId == m_parentGroup.RootPart.LocalId) 4424 m_parentGroup.CheckSculptAndLoad();
4458 {
4459 m_parentGroup.CheckSculptAndLoad();
4460 }
4461 } 4425 }
4462 } 4426 }
4463 } 4427 }
@@ -4510,14 +4474,11 @@ namespace OpenSim.Region.Framework.Scenes
4510 PhysActor.SetMaterial(Material); 4474 PhysActor.SetMaterial(Material);
4511 DoPhysicsPropertyUpdate(UsePhysics, true); 4475 DoPhysicsPropertyUpdate(UsePhysics, true);
4512 4476
4513 if (m_parentGroup != null) 4477 if (!m_parentGroup.IsDeleted)
4514 { 4478 {
4515 if (!m_parentGroup.IsDeleted) 4479 if (LocalId == m_parentGroup.RootPart.LocalId)
4516 { 4480 {
4517 if (LocalId == m_parentGroup.RootPart.LocalId) 4481 m_parentGroup.CheckSculptAndLoad();
4518 {
4519 m_parentGroup.CheckSculptAndLoad();
4520 }
4521 } 4482 }
4522 } 4483 }
4523 4484
@@ -4541,14 +4502,12 @@ namespace OpenSim.Region.Framework.Scenes
4541 pa.IsPhysical = UsePhysics; 4502 pa.IsPhysical = UsePhysics;
4542 4503
4543 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim 4504 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
4544 if (m_parentGroup != null) 4505
4506 if (!m_parentGroup.IsDeleted)
4545 { 4507 {
4546 if (!m_parentGroup.IsDeleted) 4508 if (LocalId == m_parentGroup.RootPart.LocalId)
4547 { 4509 {
4548 if (LocalId == m_parentGroup.RootPart.LocalId) 4510 m_parentGroup.CheckSculptAndLoad();
4549 {
4550 m_parentGroup.CheckSculptAndLoad();
4551 }
4552 } 4511 }
4553 } 4512 }
4554 } 4513 }
@@ -4591,8 +4550,11 @@ namespace OpenSim.Region.Framework.Scenes
4591 } 4550 }
4592 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 4551 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
4593 4552
4594 ParentGroup.HasGroupChanged = true; 4553 if (ParentGroup != null)
4595 ScheduleFullUpdate(); 4554 {
4555 ParentGroup.HasGroupChanged = true;
4556 ScheduleFullUpdate();
4557 }
4596 4558
4597// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); 4559// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4598 } 4560 }
@@ -4605,8 +4567,12 @@ namespace OpenSim.Region.Framework.Scenes
4605 (rot.W != RotationOffset.W)) 4567 (rot.W != RotationOffset.W))
4606 { 4568 {
4607 RotationOffset = rot; 4569 RotationOffset = rot;
4608 ParentGroup.HasGroupChanged = true; 4570
4609 ScheduleTerseUpdate(); 4571 if (ParentGroup != null)
4572 {
4573 ParentGroup.HasGroupChanged = true;
4574 ScheduleTerseUpdate();
4575 }
4610 } 4576 }
4611 } 4577 }
4612 4578
@@ -4797,14 +4763,6 @@ namespace OpenSim.Region.Framework.Scenes
4797 } 4763 }
4798 } 4764 }
4799 4765
4800 if (m_parentGroup == null)
4801 {
4802// m_log.DebugFormat(
4803// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId);
4804 ScheduleFullUpdate();
4805 return;
4806 }
4807
4808 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 4766 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
4809 //{ 4767 //{
4810 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; 4768 // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
@@ -4830,36 +4788,22 @@ namespace OpenSim.Region.Framework.Scenes
4830 4788
4831 public int registerTargetWaypoint(Vector3 target, float tolerance) 4789 public int registerTargetWaypoint(Vector3 target, float tolerance)
4832 { 4790 {
4833 if (m_parentGroup != null) 4791 return m_parentGroup.registerTargetWaypoint(target, tolerance);
4834 {
4835 return m_parentGroup.registerTargetWaypoint(target, tolerance);
4836 }
4837 return 0;
4838 } 4792 }
4839 4793
4840 public void unregisterTargetWaypoint(int handle) 4794 public void unregisterTargetWaypoint(int handle)
4841 { 4795 {
4842 if (m_parentGroup != null) 4796 m_parentGroup.unregisterTargetWaypoint(handle);
4843 {
4844 m_parentGroup.unregisterTargetWaypoint(handle);
4845 }
4846 } 4797 }
4847 4798
4848 public int registerRotTargetWaypoint(Quaternion target, float tolerance) 4799 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
4849 { 4800 {
4850 if (m_parentGroup != null) 4801 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4851 {
4852 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4853 }
4854 return 0;
4855 } 4802 }
4856 4803
4857 public void unregisterRotTargetWaypoint(int handle) 4804 public void unregisterRotTargetWaypoint(int handle)
4858 { 4805 {
4859 if (m_parentGroup != null) 4806 m_parentGroup.unregisterRotTargetWaypoint(handle);
4860 {
4861 m_parentGroup.unregisterRotTargetWaypoint(handle);
4862 }
4863 } 4807 }
4864 4808
4865 public void SetCameraAtOffset(Vector3 v) 4809 public void SetCameraAtOffset(Vector3 v)
@@ -4901,7 +4845,7 @@ namespace OpenSim.Region.Framework.Scenes
4901 4845
4902 public void SendTerseUpdateToClient(IClientAPI remoteClient) 4846 public void SendTerseUpdateToClient(IClientAPI remoteClient)
4903 { 4847 {
4904 if (ParentGroup == null || ParentGroup.IsDeleted) 4848 if (ParentGroup.IsDeleted)
4905 return; 4849 return;
4906 4850
4907 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this) 4851 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 108089e..e40e57d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -112,15 +112,17 @@ namespace OpenSim.Region.Framework.Scenes
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating 115 /// Reset UUIDs for all the items in the prim's inventory.
116 /// </summary>
117 /// <remarks>
118 /// This involves either generating
116 /// new ones or setting existing UUIDs to the correct parent UUIDs. 119 /// new ones or setting existing UUIDs to the correct parent UUIDs.
117 /// 120 ///
118 /// If this method is called and there are inventory items, then we regard the inventory as having changed. 121 /// If this method is called and there are inventory items, then we regard the inventory as having changed.
119 /// </summary> 122 /// </remarks>
120 /// <param name="linkNum">Link number for the part</param>
121 public void ResetInventoryIDs() 123 public void ResetInventoryIDs()
122 { 124 {
123 if (null == m_part || null == m_part.ParentGroup) 125 if (null == m_part)
124 return; 126 return;
125 127
126 lock (m_items) 128 lock (m_items)
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 997845b..e2ea830 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes
110 { 110 {
111 SceneObjectPart part = m_partsUpdateQueue.Dequeue(); 111 SceneObjectPart part = m_partsUpdateQueue.Dequeue();
112 112
113 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 113 if (part.ParentGroup.IsDeleted)
114 continue; 114 continue;
115 115
116 if (m_updateTimes.ContainsKey(part.UUID)) 116 if (m_updateTimes.ContainsKey(part.UUID))
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a7f08d9..dff7269 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -234,35 +234,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
234 switch (linkType) 234 switch (linkType)
235 { 235 {
236 case ScriptBaseClass.LINK_SET: 236 case ScriptBaseClass.LINK_SET:
237 if (m_host.ParentGroup != null) 237 return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
238 {
239 return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
240 }
241 return ret;
242 238
243 case ScriptBaseClass.LINK_ROOT: 239 case ScriptBaseClass.LINK_ROOT:
244 if (m_host.ParentGroup != null) 240 ret = new List<SceneObjectPart>();
245 { 241 ret.Add(m_host.ParentGroup.RootPart);
246 ret = new List<SceneObjectPart>();
247 ret.Add(m_host.ParentGroup.RootPart);
248 return ret;
249 }
250 return ret; 242 return ret;
251 243
252 case ScriptBaseClass.LINK_ALL_OTHERS: 244 case ScriptBaseClass.LINK_ALL_OTHERS:
253 if (m_host.ParentGroup == null)
254 return new List<SceneObjectPart>();
255
256 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 245 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
257 246
258 if (ret.Contains(m_host)) 247 if (ret.Contains(m_host))
259 ret.Remove(m_host); 248 ret.Remove(m_host);
249
260 return ret; 250 return ret;
261 251
262 case ScriptBaseClass.LINK_ALL_CHILDREN: 252 case ScriptBaseClass.LINK_ALL_CHILDREN:
263 if (m_host.ParentGroup == null)
264 return new List<SceneObjectPart>();
265
266 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); 253 ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
267 254
268 if (ret.Contains(m_host.ParentGroup.RootPart)) 255 if (ret.Contains(m_host.ParentGroup.RootPart))
@@ -273,15 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
273 return ret; 260 return ret;
274 261
275 default: 262 default:
276 if (linkType < 0 || m_host.ParentGroup == null) 263 if (linkType < 0)
277 return new List<SceneObjectPart>(); 264 return new List<SceneObjectPart>();
265
278 SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); 266 SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
279 if (target == null) 267 if (target == null)
280 return new List<SceneObjectPart>(); 268 return new List<SceneObjectPart>();
281 ret = new List<SceneObjectPart>(); 269 ret = new List<SceneObjectPart>();
282 ret.Add(target); 270 ret.Add(target);
283 return ret; 271 return ret;
284
285 } 272 }
286 } 273 }
287 274
@@ -1199,8 +1186,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1199 if (value != 0) 1186 if (value != 0)
1200 { 1187 {
1201 SceneObjectGroup group = m_host.ParentGroup; 1188 SceneObjectGroup group = m_host.ParentGroup;
1202 if (group == null)
1203 return;
1204 bool allow = true; 1189 bool allow = true;
1205 1190
1206 foreach (SceneObjectPart part in group.Parts) 1191 foreach (SceneObjectPart part in group.Parts)
@@ -1214,16 +1199,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1214 1199
1215 if (!allow) 1200 if (!allow)
1216 return; 1201 return;
1202
1217 m_host.ScriptSetPhysicsStatus(true); 1203 m_host.ScriptSetPhysicsStatus(true);
1218 } 1204 }
1219 else 1205 else
1206 {
1220 m_host.ScriptSetPhysicsStatus(false); 1207 m_host.ScriptSetPhysicsStatus(false);
1208 }
1221 } 1209 }
1222 1210
1223 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) 1211 if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM)
1224 { 1212 {
1225 if (m_host.ParentGroup != null) 1213 m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
1226 m_host.ParentGroup.ScriptSetPhantomStatus(value != 0);
1227 } 1214 }
1228 1215
1229 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) 1216 if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS)
@@ -1365,8 +1352,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1365 protected void SetScale(SceneObjectPart part, LSL_Vector scale) 1352 protected void SetScale(SceneObjectPart part, LSL_Vector scale)
1366 { 1353 {
1367 // TODO: this needs to trigger a persistance save as well 1354 // TODO: this needs to trigger a persistance save as well
1368 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 1355 if (part == null || part.ParentGroup.IsDeleted)
1369 return; 1356 return;
1357
1370 if (scale.x < 0.01) 1358 if (scale.x < 0.01)
1371 scale.x = 0.01; 1359 scale.x = 0.01;
1372 if (scale.y < 0.01) 1360 if (scale.y < 0.01)
@@ -1409,7 +1397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1409 { 1397 {
1410 m_host.AddScriptLPS(1); 1398 m_host.AddScriptLPS(1);
1411 m_host.ClickAction = (byte)action; 1399 m_host.ClickAction = (byte)action;
1412 if (m_host.ParentGroup != null) m_host.ParentGroup.HasGroupChanged = true; 1400 m_host.ParentGroup.HasGroupChanged = true;
1413 m_host.ScheduleFullUpdate(); 1401 m_host.ScheduleFullUpdate();
1414 return; 1402 return;
1415 } 1403 }
@@ -2033,14 +2021,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2033 else 2021 else
2034 { 2022 {
2035 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 2023 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
2036 SceneObjectGroup group = m_host.ParentGroup; 2024 SceneObjectPart rootPart = m_host.ParentGroup.RootPart;
2037 if (group != null) // a bit paranoid, maybe 2025 if (rootPart != null) // better safe than sorry
2038 { 2026 {
2039 SceneObjectPart rootPart = group.RootPart; 2027 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2040 if (rootPart != null) // again, better safe than sorry
2041 {
2042 SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot));
2043 }
2044 } 2028 }
2045 } 2029 }
2046 2030
@@ -2128,15 +2112,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2128 { 2112 {
2129 m_host.AddScriptLPS(1); 2113 m_host.AddScriptLPS(1);
2130 2114
2131 if (m_host.ParentGroup != null) 2115 if (!m_host.ParentGroup.IsDeleted)
2132 { 2116 {
2133 if (!m_host.ParentGroup.IsDeleted) 2117 if (local != 0)
2134 { 2118 force *= llGetRot();
2135 if (local != 0)
2136 force *= llGetRot();
2137 2119
2138 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); 2120 m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
2139 }
2140 } 2121 }
2141 } 2122 }
2142 2123
@@ -2146,15 +2127,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2146 2127
2147 m_host.AddScriptLPS(1); 2128 m_host.AddScriptLPS(1);
2148 2129
2149 if (m_host.ParentGroup != null) 2130 if (!m_host.ParentGroup.IsDeleted)
2150 { 2131 {
2151 if (!m_host.ParentGroup.IsDeleted) 2132 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
2152 { 2133 force.x = tmpForce.X;
2153 Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); 2134 force.y = tmpForce.Y;
2154 force.x = tmpForce.X; 2135 force.z = tmpForce.Z;
2155 force.y = tmpForce.Y;
2156 force.z = tmpForce.Z;
2157 }
2158 } 2136 }
2159 2137
2160 return force; 2138 return force;
@@ -3163,12 +3141,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3163 public void llSetBuoyancy(double buoyancy) 3141 public void llSetBuoyancy(double buoyancy)
3164 { 3142 {
3165 m_host.AddScriptLPS(1); 3143 m_host.AddScriptLPS(1);
3166 if (m_host.ParentGroup != null) 3144
3145 if (!m_host.ParentGroup.IsDeleted)
3167 { 3146 {
3168 if (!m_host.ParentGroup.IsDeleted) 3147 m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
3169 {
3170 m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
3171 }
3172 } 3148 }
3173 } 3149 }
3174 3150
@@ -6238,12 +6214,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6238 public void llSetVehicleType(int type) 6214 public void llSetVehicleType(int type)
6239 { 6215 {
6240 m_host.AddScriptLPS(1); 6216 m_host.AddScriptLPS(1);
6241 if (m_host.ParentGroup != null) 6217
6218 if (!m_host.ParentGroup.IsDeleted)
6242 { 6219 {
6243 if (!m_host.ParentGroup.IsDeleted) 6220 m_host.ParentGroup.RootPart.SetVehicleType(type);
6244 {
6245 m_host.ParentGroup.RootPart.SetVehicleType(type);
6246 }
6247 } 6221 }
6248 } 6222 }
6249 6223
@@ -6253,12 +6227,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6253 { 6227 {
6254 m_host.AddScriptLPS(1); 6228 m_host.AddScriptLPS(1);
6255 6229
6256 if (m_host.ParentGroup != null) 6230 if (!m_host.ParentGroup.IsDeleted)
6257 { 6231 {
6258 if (!m_host.ParentGroup.IsDeleted) 6232 m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
6259 {
6260 m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
6261 }
6262 } 6233 }
6263 } 6234 }
6264 6235
@@ -6267,13 +6238,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6267 public void llSetVehicleVectorParam(int param, LSL_Vector vec) 6238 public void llSetVehicleVectorParam(int param, LSL_Vector vec)
6268 { 6239 {
6269 m_host.AddScriptLPS(1); 6240 m_host.AddScriptLPS(1);
6270 if (m_host.ParentGroup != null) 6241
6242 if (!m_host.ParentGroup.IsDeleted)
6271 { 6243 {
6272 if (!m_host.ParentGroup.IsDeleted) 6244 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6273 { 6245 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6274 m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
6275 new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
6276 }
6277 } 6246 }
6278 } 6247 }
6279 6248
@@ -6282,37 +6251,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6282 public void llSetVehicleRotationParam(int param, LSL_Rotation rot) 6251 public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
6283 { 6252 {
6284 m_host.AddScriptLPS(1); 6253 m_host.AddScriptLPS(1);
6285 if (m_host.ParentGroup != null) 6254
6255 if (!m_host.ParentGroup.IsDeleted)
6286 { 6256 {
6287 if (!m_host.ParentGroup.IsDeleted) 6257 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot));
6288 {
6289 m_host.ParentGroup.RootPart.SetVehicleRotationParam(param,
6290 Rot2Quaternion(rot));
6291 }
6292 } 6258 }
6293 } 6259 }
6294 6260
6295 public void llSetVehicleFlags(int flags) 6261 public void llSetVehicleFlags(int flags)
6296 { 6262 {
6297 m_host.AddScriptLPS(1); 6263 m_host.AddScriptLPS(1);
6298 if (m_host.ParentGroup != null) 6264
6265 if (!m_host.ParentGroup.IsDeleted)
6299 { 6266 {
6300 if (!m_host.ParentGroup.IsDeleted) 6267 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6301 {
6302 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
6303 }
6304 } 6268 }
6305 } 6269 }
6306 6270
6307 public void llRemoveVehicleFlags(int flags) 6271 public void llRemoveVehicleFlags(int flags)
6308 { 6272 {
6309 m_host.AddScriptLPS(1); 6273 m_host.AddScriptLPS(1);
6310 if (m_host.ParentGroup != null) 6274
6275 if (!m_host.ParentGroup.IsDeleted)
6311 { 6276 {
6312 if (!m_host.ParentGroup.IsDeleted) 6277 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6313 {
6314 m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
6315 }
6316 } 6278 }
6317 } 6279 }
6318 6280
@@ -6467,11 +6429,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6467 public void llVolumeDetect(int detect) 6429 public void llVolumeDetect(int detect)
6468 { 6430 {
6469 m_host.AddScriptLPS(1); 6431 m_host.AddScriptLPS(1);
6470 if (m_host.ParentGroup != null) 6432
6471 { 6433 if (!m_host.ParentGroup.IsDeleted)
6472 if (!m_host.ParentGroup.IsDeleted) 6434 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6473 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6474 }
6475 } 6435 }
6476 6436
6477 /// <summary> 6437 /// <summary>
@@ -7022,14 +6982,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7022 else 6982 else
7023 { 6983 {
7024 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 6984 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
7025 SceneObjectGroup group = part.ParentGroup; 6985 SceneObjectPart rootPart = part.ParentGroup.RootPart;
7026 if (group != null) // a bit paranoid, maybe 6986 if (rootPart != null) // better safe than sorry
7027 { 6987 {
7028 SceneObjectPart rootPart = group.RootPart; 6988 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7029 if (rootPart != null) // again, better safe than sorry
7030 {
7031 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7032 }
7033 } 6989 }
7034 } 6990 }
7035 6991
@@ -7278,13 +7234,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7278 break; 7234 break;
7279 7235
7280 case (int)ScriptBaseClass.PRIM_PHANTOM: 7236 case (int)ScriptBaseClass.PRIM_PHANTOM:
7281 if (remain < 1) 7237 if (remain < 1)
7282 return; 7238 return;
7283 7239
7284 string ph = rules.Data[idx++].ToString(); 7240 string ph = rules.Data[idx++].ToString();
7285 7241 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
7286 if (m_host.ParentGroup != null)
7287 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
7288 7242
7289 break; 7243 break;
7290 7244
@@ -7307,8 +7261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7307 return; 7261 return;
7308 string temp = rules.Data[idx++].ToString(); 7262 string temp = rules.Data[idx++].ToString();
7309 7263
7310 if (m_host.ParentGroup != null) 7264 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
7311 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
7312 7265
7313 break; 7266 break;
7314 7267
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index d791885..7f3d84d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -672,13 +672,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
672 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); 672 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater");
673 673
674 m_host.AddScriptLPS(1); 674 m_host.AddScriptLPS(1);
675 if (m_host.ParentGroup != null) 675
676 { 676 if (m_host.ParentGroup.RootPart != null)
677 if (m_host.ParentGroup.RootPart != null) 677 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
678 {
679 m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
680 }
681 }
682 } 678 }
683 679
684 // Teleport functions 680 // Teleport functions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 3575889..8cebb4a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
197 return; 197 return;
198 } 198 }
199 199
200 part=part.ParentGroup.RootPart; // We detect objects only 200 part = part.ParentGroup.RootPart; // We detect objects only
201 201
202 LinkNum = 0; // Not relevant 202 LinkNum = 0; // Not relevant
203 203
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index ef9b2ac..6e9f3ec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -766,13 +766,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
766 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException)) 766 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
767 { 767 {
768 m_InSelfDelete = true; 768 m_InSelfDelete = true;
769 if (part != null && part.ParentGroup != null) 769 if (part != null)
770 m_Engine.World.DeleteSceneObject(part.ParentGroup, false); 770 m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
771 } 771 }
772 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) 772 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
773 { 773 {
774 m_InSelfDelete = true; 774 m_InSelfDelete = true;
775 if (part != null && part.ParentGroup != null) 775 if (part != null)
776 part.Inventory.RemoveInventoryItem(m_ItemID); 776 part.Inventory.RemoveInventoryItem(m_ItemID);
777 } 777 }
778 } 778 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 0ac8b5c..08dc71e 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -97,8 +97,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
97 return; 97 return;
98 98
99 m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount); 99 m_log.Debug("Paid: " + objectID + " from " + agentID + ", amount " + amount);
100 if (part.ParentGroup != null) 100
101 part = part.ParentGroup.RootPart; 101 part = part.ParentGroup.RootPart;
102 102
103 if (part != null) 103 if (part != null)
104 { 104 {