diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ff3036a..d895bb1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenMetaverse.Packets; | 35 | using OpenMetaverse.Packets; |
@@ -39,38 +40,64 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 41 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
41 | { | 42 | { |
42 | public class AttachmentsModule : IAttachmentsModule, IRegionModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsModule")] |
44 | public class AttachmentsModule : IAttachmentsModule, INonSharedRegionModule | ||
43 | { | 45 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | protected Scene m_scene = null; | 48 | protected Scene m_scene = null; |
49 | |||
50 | public string Name { get { return "Attachments Module"; } } | ||
51 | public Type ReplaceableInterface { get { return null; } } | ||
47 | 52 | ||
48 | public void Initialise(Scene scene, IConfigSource source) | 53 | public void Initialise(IConfigSource source) {} |
54 | |||
55 | public void AddRegion(Scene scene) | ||
49 | { | 56 | { |
50 | scene.RegisterModuleInterface<IAttachmentsModule>(this); | ||
51 | m_scene = scene; | 57 | m_scene = scene; |
58 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | ||
59 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
60 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | ||
52 | } | 61 | } |
53 | 62 | ||
54 | public void PostInitialise() | 63 | public void RemoveRegion(Scene scene) |
55 | { | 64 | { |
65 | m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); | ||
66 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
56 | } | 67 | } |
57 | 68 | ||
58 | public void Close() | 69 | public void RegionLoaded(Scene scene) {} |
70 | |||
71 | public void Close() | ||
59 | { | 72 | { |
73 | RemoveRegion(m_scene); | ||
60 | } | 74 | } |
61 | 75 | ||
62 | public string Name | 76 | public void SubscribeToClientEvents(IClientAPI client) |
63 | { | 77 | { |
64 | get { return "Attachments Module"; } | 78 | client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory; |
79 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; | ||
80 | client.OnObjectAttach += AttachObject; | ||
81 | client.OnObjectDetach += DetachObject; | ||
82 | client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; | ||
65 | } | 83 | } |
66 | 84 | ||
67 | public bool IsSharedModule | 85 | public void UnsubscribeFromClientEvents(IClientAPI client) |
68 | { | 86 | { |
69 | get { return false; } | 87 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory; |
88 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; | ||
89 | client.OnObjectAttach -= AttachObject; | ||
90 | client.OnObjectDetach -= DetachObject; | ||
91 | client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; | ||
70 | } | 92 | } |
71 | 93 | ||
72 | // Called by client | 94 | /// <summary> |
73 | // | 95 | /// Called by client |
96 | /// </summary> | ||
97 | /// <param name="remoteClient"></param> | ||
98 | /// <param name="objectLocalID"></param> | ||
99 | /// <param name="AttachmentPt"></param> | ||
100 | /// <param name="silent"></param> | ||
74 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 101 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
75 | { | 102 | { |
76 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | 103 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); |