aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs6
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs8
16 files changed, 83 insertions, 113 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 2b8fa59..cac8cac 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -304,9 +304,9 @@ namespace OpenSim.Data.Tests
304 regionInfo.RegionLocX = 0; 304 regionInfo.RegionLocX = 0;
305 regionInfo.RegionLocY = 0; 305 regionInfo.RegionLocY = 0;
306 306
307// Scene scene = new Scene(regionInfo);
308
309 SceneObjectPart sop = new SceneObjectPart(); 307 SceneObjectPart sop = new SceneObjectPart();
308 SceneObjectGroup sog = new SceneObjectGroup(sop);
309
310 sop.RegionHandle = regionh; 310 sop.RegionHandle = regionh;
311 sop.UUID = uuid; 311 sop.UUID = uuid;
312 sop.LocalId = localid; 312 sop.LocalId = localid;
@@ -373,8 +373,6 @@ namespace OpenSim.Data.Tests
373 373
374 // This is necessary or object will not be inserted in DB 374 // This is necessary or object will not be inserted in DB
375 sop.Flags = PrimFlags.None; 375 sop.Flags = PrimFlags.None;
376
377 SceneObjectGroup sog = new SceneObjectGroup(sop);
378 376
379 // Inserts group in DB 377 // Inserts group in DB
380 db.StoreObject(sog,region3); 378 db.StoreObject(sog,region3);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 8189518..c07fc73 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -330,7 +330,7 @@ namespace OpenSim.Region.ClientStack.Linden
330 grp.AbsolutePosition = obj.Position; 330 grp.AbsolutePosition = obj.Position;
331 prim.RotationOffset = obj.Rotation; 331 prim.RotationOffset = obj.Rotation;
332 332
333 grp.RootPart.IsAttachment = false; 333 grp.IsAttachment = false;
334 // Required for linking 334 // Required for linking
335 grp.RootPart.UpdateFlag = 0; 335 grp.RootPart.UpdateFlag = 0;
336 336
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index f71871e..dc9a6ed 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4756,7 +4756,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4756 { 4756 {
4757 SceneObjectPart part = (SceneObjectPart)entity; 4757 SceneObjectPart part = (SceneObjectPart)entity;
4758 4758
4759 attachPoint = part.AttachmentPoint; 4759 if (part.ParentGroup != null)
4760 attachPoint = part.ParentGroup.AttachmentPoint;
4761 else
4762 attachPoint = 0;
4763
4760 collisionPlane = Vector4.Zero; 4764 collisionPlane = Vector4.Zero;
4761 position = part.RelativePosition; 4765 position = part.RelativePosition;
4762 velocity = part.Velocity; 4766 velocity = part.Velocity;
@@ -4913,10 +4917,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4913 //update.JointType = 0; 4917 //update.JointType = 0;
4914 update.Material = data.Material; 4918 update.Material = data.Material;
4915 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 4919 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
4916 if (data.IsAttachment) 4920 if (data.ParentGroup != null && data.ParentGroup.IsAttachment)
4917 { 4921 {
4918 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID); 4922 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
4919 update.State = (byte)((data.AttachmentPoint % 16) * 16 + (data.AttachmentPoint / 16)); 4923 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
4920 } 4924 }
4921 else 4925 else
4922 { 4926 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 3e1cb02..b976020 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -369,11 +369,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
369 SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt) 369 SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt)
370 { 370 {
371// m_log.DebugFormat( 371// m_log.DebugFormat(
372// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", 372// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} {2} (item ID {3}) at {4}",
373// remoteClient.Name, att.Name, itemID); 373// sp.Name, att.Name, att.LocalId, itemID, AttachmentPt);
374 374
375 if (!att.IsDeleted) 375 if (!att.IsDeleted)
376 AttachmentPt = att.RootPart.AttachmentPoint; 376 AttachmentPt = att.AttachmentPoint;
377 377
378 InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); 378 InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
379 item = m_scene.InventoryService.GetItem(item); 379 item = m_scene.InventoryService.GetItem(item);
@@ -547,7 +547,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
547 ); 547 );
548 548
549 group.RootPart.SetParentLocalId(0); 549 group.RootPart.SetParentLocalId(0);
550 group.RootPart.IsAttachment = false; 550 group.IsAttachment = false;
551 group.AbsolutePosition = group.RootPart.AttachedPos; 551 group.AbsolutePosition = group.RootPart.AttachedPos;
552 552
553 UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); 553 UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID);
@@ -569,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
569 // Finally, we restore the object's attachment status. 569 // Finally, we restore the object's attachment status.
570 byte attachmentPoint = sog.GetAttachmentPoint(); 570 byte attachmentPoint = sog.GetAttachmentPoint();
571 sog.UpdateGroupPosition(pos); 571 sog.UpdateGroupPosition(pos);
572 sog.RootPart.IsAttachment = false; 572 sog.IsAttachment = false;
573 sog.AbsolutePosition = sog.RootPart.AttachedPos; 573 sog.AbsolutePosition = sog.RootPart.AttachedPos;
574 sog.SetAttachmentPoint(attachmentPoint); 574 sog.SetAttachmentPoint(attachmentPoint);
575 sog.HasGroupChanged = true; 575 sog.HasGroupChanged = true;
@@ -666,8 +666,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
666 666
667 so.AbsolutePosition = attachOffset; 667 so.AbsolutePosition = attachOffset;
668 so.RootPart.AttachedPos = attachOffset; 668 so.RootPart.AttachedPos = attachOffset;
669 so.RootPart.IsAttachment = true; 669 so.IsAttachment = true;
670
671 so.RootPart.SetParentLocalId(avatar.LocalId); 670 so.RootPart.SetParentLocalId(avatar.LocalId);
672 so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); 671 so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
673 672
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index b7d21fd..790a651 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -110,6 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
110 Assert.That(attachments.Count, Is.EqualTo(1)); 110 Assert.That(attachments.Count, Is.EqualTo(1));
111 SceneObjectGroup attSo = attachments[0]; 111 SceneObjectGroup attSo = attachments[0];
112 Assert.That(attSo.Name, Is.EqualTo(attName)); 112 Assert.That(attSo.Name, Is.EqualTo(attName));
113 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
113 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); 114 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
114 Assert.That(attSo.IsAttachment); 115 Assert.That(attSo.IsAttachment);
115 Assert.That(attSo.UsesPhysics, Is.False); 116 Assert.That(attSo.UsesPhysics, Is.False);
@@ -132,9 +133,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
132 UUID attAssetId = TestHelpers.ParseTail(0x3); 133 UUID attAssetId = TestHelpers.ParseTail(0x3);
133 string attName = "att"; 134 string attName = "att";
134 135
135 InventoryItemBase attItem 136 UserInventoryHelpers.CreateInventoryItem(
136 = UserInventoryHelpers.CreateInventoryItem( 137 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
137 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
138 138
139 m_attMod.RezSingleAttachmentFromInventory( 139 m_attMod.RezSingleAttachmentFromInventory(
140 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 140 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
@@ -145,6 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
145 Assert.That(attachments.Count, Is.EqualTo(1)); 145 Assert.That(attachments.Count, Is.EqualTo(1));
146 SceneObjectGroup attSo = attachments[0]; 146 SceneObjectGroup attSo = attachments[0];
147 Assert.That(attSo.Name, Is.EqualTo(attName)); 147 Assert.That(attSo.Name, Is.EqualTo(attName));
148 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
148 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); 149 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
149 Assert.That(attSo.IsAttachment); 150 Assert.That(attSo.IsAttachment);
150 Assert.That(attSo.UsesPhysics, Is.False); 151 Assert.That(attSo.UsesPhysics, Is.False);
@@ -166,9 +167,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
166 UUID attAssetId = TestHelpers.ParseTail(0x3); 167 UUID attAssetId = TestHelpers.ParseTail(0x3);
167 string attName = "att"; 168 string attName = "att";
168 169
169 InventoryItemBase attItem 170 UserInventoryHelpers.CreateInventoryItem(
170 = UserInventoryHelpers.CreateInventoryItem( 171 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
171 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
172 172
173 UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( 173 UUID attSoId = m_attMod.RezSingleAttachmentFromInventory(
174 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 174 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
@@ -198,9 +198,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
198 UUID attAssetId = TestHelpers.ParseTail(0x3); 198 UUID attAssetId = TestHelpers.ParseTail(0x3);
199 string attName = "att"; 199 string attName = "att";
200 200
201 InventoryItemBase attItem 201 UserInventoryHelpers.CreateInventoryItem(
202 = UserInventoryHelpers.CreateInventoryItem( 202 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
203 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
204 203
205 m_attMod.RezSingleAttachmentFromInventory( 204 m_attMod.RezSingleAttachmentFromInventory(
206 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 205 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
@@ -242,6 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
242 Assert.That(attachments.Count, Is.EqualTo(1)); 241 Assert.That(attachments.Count, Is.EqualTo(1));
243 SceneObjectGroup attSo = attachments[0]; 242 SceneObjectGroup attSo = attachments[0];
244 Assert.That(attSo.Name, Is.EqualTo(attName)); 243 Assert.That(attSo.Name, Is.EqualTo(attName));
244 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
245 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); 245 Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
246 Assert.That(attSo.IsAttachment); 246 Assert.That(attSo.IsAttachment);
247 Assert.That(attSo.UsesPhysics, Is.False); 247 Assert.That(attSo.UsesPhysics, Is.False);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f5d49c5..7963e53 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1782,7 +1782,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1782 // Set the parent localID to 0 so it transfers over properly. 1782 // Set the parent localID to 0 so it transfers over properly.
1783 gobj.RootPart.SetParentLocalId(0); 1783 gobj.RootPart.SetParentLocalId(0);
1784 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 1784 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
1785 gobj.RootPart.IsAttachment = false; 1785 gobj.IsAttachment = false;
1786 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 1786 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1787 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); 1787 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1788 CrossPrimGroupIntoNewRegion(destination, gobj, silent); 1788 CrossPrimGroupIntoNewRegion(destination, gobj, silent);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 65ba87b..fcb7eea 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -841,7 +841,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
841 if (attachment) 841 if (attachment)
842 { 842 {
843 group.RootPart.Flags |= PrimFlags.Phantom; 843 group.RootPart.Flags |= PrimFlags.Phantom;
844 group.RootPart.IsAttachment = true; 844 group.IsAttachment = true;
845 } 845 }
846 846
847 // If we're rezzing an attachment then don't ask 847 // If we're rezzing an attachment then don't ask
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 2a76755..33407ec 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
122 if (entity is SceneObjectPart) 122 if (entity is SceneObjectPart)
123 { 123 {
124 SceneObjectPart sop = (SceneObjectPart)entity; 124 SceneObjectPart sop = (SceneObjectPart)entity;
125 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 125 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
126 return 1; 126 return 1;
127 } 127 }
128 128
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
135 if (entity is SceneObjectPart) 135 if (entity is SceneObjectPart)
136 { 136 {
137 SceneObjectPart sop = (SceneObjectPart)entity; 137 SceneObjectPart sop = (SceneObjectPart)entity;
138 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 138 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
139 return 1; 139 return 1;
140 } 140 }
141 141
@@ -148,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
148 if (entity is SceneObjectPart) 148 if (entity is SceneObjectPart)
149 { 149 {
150 SceneObjectPart sop = (SceneObjectPart)entity; 150 SceneObjectPart sop = (SceneObjectPart)entity;
151 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) 151 if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
152 return 1; 152 return 1;
153 } 153 }
154 154
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
171 if (entity is SceneObjectPart) 171 if (entity is SceneObjectPart)
172 { 172 {
173 // Attachments are high priority, 173 // Attachments are high priority,
174 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) 174 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
175 return 1; 175 return 1;
176 176
177 // Non physical prims are lower priority than physical prims 177 // Non physical prims are lower priority than physical prims
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 513c0ea..45d1a0e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4223,7 +4223,7 @@ namespace OpenSim.Region.Framework.Scenes
4223 // their scripts will actually run. 4223 // their scripts will actually run.
4224 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 4224 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
4225 SceneObjectPart parent = part.ParentGroup.RootPart; 4225 SceneObjectPart parent = part.ParentGroup.RootPart;
4226 if (parent != null && parent.IsAttachment) 4226 if (parent != null && part.ParentGroup.IsAttachment)
4227 return ScriptDanger(parent, parent.GetWorldPosition()); 4227 return ScriptDanger(parent, parent.GetWorldPosition());
4228 else 4228 else
4229 return ScriptDanger(part, part.GetWorldPosition()); 4229 return ScriptDanger(part, part.GetWorldPosition());
@@ -5030,7 +5030,7 @@ namespace OpenSim.Region.Framework.Scenes
5030 delete = true; 5030 delete = true;
5031 } 5031 }
5032 5032
5033 if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) 5033 if (delete && !g.IsAttachment && !deletes.Contains(g))
5034 deletes.Add(g); 5034 deletes.Add(g);
5035 }); 5035 });
5036 break; 5036 break;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fada688..34f484d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -146,27 +146,11 @@ namespace OpenSim.Region.Framework.Scenes
146 return true; 146 return true;
147 return false; 147 return false;
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
151 /// Is this scene object acting as an attachment? 151 /// Is this scene object acting as an attachment?
152 /// </summary> 152 /// </summary>
153 /// <remarks> 153 public bool IsAttachment { get; set; }
154 /// We return false if the group has already been deleted.
155 ///
156 /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
157 /// presume either all or no parts in a linkset can be part of an attachment (in which
158 /// case the value would get proprogated down into all the descendent parts).
159 /// </remarks>
160 public bool IsAttachment
161 {
162 get
163 {
164 if (!IsDeleted)
165 return m_rootPart.IsAttachment;
166
167 return false;
168 }
169 }
170 154
171 /// <summary> 155 /// <summary>
172 /// The avatar to which this scene object is attached. 156 /// The avatar to which this scene object is attached.
@@ -177,6 +161,14 @@ namespace OpenSim.Region.Framework.Scenes
177 public UUID AttachedAvatar { get; set; } 161 public UUID AttachedAvatar { get; set; }
178 162
179 /// <summary> 163 /// <summary>
164 /// Attachment point of this scene object to an avatar.
165 /// </summary>
166 /// <remarks>
167 /// 0 if we're not attached to anything
168 /// </remarks>
169 public uint AttachmentPoint;
170
171 /// <summary>
180 /// Is this scene object phantom? 172 /// Is this scene object phantom?
181 /// </summary> 173 /// </summary>
182 /// <remarks> 174 /// <remarks>
@@ -354,11 +346,13 @@ namespace OpenSim.Region.Framework.Scenes
354 /// <summary> 346 /// <summary>
355 /// Check both the attachment property and the relevant properties of the underlying root part. 347 /// Check both the attachment property and the relevant properties of the underlying root part.
356 /// </summary> 348 /// </summary>
349 /// <remarks>
357 /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't 350 /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't
358 /// have the IsAttachment property yet checked. 351 /// have the IsAttachment property yet checked.
359 /// 352 ///
360 /// FIXME: However, this should be fixed so that this property 353 /// FIXME: However, this should be fixed so that this property
361 /// propertly reflects the underlying status. 354 /// propertly reflects the underlying status.
355 /// </remarks>
362 /// <returns></returns> 356 /// <returns></returns>
363 public bool IsAttachmentCheckFull() 357 public bool IsAttachmentCheckFull()
364 { 358 {
@@ -987,11 +981,11 @@ namespace OpenSim.Region.Framework.Scenes
987 return m_rootPart.Shape.State; 981 return m_rootPart.Shape.State;
988 } 982 }
989 983
990 public void SetAttachmentPoint(byte point) 984 public void SetAttachmentPoint(uint point)
991 { 985 {
992 SceneObjectPart[] parts = m_parts.GetArray(); 986 AttachmentPoint = point;
993 for (int i = 0; i < parts.Length; i++) 987 IsAttachment = point != 0;
994 parts[i].SetAttachmentPoint(point); 988 m_rootPart.Shape.State = (byte)point;
995 } 989 }
996 990
997 public void ClearPartAttachmentData() 991 public void ClearPartAttachmentData()
@@ -1424,16 +1418,16 @@ namespace OpenSim.Region.Framework.Scenes
1424 1418
1425 // This is only necessary when userExposed is false! 1419 // This is only necessary when userExposed is false!
1426 1420
1427 bool previousAttachmentStatus = dupe.RootPart.IsAttachment; 1421 bool previousAttachmentStatus = dupe.IsAttachment;
1428 1422
1429 if (!userExposed) 1423 if (!userExposed)
1430 dupe.RootPart.IsAttachment = true; 1424 dupe.IsAttachment = true;
1431 1425
1432 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1426 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1433 1427
1434 if (!userExposed) 1428 if (!userExposed)
1435 { 1429 {
1436 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1430 dupe.IsAttachment = previousAttachmentStatus;
1437 } 1431 }
1438 1432
1439 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1433 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e510611..71023a9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -213,10 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
213 { 213 {
214 get { return m_fromUserInventoryItemID; } 214 get { return m_fromUserInventoryItemID; }
215 } 215 }
216
217 216
218 public bool IsAttachment;
219
220 217
221 public scriptEvents AggregateScriptEvents; 218 public scriptEvents AggregateScriptEvents;
222 219
@@ -224,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
224 public Vector3 AttachedPos; 221 public Vector3 AttachedPos;
225 222
226 223
227 public uint AttachmentPoint;
228
229
230 public Vector3 RotationAxis = Vector3.One; 224 public Vector3 RotationAxis = Vector3.One;
231 225
232 226
@@ -723,7 +717,7 @@ namespace OpenSim.Region.Framework.Scenes
723 m_groupPosition = actor.Position; 717 m_groupPosition = actor.Position;
724 } 718 }
725 719
726 if (IsAttachment) 720 if (m_parentGroup.IsAttachment)
727 { 721 {
728 ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); 722 ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
729 if (sp != null) 723 if (sp != null)
@@ -807,7 +801,7 @@ namespace OpenSim.Region.Framework.Scenes
807 { 801 {
808 if (IsRoot) 802 if (IsRoot)
809 { 803 {
810 if (IsAttachment) 804 if (m_parentGroup.IsAttachment)
811 return AttachedPos; 805 return AttachedPos;
812 else 806 else
813 return AbsolutePosition; 807 return AbsolutePosition;
@@ -1090,7 +1084,7 @@ namespace OpenSim.Region.Framework.Scenes
1090 { 1084 {
1091 get 1085 get
1092 { 1086 {
1093 if (IsAttachment) 1087 if (m_parentGroup.IsAttachment)
1094 return GroupPosition; 1088 return GroupPosition;
1095 1089
1096 return m_offsetPosition + m_groupPosition; 1090 return m_offsetPosition + m_groupPosition;
@@ -1588,7 +1582,7 @@ namespace OpenSim.Region.Framework.Scenes
1588 1582
1589 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition 1583 // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
1590 // or flexible 1584 // or flexible
1591 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1585 if (!isPhantom && !m_parentGroup.IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1592 { 1586 {
1593 try 1587 try
1594 { 1588 {
@@ -2880,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes
2880 2874
2881 public void rotLookAt(Quaternion target, float strength, float damping) 2875 public void rotLookAt(Quaternion target, float strength, float damping)
2882 { 2876 {
2883 if (IsAttachment) 2877 if (m_parentGroup.IsAttachment)
2884 { 2878 {
2885 /* 2879 /*
2886 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 2880 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
@@ -3014,7 +3008,7 @@ namespace OpenSim.Region.Framework.Scenes
3014 3008
3015 if (IsRoot) 3009 if (IsRoot)
3016 { 3010 {
3017 if (IsAttachment) 3011 if (m_parentGroup.IsAttachment)
3018 { 3012 {
3019 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); 3013 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags);
3020 } 3014 }
@@ -3076,7 +3070,7 @@ namespace OpenSim.Region.Framework.Scenes
3076 { 3070 {
3077 // Suppress full updates during attachment editing 3071 // Suppress full updates during attachment editing
3078 // 3072 //
3079 if (ParentGroup.IsSelected && IsAttachment) 3073 if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
3080 return; 3074 return;
3081 3075
3082 if (ParentGroup.IsDeleted) 3076 if (ParentGroup.IsDeleted)
@@ -3254,26 +3248,6 @@ namespace OpenSim.Region.Framework.Scenes
3254 }); 3248 });
3255 } 3249 }
3256 3250
3257 public void SetAttachmentPoint(uint AttachmentPoint)
3258 {
3259 this.AttachmentPoint = AttachmentPoint;
3260
3261 if (AttachmentPoint != 0)
3262 {
3263 IsAttachment = true;
3264 }
3265 else
3266 {
3267 IsAttachment = false;
3268 }
3269
3270 // save the attachment point.
3271 //if (AttachmentPoint != 0)
3272 //{
3273 m_shape.State = (byte)AttachmentPoint;
3274 //}
3275 }
3276
3277 public void SetAxisRotation(int axis, int rotate) 3251 public void SetAxisRotation(int axis, int rotate)
3278 { 3252 {
3279 if (m_parentGroup != null) 3253 if (m_parentGroup != null)
@@ -4497,7 +4471,9 @@ namespace OpenSim.Region.Framework.Scenes
4497 } 4471 }
4498 } 4472 }
4499 4473
4500 if (SetPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4474 if (SetPhantom
4475 || ParentGroup.IsAttachment
4476 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4501 { 4477 {
4502 AddFlag(PrimFlags.Phantom); 4478 AddFlag(PrimFlags.Phantom);
4503 if (PhysActor != null) 4479 if (PhysActor != null)
@@ -4928,7 +4904,7 @@ namespace OpenSim.Region.Framework.Scenes
4928 if (ParentGroup == null || ParentGroup.IsDeleted) 4904 if (ParentGroup == null || ParentGroup.IsDeleted)
4929 return; 4905 return;
4930 4906
4931 if (IsAttachment && ParentGroup.RootPart != this) 4907 if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
4932 return; 4908 return;
4933 4909
4934 // Causes this thread to dig into the Client Thread Data. 4910 // Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3b60f8c..108089e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
201 // Don't let this set the HasGroupChanged flag for attachments 201 // Don't let this set the HasGroupChanged flag for attachments
202 // as this happens during rez and we don't want a new asset 202 // as this happens during rez and we don't want a new asset
203 // for each attachment each time 203 // for each attachment each time
204 if (!m_part.ParentGroup.RootPart.IsAttachment) 204 if (!m_part.ParentGroup.IsAttachment)
205 { 205 {
206 HasInventoryChanged = true; 206 HasInventoryChanged = true;
207 m_part.ParentGroup.HasGroupChanged = true; 207 m_part.ParentGroup.HasGroupChanged = true;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fc89473..93782ce 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3178,7 +3178,7 @@ namespace OpenSim.Region.Framework.Scenes
3178 ISceneObject clone = sog.CloneForNewScene(); 3178 ISceneObject clone = sog.CloneForNewScene();
3179 // Attachment module assumes that GroupPosition holds the offsets...! 3179 // Attachment module assumes that GroupPosition holds the offsets...!
3180 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; 3180 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3181 ((SceneObjectGroup)clone).RootPart.IsAttachment = false; 3181 ((SceneObjectGroup)clone).IsAttachment = false;
3182 cAgent.AttachmentObjects.Add(clone); 3182 cAgent.AttachmentObjects.Add(clone);
3183 string state = sog.GetStateSnapshot(); 3183 string state = sog.GetStateSnapshot();
3184 cAgent.AttachmentObjectStates.Add(state); 3184 cAgent.AttachmentObjectStates.Add(state);
@@ -3477,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes
3477 { 3477 {
3478 foreach (SceneObjectGroup so in m_attachments) 3478 foreach (SceneObjectGroup so in m_attachments)
3479 { 3479 {
3480 if (attachmentPoint == so.RootPart.AttachmentPoint) 3480 if (attachmentPoint == so.AttachmentPoint)
3481 attachments.Add(so); 3481 attachments.Add(so);
3482 } 3482 }
3483 } 3483 }
@@ -3869,12 +3869,12 @@ namespace OpenSim.Region.Framework.Scenes
3869 { 3869 {
3870 if (grp.HasGroupChanged) // Resizer scripts? 3870 if (grp.HasGroupChanged) // Resizer scripts?
3871 { 3871 {
3872 grp.RootPart.IsAttachment = false; 3872 grp.IsAttachment = false;
3873 grp.AbsolutePosition = grp.RootPart.AttachedPos; 3873 grp.AbsolutePosition = grp.RootPart.AttachedPos;
3874// grp.DetachToInventoryPrep(); 3874// grp.DetachToInventoryPrep();
3875 attachmentsModule.UpdateKnownItem(ControllingClient, 3875 attachmentsModule.UpdateKnownItem(ControllingClient,
3876 grp, grp.GetFromItemID(), grp.OwnerID); 3876 grp, grp.GetFromItemID(), grp.OwnerID);
3877 grp.RootPart.IsAttachment = true; 3877 grp.IsAttachment = true;
3878 } 3878 }
3879 } 3879 }
3880 } 3880 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index 7c067ca..997845b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -120,8 +120,7 @@ namespace OpenSim.Region.Framework.Scenes
120 // We deal with the possibility that two updates occur at 120 // We deal with the possibility that two updates occur at
121 // the same unix time at the update point itself. 121 // the same unix time at the update point itself.
122 122
123 if ((update.LastFullUpdateTime < part.TimeStampFull) || 123 if ((update.LastFullUpdateTime < part.TimeStampFull) || part.ParentGroup.IsAttachment)
124 part.IsAttachment)
125 { 124 {
126 // m_log.DebugFormat( 125 // m_log.DebugFormat(
127 // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", 126 // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 81f1f38..a7f08d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1965,7 +1965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1965 1965
1966 if (part.ParentGroup.RootPart == part) 1966 if (part.ParentGroup.RootPart == part)
1967 { 1967 {
1968 if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) 1968 if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
1969 targetPos.z = ground; 1969 targetPos.z = ground;
1970 SceneObjectGroup parent = part.ParentGroup; 1970 SceneObjectGroup parent = part.ParentGroup;
1971 LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); 1971 LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
@@ -2097,7 +2097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2097 Quaternion q; 2097 Quaternion q;
2098 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 2098 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
2099 { 2099 {
2100 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 2100 if (part.ParentGroup.AttachmentPoint != 0)
2101 { 2101 {
2102 ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); 2102 ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
2103 if (avatar != null) 2103 if (avatar != null)
@@ -2241,7 +2241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2241 2241
2242 Vector3 vel; 2242 Vector3 vel;
2243 2243
2244 if (m_host.IsAttachment) 2244 if (m_host.ParentGroup.IsAttachment)
2245 { 2245 {
2246 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); 2246 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2247 vel = avatar.Velocity; 2247 vel = avatar.Velocity;
@@ -2997,7 +2997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2997 { 2997 {
2998 m_host.AddScriptLPS(1); 2998 m_host.AddScriptLPS(1);
2999 2999
3000 if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) 3000 if (m_host.ParentGroup.AttachmentPoint == 0)
3001 return; 3001 return;
3002 3002
3003 TaskInventoryItem item; 3003 TaskInventoryItem item;
@@ -3587,7 +3587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3587 3587
3588 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); 3588 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
3589 3589
3590 if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) 3590 if (targetPart.ParentGroup.AttachmentPoint != 0)
3591 return; // Fail silently if attached 3591 return; // Fail silently if attached
3592 SceneObjectGroup parentPrim = null, childPrim = null; 3592 SceneObjectGroup parentPrim = null, childPrim = null;
3593 3593
@@ -3640,7 +3640,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3640 3640
3641 SceneObjectGroup parentPrim = m_host.ParentGroup; 3641 SceneObjectGroup parentPrim = m_host.ParentGroup;
3642 3642
3643 if (parentPrim.RootPart.AttachmentPoint != 0) 3643 if (parentPrim.AttachmentPoint != 0)
3644 return; // Fail silently if attached 3644 return; // Fail silently if attached
3645 SceneObjectPart childPrim = null; 3645 SceneObjectPart childPrim = null;
3646 3646
@@ -3710,7 +3710,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3710 { 3710 {
3711 m_host.AddScriptLPS(1); 3711 m_host.AddScriptLPS(1);
3712 SceneObjectGroup parentPrim = m_host.ParentGroup; 3712 SceneObjectGroup parentPrim = m_host.ParentGroup;
3713 if (parentPrim.RootPart.AttachmentPoint != 0) 3713 if (parentPrim.AttachmentPoint != 0)
3714 return; // Fail silently if attached 3714 return; // Fail silently if attached
3715 3715
3716 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts); 3716 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
@@ -4349,7 +4349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4349 return; 4349 return;
4350 4350
4351 // Object not pushable. Not an attachment and has no physics component 4351 // Object not pushable. Not an attachment and has no physics component
4352 if (!pusheeob.IsAttachment && pusheeob.PhysActor == null) 4352 if (!pusheeob.ParentGroup.IsAttachment && pusheeob.PhysActor == null)
4353 return; 4353 return;
4354 4354
4355 PusheePos = pusheeob.AbsolutePosition; 4355 PusheePos = pusheeob.AbsolutePosition;
@@ -5857,7 +5857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5857 public LSL_Integer llGetAttached() 5857 public LSL_Integer llGetAttached()
5858 { 5858 {
5859 m_host.AddScriptLPS(1); 5859 m_host.AddScriptLPS(1);
5860 return m_host.ParentGroup.RootPart.AttachmentPoint; 5860 return m_host.ParentGroup.AttachmentPoint;
5861 } 5861 }
5862 5862
5863 public LSL_Integer llGetFreeMemory() 5863 public LSL_Integer llGetFreeMemory()
@@ -7458,7 +7458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7458 { 7458 {
7459 m_host.AddScriptLPS(1); 7459 m_host.AddScriptLPS(1);
7460 Quaternion q; 7460 Quaternion q;
7461 if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) 7461 if (m_host.ParentGroup.AttachmentPoint != 0)
7462 { 7462 {
7463 ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); 7463 ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
7464 if (avatar != null) 7464 if (avatar != null)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index bf74760..4ac7f8b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -303,7 +303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
303 float dz; 303 float dz;
304 304
305 Quaternion q = SensePoint.RotationOffset; 305 Quaternion q = SensePoint.RotationOffset;
306 if (SensePoint.ParentGroup.RootPart.IsAttachment) 306 if (SensePoint.ParentGroup.IsAttachment)
307 { 307 {
308 // In attachments, the sensor cone always orients with the 308 // In attachments, the sensor cone always orients with the
309 // avatar rotation. This may include a nonzero elevation if 309 // avatar rotation. This may include a nonzero elevation if
@@ -352,7 +352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
352 objtype = 0; 352 objtype = 0;
353 353
354 part = ((SceneObjectGroup)ent).RootPart; 354 part = ((SceneObjectGroup)ent).RootPart;
355 if (part.AttachmentPoint != 0) // Attached so ignore 355 if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore
356 continue; 356 continue;
357 357
358 if (part.Inventory.ContainsScripts()) 358 if (part.Inventory.ContainsScripts())
@@ -423,7 +423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
423 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 423 Vector3 fromRegionPos = SensePoint.AbsolutePosition;
424 424
425 Quaternion q = SensePoint.RotationOffset; 425 Quaternion q = SensePoint.RotationOffset;
426 if (SensePoint.ParentGroup.RootPart.IsAttachment) 426 if (SensePoint.ParentGroup.IsAttachment)
427 { 427 {
428 // In attachments, the sensor cone always orients with the 428 // In attachments, the sensor cone always orients with the
429 // avatar rotation. This may include a nonzero elevation if 429 // avatar rotation. This may include a nonzero elevation if
@@ -435,7 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
435 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 435 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
436 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 436 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
437 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 437 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
438 bool attached = (SensePoint.AttachmentPoint != 0); 438 bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0);
439 Vector3 toRegionPos; 439 Vector3 toRegionPos;
440 double dis; 440 double dis;
441 441