diff options
author | SignpostMarv | 2012-11-11 20:41:20 +0000 |
---|---|---|
committer | Diva Canto | 2012-11-11 13:50:38 -0800 |
commit | 23605cf93d110523320430d1c9dd2e83865fca01 (patch) | |
tree | 6e58925e09771c48eb26fc387f055fdce6bcf110 /OpenSim/Region/OptionalModules/World | |
parent | J2KDecoderModule: move the code out of PostInitialise() (diff) | |
download | opensim-SC-23605cf93d110523320430d1c9dd2e83865fca01.zip opensim-SC-23605cf93d110523320430d1c9dd2e83865fca01.tar.gz opensim-SC-23605cf93d110523320430d1c9dd2e83865fca01.tar.bz2 opensim-SC-23605cf93d110523320430d1c9dd2e83865fca01.tar.xz |
converting NPC module to ISharedRegionModule
Signed-off-by: Diva Canto <diva@metaverseink.com>
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3f25bcf..b372c88 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using System.Threading; | 31 | using System.Threading; |
32 | using log4net; | 32 | using log4net; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Mono.Addins; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
@@ -40,26 +41,41 @@ using OpenSim.Services.Interfaces; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.OptionalModules.World.NPC | 42 | namespace OpenSim.Region.OptionalModules.World.NPC |
42 | { | 43 | { |
43 | public class NPCModule : IRegionModule, INPCModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
45 | public class NPCModule : INPCModule, ISharedRegionModule | ||
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
47 | private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); | 49 | private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); |
48 | 50 | ||
49 | public void Initialise(Scene scene, IConfigSource source) | 51 | public bool Enabled { get; private set; } |
52 | |||
53 | public void Initialise(IConfigSource source) | ||
50 | { | 54 | { |
51 | IConfig config = source.Configs["NPC"]; | 55 | IConfig config = source.Configs["NPC"]; |
52 | 56 | ||
53 | if (config != null && config.GetBoolean("Enabled", false)) | 57 | Enabled = (config != null && config.GetBoolean("Enabled", false)); |
54 | { | 58 | } |
59 | |||
60 | public void AddRegion(Scene scene) | ||
61 | { | ||
62 | if (Enabled) | ||
55 | scene.RegisterModuleInterface<INPCModule>(this); | 63 | scene.RegisterModuleInterface<INPCModule>(this); |
56 | } | 64 | } |
65 | |||
66 | public void RegionLoaded(Scene scene) | ||
67 | { | ||
57 | } | 68 | } |
58 | 69 | ||
59 | public void PostInitialise() | 70 | public void PostInitialise() |
60 | { | 71 | { |
61 | } | 72 | } |
62 | 73 | ||
74 | public void RemoveRegion(Scene scene) | ||
75 | { | ||
76 | scene.UnregisterModuleInterface<INPCModule>(this); | ||
77 | } | ||
78 | |||
63 | public void Close() | 79 | public void Close() |
64 | { | 80 | { |
65 | } | 81 | } |
@@ -69,10 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
69 | get { return "NPCModule"; } | 85 | get { return "NPCModule"; } |
70 | } | 86 | } |
71 | 87 | ||
72 | public bool IsSharedModule | 88 | public Type ReplaceableInterface { get { return null; } } |
73 | { | ||
74 | get { return true; } | ||
75 | } | ||
76 | 89 | ||
77 | public bool IsNPC(UUID agentId, Scene scene) | 90 | public bool IsNPC(UUID agentId, Scene scene) |
78 | { | 91 | { |