mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
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
ba9daf849e
(cherry picked from commit 4ff9fbca441110cc2b93edc7286e0e9339e61cbe)
This commit is contained in:
committed by
teravus
parent
a37c59b43e
commit
2dc92e7de1
@@ -422,6 +422,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// if the attachment point is the same as previous, make sure we get the saved
|
||||
// position info.
|
||||
if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
|
||||
{
|
||||
attachPos = group.RootPart.AttachedPos;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (attachmentPt == (uint)AttachmentPoint.Default)
|
||||
{
|
||||
@@ -429,6 +436,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
attachmentPt = group.AttachmentPoint;
|
||||
}
|
||||
|
||||
// if we didn't find an attach point, look for where it was last attached
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
|
||||
attachPos = group.RootPart.AttachedPos;
|
||||
group.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (attachmentPt == 0)
|
||||
{
|
||||
@@ -619,6 +634,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
so.ClearPartAttachmentData();
|
||||
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive);
|
||||
so.HasGroupChanged = true;
|
||||
so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint;
|
||||
rootPart.Rezzed = DateTime.Now;
|
||||
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
so.AttachToBackup();
|
||||
@@ -1210,4 +1226,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user