diff options
author | Adam Frisby | 2007-05-27 06:36:33 +0000 |
---|---|---|
committer | Adam Frisby | 2007-05-27 06:36:33 +0000 |
commit | 7a2abbb8484c8ceba990b3f5b79a0b5291c71e46 (patch) | |
tree | 9b940ab87255cfba9062c46ead6efbae80dfa640 | |
parent | * Terrain now resends when it's been tainted. This means you should be able t... (diff) | |
download | opensim-SC-7a2abbb8484c8ceba990b3f5b79a0b5291c71e46.zip opensim-SC-7a2abbb8484c8ceba990b3f5b79a0b5291c71e46.tar.gz opensim-SC-7a2abbb8484c8ceba990b3f5b79a0b5291c71e46.tar.bz2 opensim-SC-7a2abbb8484c8ceba990b3f5b79a0b5291c71e46.tar.xz |
* Added ability to set default terrain to a file in region config. If unable to open, terrain will be procedurally generated instead. (also needs testing.). Default file must be in R32 format. Use "terrain save f32 default.r32" on the region console to make a default file you can use.
-rw-r--r-- | OpenSim/OpenSim.RegionServer/RegionInfo.cs | 18 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | 23 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/world/World.cs | 23 |
3 files changed, 61 insertions, 3 deletions
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfo.cs b/OpenSim/OpenSim.RegionServer/RegionInfo.cs index f82495a..60a5861 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -175,6 +175,24 @@ namespace OpenSim | |||
175 | { | 175 | { |
176 | this.IPListenAddr = attri; | 176 | this.IPListenAddr = attri; |
177 | } | 177 | } |
178 | |||
179 | // Terrain Default File | ||
180 | attri = ""; | ||
181 | attri = configData.GetAttribute("TerrainFile"); | ||
182 | if (attri == "") | ||
183 | { | ||
184 | this.TerrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain file default", "default.r32"); | ||
185 | configData.SetAttribute("TerrainFile", this.TerrainFile); | ||
186 | } | ||
187 | |||
188 | attri = ""; | ||
189 | attri = configData.GetAttribute("TerrainMultiplier"); | ||
190 | if (attri == "") | ||
191 | { | ||
192 | this.TerrainMultiplier = Convert.ToDouble(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain multiplier", "60.0")); | ||
193 | configData.SetAttribute("TerrainMultiplier", this.TerrainMultiplier.ToString()); | ||
194 | } | ||
195 | |||
178 | 196 | ||
179 | if (!isSandbox) | 197 | if (!isSandbox) |
180 | { | 198 | { |
diff --git a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs index 42d3030..afad245 100644 --- a/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs +++ b/OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | |||
@@ -23,6 +23,29 @@ namespace OpenSim | |||
23 | public int IPListenPort; | 23 | public int IPListenPort; |
24 | public string IPListenAddr; | 24 | public string IPListenAddr; |
25 | 25 | ||
26 | // Region Information | ||
27 | public LLUUID TerrainBase0 = new LLUUID(); // Insert default here | ||
28 | public LLUUID TerrainBase1 = new LLUUID(); | ||
29 | public LLUUID TerrainBase2 = new LLUUID(); | ||
30 | public LLUUID TerrainBase3 = new LLUUID(); | ||
31 | public LLUUID TerrainDetail0 = new LLUUID(); | ||
32 | public LLUUID TerrainDetail1 = new LLUUID(); | ||
33 | public LLUUID TerrainDetail2 = new LLUUID(); | ||
34 | public LLUUID TerrainDetail3 = new LLUUID(); | ||
35 | public float TerrainStartHeight00 = 0.0f; | ||
36 | public float TerrainStartHeight01 = 0.0f; | ||
37 | public float TerrainStartHeight10 = 0.0f; | ||
38 | public float TerrainStartHeight11 = 0.0f; | ||
39 | public float TerrainHeightRange00 = 40.0f; | ||
40 | public float TerrainHeightRange01 = 40.0f; | ||
41 | public float TerrainHeightRange10 = 40.0f; | ||
42 | public float TerrainHeightRange11 = 40.0f; | ||
43 | |||
44 | // Terrain Default (Must be in F32 Format!) | ||
45 | public string TerrainFile = "default.r32"; | ||
46 | public double TerrainMultiplier = 60.0; | ||
47 | |||
48 | |||
26 | public RegionInfoBase() | 49 | public RegionInfoBase() |
27 | { | 50 | { |
28 | 51 | ||
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs index 68516d2..ef6833c 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.cs | |||
@@ -417,10 +417,27 @@ namespace OpenSim.world | |||
417 | float[] map = this.localStorage.LoadWorld(); | 417 | float[] map = this.localStorage.LoadWorld(); |
418 | if (map == null) | 418 | if (map == null) |
419 | { | 419 | { |
420 | Console.WriteLine("creating new terrain"); | 420 | if (string.IsNullOrEmpty(this.m_regInfo.TerrainFile)) |
421 | this.Terrain.hills(); | 421 | { |
422 | Console.WriteLine("No default terrain, procedurally generating..."); | ||
423 | this.Terrain.hills(); | ||
422 | 424 | ||
423 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | 425 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); |
426 | } | ||
427 | else | ||
428 | { | ||
429 | try | ||
430 | { | ||
431 | this.Terrain.loadFromFileF32(this.m_regInfo.TerrainFile); | ||
432 | this.Terrain *= this.m_regInfo.TerrainMultiplier; | ||
433 | } | ||
434 | catch (Exception e) | ||
435 | { | ||
436 | Console.WriteLine("Unable to load default terrain (" + e.ToString() + "), procedurally generating instead..."); | ||
437 | Terrain.hills(); | ||
438 | } | ||
439 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | ||
440 | } | ||
424 | } | 441 | } |
425 | else | 442 | else |
426 | { | 443 | { |