aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorAdam Frisby2008-03-06 15:49:53 +0000
committerAdam Frisby2008-03-06 15:49:53 +0000
commita3601165029f8484988b5c322798a341ff1e9400 (patch)
tree4b761e7d0694dffb0b67018915fc240e7bbaa154 /OpenSim/Region/Environment
parent* Killed 4 more warnings (at 16 now) (diff)
downloadopensim-SC_OLD-a3601165029f8484988b5c322798a341ff1e9400.zip
opensim-SC_OLD-a3601165029f8484988b5c322798a341ff1e9400.tar.gz
opensim-SC_OLD-a3601165029f8484988b5c322798a341ff1e9400.tar.bz2
opensim-SC_OLD-a3601165029f8484988b5c322798a341ff1e9400.tar.xz
* Disabled ancient TerrainEngine.
* Enabled new TerrainModule. (The king is dead, long live the king!) * Use the console command: "script terrain save file.r32" / "script terrain load file.r32" to load/save terrain. Now uses the extension to determine file format. * MANY of the old terrain features do not have a replacement function in the new module yet, this needs to be corrected, but has not been done so far. This being said, the new module is faster and more efficient and should be a good replacement.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs3
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs1
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs94
-rw-r--r--OpenSim/Region/Environment/Modules/TreePopulatorModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs84
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs25
10 files changed, 120 insertions, 146 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 96baf21..bfa6d59 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -137,13 +137,10 @@ namespace OpenSim.Region.Environment
137 { 137 {
138 // Water Height 138 // Water Height
139 m_regInfo.EstateSettings.waterHeight = WaterHeight; 139 m_regInfo.EstateSettings.waterHeight = WaterHeight;
140 m_scene.Terrain.watermap.Fill(WaterHeight);
141 140
142 // Terraforming limits 141 // Terraforming limits
143 m_regInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; 142 m_regInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
144 m_regInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; 143 m_regInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
145 m_scene.Terrain.maxRaise = TerrainRaiseLimit;
146 m_scene.Terrain.minLower = TerrainLowerLimit;
147 144
148 // Time of day / fixed sun 145 // Time of day / fixed sun
149 m_regInfo.EstateSettings.useFixedSun = UseFixedSun; 146 m_regInfo.EstateSettings.useFixedSun = UseFixedSun;
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs
index 62074cb..fb83e63 100644
--- a/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs
+++ b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs
@@ -34,6 +34,7 @@ namespace OpenSim.Region.Environment.Interfaces
34 double this[int x, int y] { get; set; } 34 double this[int x, int y] { get; set; }
35 int Width { get; } 35 int Width { get; }
36 float[] GetFloatsSerialised(); 36 float[] GetFloatsSerialised();
37 double[,] GetDoubles();
37 bool Tainted(int x, int y); 38 bool Tainted(int x, int y);
38 } 39 }
39} 40}
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 1c4697c..4c6168d 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -440,11 +440,11 @@ namespace OpenSim.Region.Environment.LandManagement
440 } 440 }
441 } 441 }
442 landData.AABBMin = 442 landData.AABBMin =
443 new LLVector3((float) (min_x*4), (float) (min_y*4), 443 new LLVector3((float)(min_x * 4), (float)(min_y * 4),
444 (float) m_scene.Terrain.GetHeight((min_x*4), (min_y*4))); 444 (float)m_scene.Heightmap[(min_x * 4), (min_y * 4)]);
445 landData.AABBMax = 445 landData.AABBMax =
446 new LLVector3((float) (max_x*4), (float) (max_y*4), 446 new LLVector3((float)(max_x * 4), (float)(max_y * 4),
447 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4))); 447 (float)m_scene.Heightmap[(max_x * 4), (max_y * 4)]);
448 landData.area = tempArea; 448 landData.area = tempArea;
449 } 449 }
450 450
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
index 2cf77ff..7ab1e2b 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs
@@ -96,6 +96,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain
96 return heights; 96 return heights;
97 } 97 }
98 98
99 public double[,] GetDoubles()
100 {
101 return map;
102 }
103
99 public double this[int x, int y] 104 public double this[int x, int y]
100 { 105 {
101 get 106 get
@@ -104,14 +109,25 @@ namespace OpenSim.Region.Environment.Modules.Terrain
104 } 109 }
105 set 110 set
106 { 111 {
107 taint[x / 16, y / 16] = true; 112 if (map[x, y] != value)
108 map[x, y] = value; 113 {
114 taint[x / 16, y / 16] = true;
115 map[x, y] = value;
116 }
109 } 117 }
110 } 118 }
111 119
112 public bool Tainted(int x, int y) 120 public bool Tainted(int x, int y)
113 { 121 {
114 return taint[x / 16, y / 16]; 122 if (taint[x / 16, y / 16] != false)
123 {
124 taint[x / 16, y / 16] = false;
125 return true;
126 }
127 else
128 {
129 return false;
130 }
115 } 131 }
116 132
117 public TerrainChannel() 133 public TerrainChannel()
@@ -163,6 +179,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
163 private Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); 179 private Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
164 Scene m_scene; 180 Scene m_scene;
165 ITerrainChannel m_channel; 181 ITerrainChannel m_channel;
182 bool m_tainted = false;
166 private IConfigSource m_gConfig; 183 private IConfigSource m_gConfig;
167 184
168 private void InstallDefaultEffects() 185 private void InstallDefaultEffects()
@@ -241,6 +258,44 @@ namespace OpenSim.Region.Environment.Modules.Terrain
241 } 258 }
242 259
243 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 260 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
261 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
262 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
263 }
264
265 void EventManager_OnTerrainTick()
266 {
267 if (m_tainted)
268 {
269 m_tainted = false;
270 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
271 m_scene.SaveTerrain();
272
273 //m_scene.CreateTerrainTexture(true);
274 }
275 }
276
277 void EventManager_OnPluginConsole(string[] args)
278 {
279 if (args[0] == "terrain")
280 {
281 string command = args[1];
282 string param = args[2];
283
284
285 switch (command)
286 {
287 case "load":
288 LoadFromFile(param);
289 SendUpdatedLayerData();
290 break;
291 case "save":
292 SaveToFile(param);
293 break;
294 default:
295 m_log.Warn("Unknown terrain command.");
296 break;
297 }
298 }
244 } 299 }
245 300
246 void EventManager_OnNewClient(IClientAPI client) 301 void EventManager_OnNewClient(IClientAPI client)
@@ -248,6 +303,31 @@ namespace OpenSim.Region.Environment.Modules.Terrain
248 client.OnModifyTerrain += client_OnModifyTerrain; 303 client.OnModifyTerrain += client_OnModifyTerrain;
249 } 304 }
250 305
306 void SendUpdatedLayerData()
307 {
308 bool shouldTaint = false;
309 float[] serialised = m_channel.GetFloatsSerialised();
310 int x, y;
311 for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize)
312 {
313 for (y = 0; y < m_channel.Height; y += Constants.TerrainPatchSize)
314 {
315 if (m_channel.Tainted(x, y))
316 {
317 m_scene.ForEachClient(delegate(IClientAPI controller)
318 {
319 controller.SendLayerData(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised);
320 });
321 shouldTaint = true;
322 }
323 }
324 }
325 if (shouldTaint)
326 {
327 m_tainted = true;
328 }
329 }
330
251 void client_OnModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, float south, float east, IClientAPI remoteClient) 331 void client_OnModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, float south, float east, IClientAPI remoteClient)
252 { 332 {
253 // Not a good permissions check, if in area mode, need to check the entire area. 333 // Not a good permissions check, if in area mode, need to check the entire area.
@@ -261,11 +341,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain
261 m_painteffects[(StandardTerrainEffects)action].PaintEffect( 341 m_painteffects[(StandardTerrainEffects)action].PaintEffect(
262 m_channel, west, south, Math.Pow(size, 2.0), seconds); 342 m_channel, west, south, Math.Pow(size, 2.0), seconds);
263 343
264 bool usingTerrainModule = false; 344 bool usingTerrainModule = true;
265 345
266 if (usingTerrainModule) 346 if (usingTerrainModule)
267 { 347 {
268 remoteClient.SendLayerData(m_channel.GetFloatsSerialised()); 348 SendUpdatedLayerData();
269 } 349 }
270 } 350 }
271 else 351 else
@@ -298,11 +378,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain
298 378
299 m_floodeffects[(StandardTerrainEffects)action].FloodEffect( 379 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(
300 m_channel, fillArea, Math.Pow(size, 2.0)); 380 m_channel, fillArea, Math.Pow(size, 2.0));
301 bool usingTerrainModule = false; 381 bool usingTerrainModule = true;
302 382
303 if (usingTerrainModule) 383 if (usingTerrainModule)
304 { 384 {
305 remoteClient.SendLayerData(m_channel.GetFloatsSerialised()); 385 SendUpdatedLayerData();
306 } 386 }
307 } 387 }
308 else 388 else
diff --git a/OpenSim/Region/Environment/Modules/TreePopulatorModule.cs b/OpenSim/Region/Environment/Modules/TreePopulatorModule.cs
index edd4286..8aa2223 100644
--- a/OpenSim/Region/Environment/Modules/TreePopulatorModule.cs
+++ b/OpenSim/Region/Environment/Modules/TreePopulatorModule.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules
205 205
206 private void CreateTree(LLVector3 position) 206 private void CreateTree(LLVector3 position)
207 { 207 {
208 position.Z = (float)m_scene.Terrain.heightmap.Get((int)position.X, (int)position.Y); 208 position.Z = (float)m_scene.Heightmap[(int)position.X, (int)position.Y];
209 209
210 SceneObjectGroup tree = 210 SceneObjectGroup tree =
211 m_scene.AddTree(new LLVector3(0.1f, 0.1f, 0.1f), 211 m_scene.AddTree(new LLVector3(0.1f, 0.1f, 0.1f),
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 20154ea..b269e75 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -37,29 +37,6 @@ namespace OpenSim.Region.Environment.Scenes
37 public partial class Scene 37 public partial class Scene
38 { 38 {
39 /// <summary> 39 /// <summary>
40 /// Modifies terrain using the specified information
41 /// </summary>
42 /// <param name="height">The height at which the user started modifying the terrain</param>
43 /// <param name="seconds">The number of seconds the modify button was pressed</param>
44 /// <param name="brushsize">The size of the brush used</param>
45 /// <param name="action">The action to be performed</param>
46 /// <param name="north">Distance from the north border where the cursor is located</param>
47 /// <param name="west">Distance from the west border where the cursor is located</param>
48 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
49 float south, float east,
50 IClientAPI remoteUser)
51 {
52 // Do a permissions check before allowing terraforming.
53 // random users are now no longer allowed to terraform
54 // if permissions are enabled.
55 if (!PermissionsMngr.CanTerraform(remoteUser.AgentId, new LLVector3(north, west, 0)))
56 return;
57
58 //if it wasn't for the permission checking we could have the terrain module directly subscribe to the OnModifyTerrain event
59 Terrain.ModifyTerrain(height, seconds, brushsize, action, north, west, south, east, remoteUser);
60 }
61
62 /// <summary>
63 /// 40 ///
64 /// </summary> 41 /// </summary>
65 /// <param name="message"></param> 42 /// <param name="message"></param>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 29f1af4..ec1563a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -283,9 +283,6 @@ namespace OpenSim.Region.Environment.Scenes
283 //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 283 //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
284 m_restorePresences = new Dictionary<LLUUID, ScenePresence>(); 284 m_restorePresences = new Dictionary<LLUUID, ScenePresence>();
285 285
286 m_log.Info("[SCENE]: Creating LandMap");
287 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
288
289 m_httpListener = httpServer; 286 m_httpListener = httpServer;
290 m_dumpAssetsToFile = dumpAssetsToFile; 287 m_dumpAssetsToFile = dumpAssetsToFile;
291 288
@@ -843,43 +840,7 @@ namespace OpenSim.Region.Environment.Scenes
843 840
844 private void UpdateTerrain() 841 private void UpdateTerrain()
845 { 842 {
846 if (Terrain.IsTainted() && !Terrain.IsUserStillEditing()) 843 EventManager.TriggerTerrainTick();
847 {
848 CreateTerrainTexture(true);
849
850 lock (Terrain.heightmap)
851 {
852 lock (SyncRoot)
853 {
854 PhysicsScene.SetTerrain(Terrain.GetHeights1D());
855 }
856
857 m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
858
859 SendTerrainUpdate(true);
860
861 Terrain.ResetTaint();
862 }
863 }
864 }
865
866 public void SendTerrainUpdate(bool checkForTainted)
867 {
868 float[] terData = Heightmap.GetFloatsSerialised();
869
870 Broadcast(delegate(IClientAPI client)
871 {
872 for (int x = 0; x < 16; x++)
873 {
874 for (int y = 0; y < 16; y++)
875 {
876 if ((!checkForTainted) || (Terrain.IsTainted(x * 16, y * 16)))
877 {
878 client.SendLayerData(x, y, terData);
879 }
880 }
881 }
882 });
883 } 844 }
884 845
885 private void UpdateStorageBackup() 846 private void UpdateStorageBackup()
@@ -963,14 +924,9 @@ namespace OpenSim.Region.Environment.Scenes
963 mapTexture.Save(fileName, ImageFormat.Jpeg); 924 mapTexture.Save(fileName, ImageFormat.Jpeg);
964 } 925 }
965 926
966 /// <summary> 927 public void SaveTerrain()
967 /// Loads a world map from a specified R32 file
968 /// </summary>
969 /// <param name="filename">A working R32 file</param>
970 public void LoadWorldMap(string filename)
971 { 928 {
972 Terrain.LoadFromFileF32(filename); 929 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
973 Terrain.SaveRevertMap();
974 } 930 }
975 931
976 /// <summary> 932 /// <summary>
@@ -984,37 +940,15 @@ namespace OpenSim.Region.Environment.Scenes
984 double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); 940 double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID);
985 if (map == null) 941 if (map == null)
986 { 942 {
987 if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile)) 943 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
988 { 944 Heightmap = new Modules.Terrain.TerrainChannel();
989 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
990 Terrain.SetDefaultTerrain();
991 945
992 m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); 946 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
993 }
994 else
995 {
996 try
997 {
998 Terrain.LoadFromFileF32(m_regInfo.EstateSettings.terrainFile);
999 Terrain *= m_regInfo.EstateSettings.terrainMultiplier;
1000 }
1001 catch
1002 {
1003 m_log.Info("[TERRAIN]: No terrain found in database or default. Generating a new terrain.");
1004 Terrain.SetDefaultTerrain();
1005 }
1006 m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
1007 }
1008 } 947 }
1009 else 948 else
1010 { 949 {
1011 // TODO: Install 'GetDefaultTerrainProvider' method here?
1012 Heightmap = new Modules.Terrain.TerrainChannel(map); 950 Heightmap = new Modules.Terrain.TerrainChannel(map);
1013 Terrain.SetHeights2D(map);
1014 } 951 }
1015
1016 CreateTerrainTexture(true);
1017 //CommsManager.GridService.RegisterRegion(RegionInfo); //hack to update the terrain texture in grid mode so it shows on world map
1018 } 952 }
1019 catch (Exception e) 953 catch (Exception e)
1020 { 954 {
@@ -1049,6 +983,8 @@ namespace OpenSim.Region.Environment.Scenes
1049 /// </summary> 983 /// </summary>
1050 public void CreateTerrainTexture(bool temporary) 984 public void CreateTerrainTexture(bool temporary)
1051 { 985 {
986 //TODOADAM: Move this to TerrainModule
987 /*
1052 //create a texture asset of the terrain 988 //create a texture asset of the terrain
1053 byte[] data = Terrain.WriteJpegImage("defaultstripe.png"); 989 byte[] data = Terrain.WriteJpegImage("defaultstripe.png");
1054 m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); 990 m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
@@ -1060,6 +996,7 @@ namespace OpenSim.Region.Environment.Scenes
1060 asset.Type = 0; 996 asset.Type = 0;
1061 asset.Temporary = temporary; 997 asset.Temporary = temporary;
1062 AssetCache.AddAsset(asset); 998 AssetCache.AddAsset(asset);
999 */
1063 } 1000 }
1064 1001
1065 #endregion 1002 #endregion
@@ -1382,7 +1319,6 @@ namespace OpenSim.Region.Environment.Scenes
1382 { 1319 {
1383 client.OnRegionHandShakeReply += SendLayerData; 1320 client.OnRegionHandShakeReply += SendLayerData;
1384 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 1321 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
1385 client.OnModifyTerrain += ModifyTerrain;
1386 // client.OnRequestWearables += InformClientOfNeighbours; 1322 // client.OnRequestWearables += InformClientOfNeighbours;
1387 client.OnAddPrim += AddNewPrim; 1323 client.OnAddPrim += AddNewPrim;
1388 client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition; 1324 client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition;
@@ -2443,7 +2379,7 @@ namespace OpenSim.Region.Environment.Scenes
2443 2379
2444 public double GetLandHeight(int x, int y) 2380 public double GetLandHeight(int x, int y)
2445 { 2381 {
2446 return Terrain.GetHeight(x, y); 2382 return Heightmap[x, y];
2447 } 2383 }
2448 2384
2449 public LLUUID GetLandOwner(float x, float y) 2385 public LLUUID GetLandOwner(float x, float y)
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 2a2dea1..12635c8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Scenes
58 protected string m_regionName; 58 protected string m_regionName;
59 protected RegionInfo m_regInfo; 59 protected RegionInfo m_regInfo;
60 60
61 public TerrainEngine Terrain; 61 //public TerrainEngine Terrain;
62 public ITerrainChannel Heightmap; 62 public ITerrainChannel Heightmap;
63 63
64 protected EventManager m_eventManager; 64 protected EventManager m_eventManager;
@@ -112,16 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
112 /// <param name="RemoteClient">Client to send to</param> 112 /// <param name="RemoteClient">Client to send to</param>
113 public virtual void SendLayerData(IClientAPI RemoteClient) 113 public virtual void SendLayerData(IClientAPI RemoteClient)
114 { 114 {
115 bool usingTerrainModule = false; 115 RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised());
116
117 if (usingTerrainModule)
118 {
119 RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised());
120 }
121 else
122 {
123 RemoteClient.SendLayerData(Terrain.GetHeights1D());
124 }
125 } 116 }
126 117
127 #endregion 118 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index ac8f91e..5f8c977 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -48,6 +48,10 @@ namespace OpenSim.Region.Environment.Scenes
48 48
49 public event ClientMovement OnClientMovement; 49 public event ClientMovement OnClientMovement;
50 50
51 public delegate void OnTerrainTickDelegate();
52
53 public event OnTerrainTickDelegate OnTerrainTick;
54
51 public delegate void OnBackupDelegate(IRegionDataStore datastore); 55 public delegate void OnBackupDelegate(IRegionDataStore datastore);
52 56
53 public event OnBackupDelegate OnBackup; 57 public event OnBackupDelegate OnBackup;
@@ -189,6 +193,7 @@ namespace OpenSim.Region.Environment.Scenes
189 private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule; 193 private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule;
190 private ClientClosed handlerClientClosed = null; //OnClientClosed; 194 private ClientClosed handlerClientClosed = null; //OnClientClosed;
191 private OnNewPresenceDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; 195 private OnNewPresenceDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
196 private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
192 197
193 public void TriggerOnScriptChangedEvent(uint localID, uint change) 198 public void TriggerOnScriptChangedEvent(uint localID, uint change)
194 { 199 {
@@ -277,6 +282,14 @@ namespace OpenSim.Region.Environment.Scenes
277 } 282 }
278 } 283 }
279 284
285 public void TriggerTerrainTick()
286 {
287 handlerTerrainTick = OnTerrainTick;
288 if (handlerTerrainTick != null)
289 {
290 handlerTerrainTick();
291 }
292 }
280 293
281 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) 294 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
282 { 295 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 24f71af..3ad9342 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -178,29 +178,8 @@ namespace OpenSim.Region.Environment.Scenes
178 178
179 public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) 179 public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
180 { 180 {
181 if (m_currentScene == null) 181 m_log.Warn("Terrain commands have been depreciated.");
182 { 182 return false;
183 bool success = true;
184 foreach (Scene scene in m_localScenes)
185 {
186 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
187 {
188 success = false;
189 }
190
191 // Messy way of preventing us printing out the same help text for each scene
192 if (cmdparams.Length <= 0 || cmdparams[0] == "help")
193 {
194 break;
195 }
196 }
197
198 return success;
199 }
200 else
201 {
202 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
203 }
204 } 183 }
205 184
206 public void SendCommandToCurrentSceneScripts(string[] cmdparams) 185 public void SendCommandToCurrentSceneScripts(string[] cmdparams)