From 23605cf93d110523320430d1c9dd2e83865fca01 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 11 Nov 2012 20:41:20 +0000 Subject: converting NPC module to ISharedRegionModule Signed-off-by: Diva Canto --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 31 +++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') 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; using System.Threading; using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -40,26 +41,41 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.World.NPC { - public class NPCModule : IRegionModule, INPCModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NPCModule : INPCModule, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Dictionary m_avatars = new Dictionary(); - public void Initialise(Scene scene, IConfigSource source) + public bool Enabled { get; private set; } + + public void Initialise(IConfigSource source) { IConfig config = source.Configs["NPC"]; - if (config != null && config.GetBoolean("Enabled", false)) - { + Enabled = (config != null && config.GetBoolean("Enabled", false)); + } + + public void AddRegion(Scene scene) + { + if (Enabled) scene.RegisterModuleInterface(this); - } + } + + public void RegionLoaded(Scene scene) + { } public void PostInitialise() { } + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + } + public void Close() { } @@ -69,10 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC get { return "NPCModule"; } } - public bool IsSharedModule - { - get { return true; } - } + public Type ReplaceableInterface { get { return null; } } public bool IsNPC(UUID agentId, Scene scene) { -- cgit v1.1