diff options
author | Aleric Inglewood | 2013-08-04 19:19:11 +0200 |
---|---|---|
committer | teravus | 2013-09-22 21:10:01 -0500 |
commit | 2dc92e7de11086c7649d3ee0f8adc974efce6805 (patch) | |
tree | e69a633127525a5967ddadeef723a99f38e5d4aa /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |
parent | minor: Recomment out log message uncommented in previous cbdfe969 (diff) | |
download | opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.zip opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.gz opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.bz2 opensim-SC_OLD-2dc92e7de11086c7649d3ee0f8adc974efce6805.tar.xz |
Preserve attachment point & position when attachment is rezzed in world
Patch taken from
http://opensimulator.org/mantis/view.php?id=4905
originally by Greg C.
Fixed to apply to r/23314 commit
ba9daf849e7c8db48e7c03e7cdedb77776b2052f
(cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2818712..d0e0b35 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -422,6 +422,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
422 | attachPos = Vector3.Zero; | 422 | attachPos = Vector3.Zero; |
423 | } | 423 | } |
424 | 424 | ||
425 | // if the attachment point is the same as previous, make sure we get the saved | ||
426 | // position info. | ||
427 | if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint) | ||
428 | { | ||
429 | attachPos = group.RootPart.AttachedPos; | ||
430 | } | ||
431 | |||
425 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | 432 | // AttachmentPt 0 means the client chose to 'wear' the attachment. |
426 | if (attachmentPt == (uint)AttachmentPoint.Default) | 433 | if (attachmentPt == (uint)AttachmentPoint.Default) |
427 | { | 434 | { |
@@ -429,6 +436,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
429 | attachmentPt = group.AttachmentPoint; | 436 | attachmentPt = group.AttachmentPoint; |
430 | } | 437 | } |
431 | 438 | ||
439 | // if we didn't find an attach point, look for where it was last attached | ||
440 | if (attachmentPt == 0) | ||
441 | { | ||
442 | attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint; | ||
443 | attachPos = group.RootPart.AttachedPos; | ||
444 | group.HasGroupChanged = true; | ||
445 | } | ||
446 | |||
432 | // if we still didn't find a suitable attachment point....... | 447 | // if we still didn't find a suitable attachment point....... |
433 | if (attachmentPt == 0) | 448 | if (attachmentPt == 0) |
434 | { | 449 | { |
@@ -619,6 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
619 | so.ClearPartAttachmentData(); | 634 | so.ClearPartAttachmentData(); |
620 | rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); | 635 | rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); |
621 | so.HasGroupChanged = true; | 636 | so.HasGroupChanged = true; |
637 | so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; | ||
622 | rootPart.Rezzed = DateTime.Now; | 638 | rootPart.Rezzed = DateTime.Now; |
623 | rootPart.RemFlag(PrimFlags.TemporaryOnRez); | 639 | rootPart.RemFlag(PrimFlags.TemporaryOnRez); |
624 | so.AttachToBackup(); | 640 | so.AttachToBackup(); |
@@ -1210,4 +1226,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1210 | 1226 | ||
1211 | #endregion | 1227 | #endregion |
1212 | } | 1228 | } |
1213 | } \ No newline at end of file | 1229 | } |