move attachment subscription events into AttachmentsModule from scene.
restored to some heavy casting in order to preserve RegionCombinerModule semantics, pending better events.prebuild-update
parent
4d83b2d8a6
commit
424b4b2b86
|
@ -56,11 +56,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
||||||
|
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||||
|
// TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
|
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
|
||||||
|
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene) {}
|
public void RegionLoaded(Scene scene) {}
|
||||||
|
@ -70,6 +73,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
RemoveRegion(m_scene);
|
RemoveRegion(m_scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SubscribeToClientEvents(IClientAPI client)
|
||||||
|
{
|
||||||
|
client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory;
|
||||||
|
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
|
||||||
|
client.OnObjectAttach += AttachObject;
|
||||||
|
client.OnObjectDetach += DetachObject;
|
||||||
|
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnsubscribeFromClientEvents(IClientAPI client)
|
||||||
|
{
|
||||||
|
client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory;
|
||||||
|
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
|
||||||
|
client.OnObjectAttach -= AttachObject;
|
||||||
|
client.OnObjectDetach -= DetachObject;
|
||||||
|
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called by client
|
/// Called by client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2783,17 +2783,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SubscribeToClientPrimEvents(client);
|
SubscribeToClientPrimEvents(client);
|
||||||
SubscribeToClientPrimRezEvents(client);
|
SubscribeToClientPrimRezEvents(client);
|
||||||
SubscribeToClientInventoryEvents(client);
|
SubscribeToClientInventoryEvents(client);
|
||||||
SubscribeToClientAttachmentEvents(client);
|
|
||||||
SubscribeToClientTeleportEvents(client);
|
SubscribeToClientTeleportEvents(client);
|
||||||
SubscribeToClientScriptEvents(client);
|
SubscribeToClientScriptEvents(client);
|
||||||
SubscribeToClientParcelEvents(client);
|
SubscribeToClientParcelEvents(client);
|
||||||
SubscribeToClientGridEvents(client);
|
SubscribeToClientGridEvents(client);
|
||||||
SubscribeToClientGodEvents(client);
|
SubscribeToClientGodEvents(client);
|
||||||
|
|
||||||
SubscribeToClientNetworkEvents(client);
|
SubscribeToClientNetworkEvents(client);
|
||||||
|
|
||||||
|
|
||||||
// EventManager.TriggerOnNewClient(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
|
public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
|
||||||
|
@ -2874,18 +2869,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
|
client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (AttachmentsModule != null)
|
|
||||||
{
|
|
||||||
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
|
|
||||||
client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
|
|
||||||
client.OnObjectAttach += AttachmentsModule.AttachObject;
|
|
||||||
client.OnObjectDetach += AttachmentsModule.DetachObject;
|
|
||||||
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
|
public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnTeleportLocationRequest += RequestTeleportLocation;
|
client.OnTeleportLocationRequest += RequestTeleportLocation;
|
||||||
|
@ -2934,16 +2917,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register for events from the client
|
/// Unsubscribe the client from events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client">The IClientAPI of the connected client</param>
|
/// <param name="client">The IClientAPI of the client</param>
|
||||||
public virtual void UnSubscribeToClientEvents(IClientAPI client)
|
public virtual void UnSubscribeToClientEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
UnSubscribeToClientTerrainEvents(client);
|
UnSubscribeToClientTerrainEvents(client);
|
||||||
UnSubscribeToClientPrimEvents(client);
|
UnSubscribeToClientPrimEvents(client);
|
||||||
UnSubscribeToClientPrimRezEvents(client);
|
UnSubscribeToClientPrimRezEvents(client);
|
||||||
UnSubscribeToClientInventoryEvents(client);
|
UnSubscribeToClientInventoryEvents(client);
|
||||||
UnSubscribeToClientAttachmentEvents(client);
|
|
||||||
UnSubscribeToClientTeleportEvents(client);
|
UnSubscribeToClientTeleportEvents(client);
|
||||||
UnSubscribeToClientScriptEvents(client);
|
UnSubscribeToClientScriptEvents(client);
|
||||||
UnSubscribeToClientParcelEvents(client);
|
UnSubscribeToClientParcelEvents(client);
|
||||||
|
@ -2951,8 +2933,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UnSubscribeToClientGodEvents(client);
|
UnSubscribeToClientGodEvents(client);
|
||||||
|
|
||||||
UnSubscribeToClientNetworkEvents(client);
|
UnSubscribeToClientNetworkEvents(client);
|
||||||
|
|
||||||
// EventManager.TriggerOnNewClient(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
|
public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
|
||||||
|
@ -3029,18 +3009,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
|
client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (AttachmentsModule != null)
|
|
||||||
{
|
|
||||||
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
|
|
||||||
client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
|
|
||||||
client.OnObjectAttach -= AttachmentsModule.AttachObject;
|
|
||||||
client.OnObjectDetach -= AttachmentsModule.DetachObject;
|
|
||||||
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
|
public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnTeleportLocationRequest -= RequestTeleportLocation;
|
client.OnTeleportLocationRequest -= RequestTeleportLocation;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.Avatar.Attachments;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.RegionCombinerModule
|
namespace OpenSim.Region.RegionCombinerModule
|
||||||
|
@ -48,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
m_virtScene.UnSubscribeToClientPrimEvents(client);
|
m_virtScene.UnSubscribeToClientPrimEvents(client);
|
||||||
m_virtScene.UnSubscribeToClientPrimRezEvents(client);
|
m_virtScene.UnSubscribeToClientPrimRezEvents(client);
|
||||||
m_virtScene.UnSubscribeToClientInventoryEvents(client);
|
m_virtScene.UnSubscribeToClientInventoryEvents(client);
|
||||||
m_virtScene.UnSubscribeToClientAttachmentEvents(client);
|
((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
|
||||||
//m_virtScene.UnSubscribeToClientTeleportEvents(client);
|
//m_virtScene.UnSubscribeToClientTeleportEvents(client);
|
||||||
m_virtScene.UnSubscribeToClientScriptEvents(client);
|
m_virtScene.UnSubscribeToClientScriptEvents(client);
|
||||||
m_virtScene.UnSubscribeToClientGodEvents(client);
|
m_virtScene.UnSubscribeToClientGodEvents(client);
|
||||||
|
@ -58,7 +59,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
client.OnAddPrim += LocalAddNewPrim;
|
client.OnAddPrim += LocalAddNewPrim;
|
||||||
client.OnRezObject += LocalRezObject;
|
client.OnRezObject += LocalRezObject;
|
||||||
m_rootScene.SubscribeToClientInventoryEvents(client);
|
m_rootScene.SubscribeToClientInventoryEvents(client);
|
||||||
m_rootScene.SubscribeToClientAttachmentEvents(client);
|
((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
|
||||||
//m_rootScene.SubscribeToClientTeleportEvents(client);
|
//m_rootScene.SubscribeToClientTeleportEvents(client);
|
||||||
m_rootScene.SubscribeToClientScriptEvents(client);
|
m_rootScene.SubscribeToClientScriptEvents(client);
|
||||||
m_rootScene.SubscribeToClientGodEvents(client);
|
m_rootScene.SubscribeToClientGodEvents(client);
|
||||||
|
|
Loading…
Reference in New Issue