Bug fix on attachments: attach->drop->attach works now.
parent
2a71df1285
commit
e80cb815df
|
@ -25,6 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
@ -72,30 +73,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
|
||||
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
try
|
||||
{
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
{
|
||||
m_log.Info(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||
{
|
||||
m_log.Info(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AttachObject(
|
||||
|
@ -379,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
uuids.Add(inventoryID);
|
||||
m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
|
||||
remoteClient.SendRemoveInventoryItem(inventoryID);
|
||||
}
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
|
||||
}
|
||||
|
|
|
@ -1052,6 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
|
||||
detachedpos = avatar.AbsolutePosition;
|
||||
RootPart.FromItemID = UUID.Zero;
|
||||
|
||||
AbsolutePosition = detachedpos;
|
||||
m_rootPart.AttachedAvatar = UUID.Zero;
|
||||
|
|
Loading…
Reference in New Issue