mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Console:
* Reorganised and added default handlers to main functions * Removed "regenerate" command, use "terrain regenerate" instead. * Added new "terrain seed" command to set the random seed * Added new "terrain load" command to load a terrain from disk * Added new "terrain save" command to save a terrain to disk Terrain: * Added new export and import functions for some common formats * Added new setSeed function to allow customising the random seed
This commit is contained in:
@@ -505,20 +505,92 @@ namespace OpenSim
|
||||
case "help":
|
||||
m_console.WriteLine("show users - show info about connected users");
|
||||
m_console.WriteLine("shutdown - disconnect all clients and shutdown");
|
||||
m_console.WriteLine("regenerate - regenerate the sim's terrain");
|
||||
break;
|
||||
|
||||
case "show":
|
||||
Show(cmdparams[0]);
|
||||
break;
|
||||
|
||||
case "regenerate":
|
||||
LocalWorld.RegenerateTerrain();
|
||||
case "terrain":
|
||||
RunTerrainCmd(cmdparams);
|
||||
break;
|
||||
|
||||
case "shutdown":
|
||||
Shutdown();
|
||||
break;
|
||||
|
||||
default:
|
||||
m_console.WriteLine("Unknown command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes a terrain-specific command
|
||||
/// </summary>
|
||||
/// <remarks>TODO: Move this into BasicTerrain directly (no need to hard limit what each terrain engine can support)</remarks>
|
||||
/// <param name="args"></param>
|
||||
public void RunTerrainCmd(string[] args)
|
||||
{
|
||||
string command = args[0];
|
||||
switch (command)
|
||||
{
|
||||
case "help":
|
||||
m_console.WriteLine("terrain regenerate - rebuilds the sims terrain using a default algorithm");
|
||||
m_console.WriteLine("terrain seed <seed> - sets the random seed value to <seed>");
|
||||
m_console.WriteLine("terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64' or 'IMG'");
|
||||
m_console.WriteLine("terrain save <type> <filename> - saves a terrain to disk, type can be 'F32' or 'F64'");
|
||||
break;
|
||||
|
||||
case "seed":
|
||||
LocalWorld.Terrain.setSeed(Convert.ToInt32(args[1]));
|
||||
break;
|
||||
|
||||
case "regenerate":
|
||||
LocalWorld.Terrain.hills();
|
||||
break;
|
||||
|
||||
case "load":
|
||||
switch (args[1].ToLower())
|
||||
{
|
||||
case "f32":
|
||||
LocalWorld.Terrain.loadFromFileF32(args[2]);
|
||||
break;
|
||||
|
||||
case "f64":
|
||||
LocalWorld.Terrain.loadFromFileF64(args[2]);
|
||||
break;
|
||||
|
||||
case "img":
|
||||
m_console.WriteLine("Error - IMG mode is presently unsupported.");
|
||||
break;
|
||||
|
||||
default:
|
||||
m_console.WriteLine("Unknown image or data format");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "save":
|
||||
switch (args[1].ToLower())
|
||||
{
|
||||
case "f32":
|
||||
LocalWorld.Terrain.writeToFileF32(args[2]);
|
||||
break;
|
||||
|
||||
case "f64":
|
||||
LocalWorld.Terrain.writeToFileF64(args[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
m_console.WriteLine("Unknown image or data format");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
m_console.WriteLine("Unknown terrain command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user