- Moved TerrainModule to the new region-module system.
- Fixed some locking issues. Either lock, or don't (if you don't have to). Only locking access half of the time won't work reliably. - Had to adapt test helpers that use the "old" IRegionModule. TerrainModule isn't one anymore.0.6.5-rc1
parent
b717f991ed
commit
6db21bbf97
|
@ -8,7 +8,7 @@
|
|||
</Dependencies>
|
||||
|
||||
<Extension path = "/OpenSim/RegionModules">
|
||||
<!-- <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> -->
|
||||
<RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
|
||||
</Extension>
|
||||
|
||||
<Extension path = "/OpenSim/WindModule">
|
||||
|
|
|
@ -42,7 +42,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.World.Terrain
|
||||
{
|
||||
public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule
|
||||
public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule
|
||||
{
|
||||
#region StandardTerrainEffects enum
|
||||
|
||||
|
@ -93,49 +93,62 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
#region INonSharedRegionModule Members
|
||||
|
||||
/// <summary>
|
||||
/// Creates and initialises a terrain module for a region
|
||||
/// </summary>
|
||||
/// <param name="scene">Region initialising</param>
|
||||
/// <param name="config">Config for the region</param>
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
// Install terrain module in the simulator
|
||||
if (m_scene.Heightmap == null)
|
||||
lock (m_scene)
|
||||
{
|
||||
lock (m_scene)
|
||||
if (m_scene.Heightmap == null)
|
||||
{
|
||||
m_channel = new TerrainChannel();
|
||||
m_scene.Heightmap = m_channel;
|
||||
m_revert = new TerrainChannel();
|
||||
UpdateRevertMap();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_channel = m_scene.Heightmap;
|
||||
m_revert = new TerrainChannel();
|
||||
UpdateRevertMap();
|
||||
else
|
||||
{
|
||||
m_channel = m_scene.Heightmap;
|
||||
m_revert = new TerrainChannel();
|
||||
UpdateRevertMap();
|
||||
}
|
||||
|
||||
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
||||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
|
||||
InstallInterfaces();
|
||||
}
|
||||
|
||||
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
||||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
|
||||
InstallDefaultEffects();
|
||||
LoadPlugins();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables terrain module when called
|
||||
/// </summary>
|
||||
public void PostInitialise()
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
InstallDefaultEffects();
|
||||
InstallInterfaces();
|
||||
LoadPlugins();
|
||||
lock (m_scene)
|
||||
{
|
||||
// remove the commands
|
||||
m_scene.UnregisterModuleCommander(m_commander.Name);
|
||||
// remove the event-handlers
|
||||
m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
|
||||
m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnNewClient -= EventManager_OnNewClient;
|
||||
// remove the interface
|
||||
m_scene.UnregisterModuleInterface<ITerrainModule>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -147,11 +160,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
get { return "TerrainModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITerrainModule Members
|
||||
|
@ -207,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader available for that format.");
|
||||
throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
|
||||
}
|
||||
|
@ -268,7 +276,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CheckForTerrainUpdates();
|
||||
m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");
|
||||
return;
|
||||
|
@ -288,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId)
|
||||
{
|
||||
client_OnModifyTerrain(user, (float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current heightmap to a specified stream.
|
||||
|
@ -501,7 +509,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
@ -109,7 +110,7 @@ namespace OpenSim.Tests.Common.Setup
|
|||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="modules"></param>
|
||||
public static void SetupSceneModules(Scene scene, params IRegionModule[] modules)
|
||||
public static void SetupSceneModules(Scene scene, params object[] modules)
|
||||
{
|
||||
SetupSceneModules(scene, null, modules);
|
||||
}
|
||||
|
@ -120,12 +121,36 @@ namespace OpenSim.Tests.Common.Setup
|
|||
/// <param name="scene"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="modules"></param>
|
||||
public static void SetupSceneModules(Scene scene, IConfigSource config, params IRegionModule[] modules)
|
||||
public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules)
|
||||
{
|
||||
foreach (IRegionModule module in modules)
|
||||
List<IRegionModuleBase> newModules = new List<IRegionModuleBase>();
|
||||
foreach (object module in modules)
|
||||
{
|
||||
module.Initialise(scene, config);
|
||||
scene.AddModule(module.Name, module);
|
||||
if (module is IRegionModule)
|
||||
{
|
||||
IRegionModule m = (IRegionModule)module;
|
||||
m.Initialise(scene, config);
|
||||
scene.AddModule(m.Name, m);
|
||||
}
|
||||
else if(module is IRegionModuleBase)
|
||||
{
|
||||
// for the new system, everything has to be initialised first,
|
||||
// shared modules have to be post-initialised, then all get an AddRegion with the scene
|
||||
IRegionModuleBase m = (IRegionModuleBase)module;
|
||||
m.Initialise(config);
|
||||
newModules.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
{
|
||||
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
{
|
||||
module.AddRegion(scene);
|
||||
scene.AddRegionModule(module.Name, module);
|
||||
}
|
||||
|
||||
scene.SetModuleInterfaces();
|
||||
|
|
Loading…
Reference in New Issue