aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs42
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
4 files changed, 25 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a900a2a..cf188aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -481,14 +481,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
481// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", 481// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
482// group.Name, group.LocalId, sp.Name, attachmentPt, silent); 482// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
483 483
484 if (sp.GetAttachments().Contains(group))
485 {
486// m_log.WarnFormat(
487// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
488// group.Name, group.LocalId, sp.Name, AttachmentPt);
489
490 return false;
491 }
492 484
493 if (group.GetSittingAvatarsCount() != 0) 485 if (group.GetSittingAvatarsCount() != 0)
494 { 486 {
@@ -500,6 +492,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
500 return false; 492 return false;
501 } 493 }
502 494
495 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
496 if (attachments.Contains(group))
497 {
498// if (DebugLevel > 0)
499// m_log.WarnFormat(
500// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
501// group.Name, group.LocalId, sp.Name, attachmentPt);
502
503 return false;
504 }
505
503 Vector3 attachPos = group.AbsolutePosition; 506 Vector3 attachPos = group.AbsolutePosition;
504 507
505 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 508 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@@ -533,7 +536,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
533 { 536 {
534 attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint; 537 attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
535 attachPos = group.RootPart.AttachedPos; 538 attachPos = group.RootPart.AttachedPos;
536 group.HasGroupChanged = true;
537 } 539 }
538 540
539 // if we still didn't find a suitable attachment point....... 541 // if we still didn't find a suitable attachment point.......
@@ -544,18 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
544 attachPos = Vector3.Zero; 546 attachPos = Vector3.Zero;
545 } 547 }
546 548
547 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
548
549 if (attachments.Contains(group))
550 {
551 if (DebugLevel > 0)
552 m_log.WarnFormat(
553 "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
554 group.Name, group.LocalId, sp.Name, attachmentPt);
555
556 return false;
557 }
558
559 // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones 549 // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
560 while (attachments.Count >= 5) 550 while (attachments.Count >= 5)
561 { 551 {
@@ -579,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
579 lock (sp.AttachmentsSyncLock) 569 lock (sp.AttachmentsSyncLock)
580 { 570 {
581 group.AttachmentPoint = attachmentPt; 571 group.AttachmentPoint = attachmentPt;
582 group.AbsolutePosition = attachPos; 572 group.RootPart.AttachedPos = attachPos;
583 573
584 if (addToInventory && sp.PresenceType != PresenceType.Npc) 574 if (addToInventory && sp.PresenceType != PresenceType.Npc)
585 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); 575 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
@@ -956,7 +946,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
956 m_scene.DeleteFromStorage(so.UUID); 946 m_scene.DeleteFromStorage(so.UUID);
957 m_scene.EventManager.TriggerParcelPrimCountTainted(); 947 m_scene.EventManager.TriggerParcelPrimCountTainted();
958 948
959 so.AttachedAvatar = sp.UUID;
960 949
961 foreach (SceneObjectPart part in so.Parts) 950 foreach (SceneObjectPart part in so.Parts)
962 { 951 {
@@ -969,11 +958,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
969 } 958 }
970 } 959 }
971 960
972 so.AbsolutePosition = attachOffset;
973 so.RootPart.AttachedPos = attachOffset;
974 so.IsAttachment = true;
975 so.RootPart.SetParentLocalId(sp.LocalId); 961 so.RootPart.SetParentLocalId(sp.LocalId);
962 so.AttachedAvatar = sp.UUID;
976 so.AttachmentPoint = attachmentpoint; 963 so.AttachmentPoint = attachmentpoint;
964 so.RootPart.AttachedPos = attachOffset;
965 so.AbsolutePosition = attachOffset;
966 so.IsAttachment = true;
977 967
978 sp.AddAttachment(so); 968 sp.AddAttachment(so);
979 969
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a73906c..67c847b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -427,20 +427,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
427 originalRotations[objectGroup.UUID] = inventoryStoredRotation; 427 originalRotations[objectGroup.UUID] = inventoryStoredRotation;
428 428
429 // Restore attachment data after trip through the sim 429 // Restore attachment data after trip through the sim
430 if (objectGroup.RootPart.AttachPoint > 0) 430 if (objectGroup.AttachmentPoint > 0)
431 { 431 {
432 inventoryStoredPosition = objectGroup.RootPart.AttachedPos; 432 inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
433 inventoryStoredRotation = objectGroup.RootPart.AttachRotation; 433 inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
434 } 434 if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
435 objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
436 objectGroup.RootPart.Shape.LastAttachPoint = (byte)objectGroup.AttachmentPoint;
435 437
436 // Trees could be attached and it's been done, but it makes
437 // no sense. State must be preserved because it's the tree type
438 if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
439 objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
440 {
441 objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
442 if (objectGroup.RootPart.AttachPoint > 0)
443 objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
444 } 438 }
445 439
446 objectGroup.AbsolutePosition = inventoryStoredPosition; 440 objectGroup.AbsolutePosition = inventoryStoredPosition;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0544696..bf0e31b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes
244 244
245 public uint TimeStampTerse; 245 public uint TimeStampTerse;
246 246
247 // The following two are to hold the attachment data
248 // while an object is inworld
249 [XmlIgnore]
250 public byte AttachPoint = 0;
251
252 [XmlIgnore] 247 [XmlIgnore]
253 public Quaternion AttachRotation = Quaternion.Identity; 248 public Quaternion AttachRotation = Quaternion.Identity;
254 249
@@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes
277 272
278 public scriptEvents AggregateScriptEvents; 273 public scriptEvents AggregateScriptEvents;
279 274
280 public Vector3 AttachedPos; 275 public Vector3 AttachedPos
276 {
277 get;
278 set;
279 }
281 280
282 // rotation locks on local X,Y and or Z axis bit flags 281 // rotation locks on local X,Y and or Z axis bit flags
283 // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum 282 // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 226ad6c..3f2e321 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7972,7 +7972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7972 { 7972 {
7973 return 0; 7973 return 0;
7974 } 7974 }
7975
7976 } 7975 }
7977 7976
7978 public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) 7977 public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
@@ -15867,7 +15866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15867 return; 15866 return;
15868 } 15867 }
15869 15868
15870 group.RootPart.AttachPoint = group.RootPart.Shape.State;
15871 group.RootPart.AttachedPos = group.AbsolutePosition; 15869 group.RootPart.AttachedPos = group.AbsolutePosition;
15872 15870
15873 group.ResetIDs(); 15871 group.ResetIDs();