* 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.

zircon^2
Adam Frisby 2007-05-27 06:36:33 +00:00
parent 0ede8140e7
commit 7a2abbb848
3 changed files with 61 additions and 3 deletions

View File

@ -176,6 +176,24 @@ namespace OpenSim
this.IPListenAddr = attri; 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) if (!isSandbox)
{ {
//shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object

View File

@ -23,6 +23,29 @@ namespace OpenSim
public int IPListenPort; public int IPListenPort;
public string IPListenAddr; 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() public RegionInfoBase()
{ {

View File

@ -417,10 +417,27 @@ namespace OpenSim.world
float[] map = this.localStorage.LoadWorld(); float[] map = this.localStorage.LoadWorld();
if (map == null) if (map == null)
{ {
Console.WriteLine("creating new terrain"); if (string.IsNullOrEmpty(this.m_regInfo.TerrainFile))
this.Terrain.hills(); {
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 else
{ {