Add EventManager.OnIncomingSceneObject event which is triggered by an incoming scene object
Add a read-only Attachments property to ScenePresence0.6.9
parent
bf9fc69d01
commit
00947cf2ca
|
@ -205,6 +205,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
|
||||
public event OnMakeRootAgentDelegate OnMakeRootAgent;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object or attachment enters a scene
|
||||
/// </summary>
|
||||
public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
|
||||
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
|
||||
|
||||
public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
|
||||
|
||||
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
|
||||
|
@ -1206,6 +1212,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
|
||||
{
|
||||
OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
|
||||
if (handlerIncomingSceneObject != null)
|
||||
{
|
||||
foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(so);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
|
||||
|
|
|
@ -2406,9 +2406,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return successYN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when objects or attachments cross the border between regions.
|
||||
/// </summary>
|
||||
/// <param name="sog"></param>
|
||||
/// <returns></returns>
|
||||
public bool IncomingCreateObject(ISceneObject sog)
|
||||
{
|
||||
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
||||
//m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
||||
SceneObjectGroup newObject;
|
||||
try
|
||||
{
|
||||
|
@ -2425,7 +2430,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
|
||||
|
||||
// Do this as late as possible so that listeners have full access to the incoming object
|
||||
EventManager.TriggerOnIncomingSceneObject(newObject);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2437,6 +2447,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>False</returns>
|
||||
public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
|
||||
{
|
||||
//m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
|
||||
|
||||
ScenePresence sp = GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
{
|
||||
|
@ -2496,29 +2508,25 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
//RootPrim.SetParentLocalId(parentLocalID);
|
||||
|
||||
m_log.DebugFormat("[ATTACHMENT]: Received " +
|
||||
"attachment {0}, inworld asset id {1}",
|
||||
//grp.RootPart.LastOwnerID.ToString(),
|
||||
grp.GetFromItemID(),
|
||||
grp.UUID.ToString());
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
|
||||
|
||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||
m_log.DebugFormat("[ATTACHMENT]: Attach " +
|
||||
"to avatar {0} at position {1}",
|
||||
sp.UUID.ToString(), grp.AbsolutePosition);
|
||||
AttachObject(sp.ControllingClient,
|
||||
grp.LocalId, (uint)0,
|
||||
grp.GroupRotation,
|
||||
grp.AbsolutePosition, false);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||
|
||||
AttachObject(
|
||||
sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
|
||||
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
grp.SendGroupFullUpdate();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -191,7 +191,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (handlerChildAgentUpdate != null)
|
||||
handlerChildAgentUpdate(cAgentData);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
protected ScenePresenceAnimator m_animator;
|
||||
|
||||
/// <value>
|
||||
/// The scene objects attached to this avatar. Do not change this list directly - use methods such as
|
||||
/// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
|
||||
/// </value>
|
||||
public List<SceneObjectGroup> Attachments
|
||||
{
|
||||
get { return m_attachments; }
|
||||
}
|
||||
protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
|
||||
|
||||
private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>();
|
||||
|
@ -1105,7 +1113,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
|
||||
SendInitialData();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue