Don't try to start attachment scripts or send updates if the attachment itself has been unsuccessful
parent
4c1365f149
commit
53a01dc422
|
@ -2376,9 +2376,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
|
/// <summary>
|
||||||
|
/// Attach an object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controllingClient"></param>
|
||||||
|
/// <param name="localID"></param>
|
||||||
|
/// <param name="attachPoint"></param>
|
||||||
|
/// <param name="rot"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <param name="silent"></param>
|
||||||
|
/// <returns>true if the object was successfully attached, false otherwise</returns>
|
||||||
|
public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
|
||||||
{
|
{
|
||||||
m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
|
return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
|
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
|
||||||
|
|
|
@ -478,46 +478,59 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_parentScene.Permissions.CanTakeObject(
|
if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||||
part.UUID, remoteClient.AgentId))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
|
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
|
||||||
|
|
||||||
// Save avatar attachment information
|
|
||||||
ScenePresence presence;
|
|
||||||
if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
|
|
||||||
{
|
{
|
||||||
m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt);
|
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||||
m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
|
||||||
|
// Save avatar attachment information
|
||||||
|
ScenePresence presence;
|
||||||
|
if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
|
||||||
|
{
|
||||||
|
m_log.Info(
|
||||||
|
"[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||||
|
+ ", AttachmentPoint: " + AttachmentPt);
|
||||||
|
|
||||||
|
m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneObjectGroup RezSingleAttachment(
|
/// <summary>
|
||||||
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
/// Rez an attachment
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="itemID"></param>
|
||||||
|
/// <param name="AttachmentPt"></param>
|
||||||
|
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
|
||||||
|
public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||||
{
|
{
|
||||||
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient,
|
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient,
|
||||||
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
|
||||||
false, false, remoteClient.AgentId, true);
|
false, false, remoteClient.AgentId, true);
|
||||||
|
|
||||||
|
|
||||||
if (objatt != null)
|
if (objatt != null)
|
||||||
{
|
{
|
||||||
bool tainted = false;
|
bool tainted = false;
|
||||||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||||
tainted = true;
|
tainted = true;
|
||||||
|
|
||||||
AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
if (AttachObject(
|
||||||
objatt.ScheduleGroupForFullUpdate();
|
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false))
|
||||||
if (tainted)
|
{
|
||||||
objatt.HasGroupChanged = true;
|
objatt.ScheduleGroupForFullUpdate();
|
||||||
|
if (tainted)
|
||||||
|
objatt.HasGroupChanged = true;
|
||||||
|
|
||||||
// Fire after attach, so we don't get messy perms dialogs
|
// Fire after attach, so we don't get messy perms dialogs
|
||||||
// 3 == AttachedRez
|
// 3 == AttachedRez
|
||||||
objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
|
objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return objatt;
|
return objatt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +567,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal void AttachObject(
|
/// <summary>
|
||||||
|
/// Attach a scene object to an avatar.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="objectLocalID"></param>
|
||||||
|
/// <param name="AttachmentPt"></param>
|
||||||
|
/// <param name="rot"></param>
|
||||||
|
/// <param name="attachPos"></param>
|
||||||
|
/// <param name="silent"></param>
|
||||||
|
/// <returns>true if the attachment was successful, false otherwise</returns>
|
||||||
|
protected internal bool AttachObject(
|
||||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
|
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
|
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
|
||||||
|
@ -583,10 +606,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Stick it on left hand with Zero Offset from the attachment point.
|
// Stick it on left hand with Zero Offset from the attachment point.
|
||||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||||
attachPos = Vector3.Zero;
|
attachPos = Vector3.Zero;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||||
group.AbsolutePosition = attachPos;
|
group.AbsolutePosition = attachPos;
|
||||||
|
|
||||||
|
@ -614,10 +635,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
|
remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
|
m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
|
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
|
||||||
|
|
Loading…
Reference in New Issue