From 7a2abbb8484c8ceba990b3f5b79a0b5291c71e46 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 27 May 2007 06:36:33 +0000 Subject: * 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. --- OpenSim/OpenSim.RegionServer/RegionInfo.cs | 18 ++++++++++++++++++ OpenSim/OpenSim.RegionServer/RegionInfoBase.cs | 23 +++++++++++++++++++++++ OpenSim/OpenSim.RegionServer/world/World.cs | 23 ++++++++++++++++++++--- 3 files changed, 61 insertions(+), 3 deletions(-) (limited to 'OpenSim/OpenSim.RegionServer') 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 { this.IPListenAddr = attri; } + + // Terrain Default File + attri = ""; + attri = configData.GetAttribute("TerrainFile"); + if (attri == "") + { + this.TerrainFile = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain file default", "default.r32"); + configData.SetAttribute("TerrainFile", this.TerrainFile); + } + + attri = ""; + attri = configData.GetAttribute("TerrainMultiplier"); + if (attri == "") + { + this.TerrainMultiplier = Convert.ToDouble(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Terrain multiplier", "60.0")); + configData.SetAttribute("TerrainMultiplier", this.TerrainMultiplier.ToString()); + } + if (!isSandbox) { 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 public int IPListenPort; public string IPListenAddr; + // Region Information + public LLUUID TerrainBase0 = new LLUUID(); // Insert default here + public LLUUID TerrainBase1 = new LLUUID(); + public LLUUID TerrainBase2 = new LLUUID(); + public LLUUID TerrainBase3 = new LLUUID(); + public LLUUID TerrainDetail0 = new LLUUID(); + public LLUUID TerrainDetail1 = new LLUUID(); + public LLUUID TerrainDetail2 = new LLUUID(); + public LLUUID TerrainDetail3 = new LLUUID(); + public float TerrainStartHeight00 = 0.0f; + public float TerrainStartHeight01 = 0.0f; + public float TerrainStartHeight10 = 0.0f; + public float TerrainStartHeight11 = 0.0f; + public float TerrainHeightRange00 = 40.0f; + public float TerrainHeightRange01 = 40.0f; + public float TerrainHeightRange10 = 40.0f; + public float TerrainHeightRange11 = 40.0f; + + // Terrain Default (Must be in F32 Format!) + public string TerrainFile = "default.r32"; + public double TerrainMultiplier = 60.0; + + public RegionInfoBase() { 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 float[] map = this.localStorage.LoadWorld(); if (map == null) { - Console.WriteLine("creating new terrain"); - this.Terrain.hills(); + if (string.IsNullOrEmpty(this.m_regInfo.TerrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); - this.localStorage.SaveMap(this.Terrain.getHeights1D()); + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.TerrainFile); + this.Terrain *= this.m_regInfo.TerrainMultiplier; + } + catch (Exception e) + { + Console.WriteLine("Unable to load default terrain (" + e.ToString() + "), procedurally generating instead..."); + Terrain.hills(); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } } else { -- cgit v1.1