converting NPC module to ISharedRegionModule

Signed-off-by: Diva Canto <diva@metaverseink.com>
integration
SignpostMarv 2012-11-11 20:41:20 +00:00 committed by Diva Canto
parent c60e1a1ae6
commit 23605cf93d
1 changed files with 22 additions and 9 deletions

View File

@ -31,6 +31,7 @@ using System.Reflection;
using System.Threading; using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using Mono.Addins;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -40,26 +41,41 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.World.NPC 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 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
public void Initialise(Scene scene, IConfigSource source) public bool Enabled { get; private set; }
public void Initialise(IConfigSource source)
{ {
IConfig config = source.Configs["NPC"]; 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<INPCModule>(this); scene.RegisterModuleInterface<INPCModule>(this);
} }
public void RegionLoaded(Scene scene)
{
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void RemoveRegion(Scene scene)
{
scene.UnregisterModuleInterface<INPCModule>(this);
}
public void Close() public void Close()
{ {
} }
@ -69,10 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
get { return "NPCModule"; } get { return "NPCModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface { get { return null; } }
{
get { return true; }
}
public bool IsNPC(UUID agentId, Scene scene) public bool IsNPC(UUID agentId, Scene scene)
{ {