Merge commit 'c92654fb43f303da8e1623f9fff8a404aad72374' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.csavinationmerge
commit
05810e48b0
|
@ -367,12 +367,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
sp.ClearAttachments();
|
||||
}
|
||||
|
||||
public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append)
|
||||
public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool append)
|
||||
{
|
||||
if (!Enabled)
|
||||
return false;
|
||||
|
||||
return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, false, append);
|
||||
return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -383,9 +383,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <param name='group'>The object to attach.</param>
|
||||
/// <param name='attachmentPt'></param>
|
||||
/// <param name='silent'></param>
|
||||
/// <param name='temp'></param>
|
||||
/// <param name='addToInventory'>If true then add object to user inventory.</param>
|
||||
/// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param>
|
||||
private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool resumeScripts, bool append)
|
||||
private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool resumeScripts, bool append)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
|
||||
|
@ -474,8 +474,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
group.AttachmentPoint = attachmentPt;
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp, append);
|
||||
if (addToInventory && sp.PresenceType != PresenceType.Npc)
|
||||
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
|
||||
|
||||
AttachToAgent(sp, group, attachmentPt, attachPos, silent);
|
||||
|
||||
|
@ -494,17 +494,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
return true;
|
||||
}
|
||||
|
||||
private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append)
|
||||
private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool append)
|
||||
{
|
||||
// Add the new attachment to inventory if we don't already have it.
|
||||
if (!temp)
|
||||
{
|
||||
UUID newAttachmentItemID = group.FromItemID;
|
||||
if (newAttachmentItemID == UUID.Zero)
|
||||
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
||||
UUID newAttachmentItemID = group.FromItemID;
|
||||
if (newAttachmentItemID == UUID.Zero)
|
||||
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
||||
|
||||
ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append);
|
||||
}
|
||||
ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append);
|
||||
}
|
||||
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
||||
|
@ -1010,7 +1007,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
objatt.ResetOwnerChangeFlag();
|
||||
}
|
||||
|
||||
AttachObjectInternal(sp, objatt, attachmentPt, false, true, false, true, append);
|
||||
AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, true, append);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1152,7 +1149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false, append))
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, false, append))
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.Debug(
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
|||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
|
||||
|
||||
m_numberOfAttachEventsFired = 0;
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(sp.HasAttachments(), Is.True);
|
||||
|
@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
|||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID);
|
||||
|
||||
m_numberOfAttachEventsFired = 0;
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, true, false, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(sp.HasAttachments(), Is.True);
|
||||
|
@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
|||
|
||||
// Test wearing a different attachment from the ground.
|
||||
{
|
||||
scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(sp.HasAttachments(), Is.True);
|
||||
|
@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
|||
|
||||
// Test rewearing an already worn attachment from ground. Nothing should happen.
|
||||
{
|
||||
scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false);
|
||||
|
||||
// Check status on scene presence
|
||||
Assert.That(sp.HasAttachments(), Is.True);
|
||||
|
@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
|||
sp2.AbsolutePosition = new Vector3(0, 0, 0);
|
||||
sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero);
|
||||
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false);
|
||||
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false);
|
||||
|
||||
Assert.That(sp.HasAttachments(), Is.False);
|
||||
Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
|
||||
|
|
|
@ -81,14 +81,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
|
||||
|
||||
/// <summary>
|
||||
/// Attach an object to an avatar
|
||||
/// Attach an object to an avatar.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="grp"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="silent"></param>
|
||||
/// <param name="addToInventory">If true then add object to user inventory</param>
|
||||
/// <param name="append">Append to attachment point rather than replace.</param>
|
||||
/// <returns>true if the object was successfully attached, false otherwise</returns>
|
||||
bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo, bool temp, bool append);
|
||||
bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo, bool addToInventory, bool append);
|
||||
|
||||
/// <summary>
|
||||
/// Rez an attachment from user inventory and change inventory status to match.
|
||||
|
|
|
@ -184,7 +184,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
|||
hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true, true) ? 1 : 0;
|
||||
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true, true) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue