mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
This commit is contained in:
72
OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
Normal file
72
OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface IAttachmentsModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Attach an object to an avatar.
|
||||
/// </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>
|
||||
bool AttachObject(
|
||||
IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent);
|
||||
|
||||
/// <summary>
|
||||
/// Update the user inventory to the attachment of an item
|
||||
/// </summary>
|
||||
/// <param name="att"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <returns></returns>
|
||||
UUID SetAttachmentInventoryStatus(
|
||||
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
|
||||
|
||||
/// <summary>
|
||||
/// Update the user inventory to show a detach.
|
||||
/// </summary>
|
||||
/// <param name="itemID">
|
||||
/// A <see cref="UUID"/>
|
||||
/// </param>
|
||||
/// <param name="remoteClient">
|
||||
/// A <see cref="IClientAPI"/>
|
||||
/// </param>
|
||||
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
|
||||
}
|
||||
}
|
||||
@@ -110,21 +110,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
|
||||
|
||||
/// <summary>
|
||||
/// Called when an object is touched/grabbed.
|
||||
/// Fired when an object is touched/grabbed.
|
||||
/// </summary>
|
||||
/// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
|
||||
/// the root part.
|
||||
public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
|
||||
/// the root part.
|
||||
public event ObjectGrabDelegate OnObjectGrab;
|
||||
public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
|
||||
|
||||
public event ObjectGrabDelegate OnObjectGrabbing;
|
||||
public event ObjectDeGrabDelegate OnObjectDeGrab;
|
||||
public event ScriptResetDelegate OnScriptReset;
|
||||
|
||||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
|
||||
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
|
||||
/// <summary>
|
||||
/// Fired when a new script is created.
|
||||
/// </summary>
|
||||
public event NewRezScript OnRezScript;
|
||||
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
|
||||
|
||||
public delegate void RemoveScript(uint localID, UUID itemID);
|
||||
public event RemoveScript OnRemoveScript;
|
||||
@@ -166,38 +169,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public delegate void ClientClosed(UUID clientID, Scene scene);
|
||||
|
||||
public event ClientClosed OnClientClosed;
|
||||
public event ClientClosed OnClientClosed;
|
||||
|
||||
/// <summary>
|
||||
/// This is fired when a scene object property that a script might be interested in (such as color, scale or
|
||||
/// inventory) changes. Only enough information is sent for the LSL changed event
|
||||
/// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
|
||||
/// </summary>
|
||||
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||
public delegate void ScriptChangedEvent(uint localID, uint change);
|
||||
|
||||
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||
|
||||
public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
|
||||
|
||||
public event ScriptControlEvent OnScriptControlEvent;
|
||||
|
||||
public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
|
||||
|
||||
public event ScriptAtTargetEvent OnScriptAtTargetEvent;
|
||||
|
||||
public delegate void ScriptNotAtTargetEvent(uint localID);
|
||||
|
||||
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
|
||||
|
||||
public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
|
||||
|
||||
public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptNotAtRotTargetEvent(uint localID);
|
||||
|
||||
public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
|
||||
|
||||
public event ScriptColliding OnScriptColliderStart;
|
||||
public event ScriptColliding OnScriptColliding;
|
||||
public event ScriptColliding OnScriptCollidingEnd;
|
||||
|
||||
public event ScriptColliding OnScriptLandColliderStart;
|
||||
public event ScriptColliding OnScriptLandColliding;
|
||||
public event ScriptColliding OnScriptLandColliderEnd;
|
||||
|
||||
@@ -1858,39 +1858,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (att == null)
|
||||
{
|
||||
DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the user inventory to reflect an attachment
|
||||
/// </summary>
|
||||
/// <param name="att"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <returns></returns>
|
||||
public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
|
||||
remoteClient.Name, att.Name, itemID);
|
||||
|
||||
if (!att.IsDeleted)
|
||||
AttachmentPt = att.RootPart.AttachmentPoint;
|
||||
|
||||
ScenePresence presence;
|
||||
if (TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = InventoryService.GetItem(item);
|
||||
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
|
||||
}
|
||||
return att.UUID;
|
||||
return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
|
||||
}
|
||||
|
||||
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
|
||||
@@ -1902,65 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This registers the item as attached in a user's inventory
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="att"></param>
|
||||
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
|
||||
// att.Name, remoteClient.Name, AttachmentPt, itemID);
|
||||
|
||||
if (UUID.Zero == itemID)
|
||||
{
|
||||
m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == AttachmentPt)
|
||||
{
|
||||
m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (null == att.RootPart)
|
||||
{
|
||||
m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!");
|
||||
return;
|
||||
}
|
||||
|
||||
ScenePresence presence;
|
||||
if (TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
// XXYY!!
|
||||
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
|
||||
item = InventoryService.GetItem(item);
|
||||
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
|
||||
|
||||
if (m_AvatarFactory != null)
|
||||
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
|
||||
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(itemID);
|
||||
@@ -1991,24 +1904,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
|
||||
}
|
||||
|
||||
public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
|
||||
{
|
||||
ScenePresence presence;
|
||||
if (TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
presence.Appearance.DetachAttachment(itemID);
|
||||
|
||||
// Save avatar attachment information
|
||||
if (m_AvatarFactory != null)
|
||||
{
|
||||
m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID);
|
||||
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
|
||||
m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
}
|
||||
|
||||
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
|
||||
{
|
||||
EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID);
|
||||
|
||||
@@ -307,6 +307,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
public IAttachmentsModule AttachmentsModule { get; set; }
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
public IAvatarFactory AvatarFactory
|
||||
{
|
||||
@@ -1132,10 +1133,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public int GetInaccurateNeighborCount()
|
||||
{
|
||||
lock (m_neighbours)
|
||||
{
|
||||
return m_neighbours.Count;
|
||||
}
|
||||
return m_neighbours.Count;
|
||||
}
|
||||
|
||||
// This is the method that shuts down the scene.
|
||||
@@ -1215,6 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||
XferManager = RequestModuleInterface<IXfer>();
|
||||
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
||||
AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
|
||||
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
|
||||
m_dialogModule = RequestModuleInterface<IDialogModule>();
|
||||
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
|
||||
@@ -2405,9 +2404,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
AttachmentsModule.AttachObject(
|
||||
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
|
||||
|
||||
AttachObject(
|
||||
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
|
||||
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
grp.SendGroupFullUpdate();
|
||||
}
|
||||
@@ -2642,10 +2643,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
|
||||
{
|
||||
client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
|
||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
||||
client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
|
||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
||||
client.OnObjectAttach += m_sceneGraph.AttachObject;
|
||||
client.OnObjectDetach += m_sceneGraph.DetachObject;
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
|
||||
}
|
||||
|
||||
public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
|
||||
@@ -2692,8 +2695,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
protected virtual void UnsubscribeToClientEvents(IClientAPI client)
|
||||
{
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2715,7 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
UnSubscribeToClientNetworkEvents(client);
|
||||
|
||||
|
||||
// EventManager.TriggerOnNewClient(client);
|
||||
}
|
||||
|
||||
@@ -2795,12 +2796,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
|
||||
{
|
||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
|
||||
{
|
||||
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
|
||||
client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
|
||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
|
||||
client.OnObjectAttach -= m_sceneGraph.AttachObject;
|
||||
client.OnObjectDetach -= m_sceneGraph.DetachObject;
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
|
||||
}
|
||||
|
||||
public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (group != null)
|
||||
{
|
||||
//group.DetachToGround();
|
||||
m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient);
|
||||
m_parentScene.AttachmentsModule.ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
if (m_parentScene.AttachmentsModule.AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
{
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
@@ -547,8 +547,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||
tainted = true;
|
||||
|
||||
AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
||||
m_parentScene.AttachmentsModule.AttachObject(
|
||||
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
||||
//objatt.ScheduleGroupForFullUpdate();
|
||||
|
||||
if (tainted)
|
||||
objatt.HasGroupChanged = true;
|
||||
|
||||
@@ -572,119 +574,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return null;
|
||||
}
|
||||
|
||||
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
|
||||
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
|
||||
public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
|
||||
{
|
||||
if (itemID == UUID.Zero) // If this happened, someone made a mistake....
|
||||
return;
|
||||
|
||||
// We can NOT use the dictionries here, as we are looking
|
||||
// for an entity by the fromAssetID, which is NOT the prim UUID
|
||||
//
|
||||
List<EntityBase> detachEntities = GetEntities();
|
||||
SceneObjectGroup group;
|
||||
|
||||
foreach (EntityBase entity in detachEntities)
|
||||
{
|
||||
if (entity is SceneObjectGroup)
|
||||
{
|
||||
group = (SceneObjectGroup)entity;
|
||||
if (group.GetFromItemID() == itemID)
|
||||
{
|
||||
m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
|
||||
group.DetachToInventoryPrep();
|
||||
m_log.Debug("[DETACH]: Saving attachpoint: " +
|
||||
((uint)group.GetAttachmentPoint()).ToString());
|
||||
m_parentScene.UpdateKnownItem(remoteClient, group,
|
||||
group.GetFromItemID(), group.OwnerID);
|
||||
m_parentScene.DeleteSceneObject(group, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
{
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
{
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Saves and gets itemID
|
||||
UUID itemId;
|
||||
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = group.GetFromItemID();
|
||||
}
|
||||
|
||||
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
|
||||
|
||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
|
||||
// In case it is later dropped again, don't let
|
||||
// it get cleaned up
|
||||
//
|
||||
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
group.HasGroupChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
ScenePresence newAvatar = null;
|
||||
|
||||
@@ -637,7 +637,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_items[item.ItemID] = item;
|
||||
m_inventorySerial++;
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
|
||||
|
||||
@@ -2675,6 +2675,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance ||
|
||||
Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance)
|
||||
{
|
||||
m_lastChildAgentUpdatePosition = AbsolutePosition;
|
||||
m_lastChildAgentUpdateCamPosition = CameraPosition;
|
||||
|
||||
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
|
||||
cadu.ActiveGroupID = UUID.Zero.Guid;
|
||||
cadu.AgentID = UUID.Guid;
|
||||
@@ -2683,8 +2686,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Vector3 tempCameraCenter = m_CameraCenter;
|
||||
cadu.cameraPosition = tempCameraCenter;
|
||||
cadu.drawdistance = m_DrawDistance;
|
||||
if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
|
||||
cadu.godlevel = m_godlevel;
|
||||
cadu.GroupAccess = 0;
|
||||
cadu.Position = AbsolutePosition;
|
||||
cadu.regionHandle = m_rootRegionHandle;
|
||||
@@ -2707,9 +2708,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
agentpos.CopyFrom(cadu);
|
||||
|
||||
m_scene.SendOutChildAgentUpdates(agentpos, this);
|
||||
|
||||
m_lastChildAgentUpdatePosition = AbsolutePosition;
|
||||
m_lastChildAgentUpdateCamPosition = CameraPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user