mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Added IRegistryCore and RegistryCore to OpenSim.Framework.
Added a ApplicationRegistry to OpenSimBase. Changed LoadRegionsPlugin so it registers itself to that application registry. Added a event to LoadRegionsPlugin, that is triggered when it creates a new scene ,although maybe this event should actually be in opensimBase incase other plugins are creating regions (like the RemoteAdminPlugin).
This commit is contained in:
@@ -38,13 +38,19 @@ using OpenSim.Region.CoreModules.Avatar.InstantMessage;
|
||||
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
|
||||
using OpenSim.Region.CoreModules.Scripting.LoadImageURL;
|
||||
using OpenSim.Region.CoreModules.Scripting.XMLRPC;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
{
|
||||
public delegate void NewRegionCreated(IScene scene);
|
||||
|
||||
public class LoadRegionsPlugin : IApplicationPlugin
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event NewRegionCreated OnNewRegionCreated;
|
||||
private NewRegionCreated m_newRegionCreatedHandler;
|
||||
|
||||
#region IApplicationPlugin Members
|
||||
|
||||
// TODO: required by IPlugin, but likely not at all right
|
||||
@@ -56,6 +62,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
|
||||
protected OpenSimBase m_openSim;
|
||||
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
||||
@@ -65,6 +72,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
public void Initialise(OpenSimBase openSim)
|
||||
{
|
||||
m_openSim = openSim;
|
||||
m_openSim.ApplicationRegistry.RegisterInterface<LoadRegionsPlugin>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -99,9 +107,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
|
||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||
{
|
||||
IScene scene;
|
||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||
")");
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
if (scene != null)
|
||||
{
|
||||
m_newRegionCreatedHandler = OnNewRegionCreated;
|
||||
if (m_newRegionCreatedHandler != null)
|
||||
{
|
||||
m_newRegionCreatedHandler(scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_openSim.ModuleLoader.PostInitialise();
|
||||
@@ -182,9 +199,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
{
|
||||
if (regionhandle == regionsToLoad[i].RegionHandle)
|
||||
{
|
||||
IScene scene;
|
||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() + ")");
|
||||
openSim.CreateRegion(regionsToLoad[i], true);
|
||||
openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,8 +563,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
region.RegionID, regionXmlPath);
|
||||
region.SaveRegionToFile("dynamic region", regionXmlPath);
|
||||
}
|
||||
|
||||
m_app.CreateRegion(region);
|
||||
IScene newscene;
|
||||
m_app.CreateRegion(region, out newscene);
|
||||
|
||||
responseData["success"] = "true";
|
||||
responseData["region_name"] = region.RegionName;
|
||||
|
||||
Reference in New Issue
Block a user