aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs70
2 files changed, 40 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 6db1042..8b5f26f 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -8,7 +8,7 @@
8 </Dependencies> 8 </Dependencies>
9 9
10 <Extension path = "/OpenSim/RegionModules"> 10 <Extension path = "/OpenSim/RegionModules">
11<!-- <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> --> 11 <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
12 </Extension> 12 </Extension>
13 13
14 <Extension path = "/OpenSim/WindModule"> 14 <Extension path = "/OpenSim/WindModule">
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 7793aa5..9f1867f 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -42,7 +42,7 @@ using OpenSim.Region.Framework.Scenes;
42 42
43namespace OpenSim.Region.CoreModules.World.Terrain 43namespace OpenSim.Region.CoreModules.World.Terrain
44{ 44{
45 public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule 45 public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule
46 { 46 {
47 #region StandardTerrainEffects enum 47 #region StandardTerrainEffects enum
48 48
@@ -93,49 +93,62 @@ namespace OpenSim.Region.CoreModules.World.Terrain
93 93
94 #endregion 94 #endregion
95 95
96 #region IRegionModule Members 96 #region INonSharedRegionModule Members
97 97
98 /// <summary> 98 /// <summary>
99 /// Creates and initialises a terrain module for a region 99 /// Creates and initialises a terrain module for a region
100 /// </summary> 100 /// </summary>
101 /// <param name="scene">Region initialising</param> 101 /// <param name="scene">Region initialising</param>
102 /// <param name="config">Config for the region</param> 102 /// <param name="config">Config for the region</param>
103 public void Initialise(Scene scene, IConfigSource config) 103 public void Initialise(IConfigSource config)
104 {
105 }
106
107 public void AddRegion(Scene scene)
104 { 108 {
105 m_scene = scene; 109 m_scene = scene;
106 110
107 // Install terrain module in the simulator 111 // Install terrain module in the simulator
108 if (m_scene.Heightmap == null) 112 lock (m_scene)
109 { 113 {
110 lock (m_scene) 114 if (m_scene.Heightmap == null)
111 { 115 {
112 m_channel = new TerrainChannel(); 116 m_channel = new TerrainChannel();
113 m_scene.Heightmap = m_channel; 117 m_scene.Heightmap = m_channel;
114 m_revert = new TerrainChannel(); 118 m_revert = new TerrainChannel();
115 UpdateRevertMap(); 119 UpdateRevertMap();
116 } 120 }
117 } 121 else
118 else 122 {
119 { 123 m_channel = m_scene.Heightmap;
120 m_channel = m_scene.Heightmap; 124 m_revert = new TerrainChannel();
121 m_revert = new TerrainChannel(); 125 UpdateRevertMap();
122 UpdateRevertMap(); 126 }
127
128 m_scene.RegisterModuleInterface<ITerrainModule>(this);
129 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
130 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
131 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
132 InstallInterfaces();
123 } 133 }
124 134
125 m_scene.RegisterModuleInterface<ITerrainModule>(this); 135 InstallDefaultEffects();
126 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 136 LoadPlugins();
127 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
128 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
129 } 137 }
130 138
131 /// <summary> 139 public void RemoveRegion(Scene scene)
132 /// Enables terrain module when called
133 /// </summary>
134 public void PostInitialise()
135 { 140 {
136 InstallDefaultEffects(); 141 lock (m_scene)
137 InstallInterfaces(); 142 {
138 LoadPlugins(); 143 // remove the commands
144 m_scene.UnregisterModuleCommander(m_commander.Name);
145 // remove the event-handlers
146 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
147 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
148 m_scene.EventManager.OnNewClient -= EventManager_OnNewClient;
149 // remove the interface
150 m_scene.UnregisterModuleInterface<ITerrainModule>(this);
151 }
139 } 152 }
140 153
141 public void Close() 154 public void Close()
@@ -147,11 +160,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
147 get { return "TerrainModule"; } 160 get { return "TerrainModule"; }
148 } 161 }
149 162
150 public bool IsSharedModule
151 {
152 get { return false; }
153 }
154
155 #endregion 163 #endregion
156 164
157 #region ITerrainModule Members 165 #region ITerrainModule Members
@@ -207,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
207 return; 215 return;
208 } 216 }
209 } 217 }
210 218
211 m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader available for that format."); 219 m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader available for that format.");
212 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); 220 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
213 } 221 }
@@ -268,7 +276,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
268 throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value)); 276 throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
269 } 277 }
270 } 278 }
271 279
272 CheckForTerrainUpdates(); 280 CheckForTerrainUpdates();
273 m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); 281 m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");
274 return; 282 return;
@@ -288,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
288 public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId) 296 public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action, UUID agentId)
289 { 297 {
290 client_OnModifyTerrain(user, (float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); 298 client_OnModifyTerrain(user, (float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
291 } 299 }
292 300
293 /// <summary> 301 /// <summary>
294 /// Saves the current heightmap to a specified stream. 302 /// Saves the current heightmap to a specified stream.
@@ -501,7 +509,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
501 m_commander.ProcessConsoleCommand("help", new string[0]); 509 m_commander.ProcessConsoleCommand("help", new string[0]);
502 return; 510 return;
503 } 511 }
504 512
505 string[] tmpArgs = new string[args.Length - 2]; 513 string[] tmpArgs = new string[args.Length - 2];
506 int i; 514 int i;
507 for (i = 2; i < args.Length; i++) 515 for (i = 2; i < args.Length; i++)