Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-06-05 00:50:24 +02:00
commit 454445fe6a
6 changed files with 28 additions and 10 deletions

View File

@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
sp.ClearAttachments(); sp.ClearAttachments();
} }
public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData)
{ {
lock (sp.AttachmentsSyncLock) lock (sp.AttachmentsSyncLock)
{ {
@ -273,9 +273,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
attachPos = Vector3.Zero; attachPos = Vector3.Zero;
} }
if (useAttachData)
{
group.RootPart.RotationOffset = group.RootPart.AttachRotation;
attachPos = group.RootPart.AttachOffset;
if (attachmentPt == 0)
{
attachmentPt = group.RootPart.AttachPoint;
if (attachmentPt == 0)
{
attachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = Vector3.Zero;
}
}
else if (group.RootPart.AttachPoint != attachmentPt)
{
attachPos = Vector3.Zero;
}
}
group.AttachmentPoint = attachmentPt; group.AttachmentPoint = attachmentPt;
group.AbsolutePosition = attachPos; group.AbsolutePosition = attachPos;
// We also don't want to do any of the inventory operations for an NPC. // We also don't want to do any of the inventory operations for an NPC.
if (sp.PresenceType != PresenceType.Npc) if (sp.PresenceType != PresenceType.Npc)
{ {
@ -792,7 +810,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// This will throw if the attachment fails // This will throw if the attachment fails
try try
{ {
AttachObject(sp, objatt, attachmentPt, false); AttachObject(sp, objatt, attachmentPt, false, false);
} }
catch (Exception e) catch (Exception e)
{ {
@ -947,7 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
// Calls attach with a Zero position // Calls attach with a Zero position
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true))
{ {
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);

View File

@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false, false);
// Check status on scene presence // Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.True); Assert.That(m_presence.HasAttachments(), Is.True);
@ -317,4 +317,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
// } // }
} }
} }

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="AttachmentPt"></param> /// <param name="AttachmentPt"></param>
/// <param name="silent"></param> /// <param name="silent"></param>
/// <returns>true if the object was successfully attached, false otherwise</returns> /// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent); bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo);
/// <summary> /// <summary>
/// Rez an attachment from user inventory and change inventory status to match. /// Rez an attachment from user inventory and change inventory status to match.

View File

@ -2692,7 +2692,7 @@ namespace OpenSim.Region.Framework.Scenes
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
if (AttachmentsModule != null) if (AttachmentsModule != null)
AttachmentsModule.AttachObject(sp, grp, 0, false); AttachmentsModule.AttachObject(sp, grp, 0, false, false);
} }
else else
{ {

View File

@ -2634,7 +2634,7 @@ namespace OpenSim.Region.Framework.Scenes
colliding.Add(CreateDetObjectForGround()); colliding.Add(CreateDetObjectForGround());
LandCollidingMessage.Colliders = colliding; LandCollidingMessage.Colliders = colliding;
notify(LocalId, LandCollidingMessage); notify(ParentGroup.RootPart.LocalId, LandCollidingMessage);
} }
} }

View File

@ -3344,7 +3344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule != null) if (attachmentsModule != null)
attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); attachmentsModule.AttachObject(presence, grp, (uint)attachment, false, true);
} }
} }