move attachment subscription events into AttachmentsModule from scene.

restored to some heavy casting in order to preserve RegionCombinerModule semantics, pending better events.
This commit is contained in:
Justin Clark-Casey (justincc)
2010-07-30 21:41:44 +01:00
parent 4d83b2d8a6
commit 424b4b2b86
3 changed files with 28 additions and 38 deletions

View File

@@ -56,11 +56,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
m_scene = scene;
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)
{
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
}
public void RegionLoaded(Scene scene) {}
@@ -69,7 +72,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
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>
/// Called by client
/// </summary>