From 510e809abae3c126d68ffe2b0645b4697f5b56b2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 4 Jul 2012 00:53:16 +0100 Subject: porting console commands from raw2sculpt 3.2 --- .../CoreModules/World/Terrain/TerrainModule.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2eac0fa..3f848ed 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -1108,6 +1108,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain CheckForTerrainUpdates(); } + private void InterfaceMinTerrain(Object[] args) + { + int x, y; + for (x = 0; x < m_channel.Width; x++) + { + for (y = 0; y < m_channel.Height; y++) + { + m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]); + } + } + CheckForTerrainUpdates(); + } + + private void InterfaceMaxTerrain(Object[] args) + { + int x, y; + for (x = 0; x < m_channel.Width; x++) + { + for (y = 0; y < m_channel.Height; y++) + { + m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]); + } + } + CheckForTerrainUpdates(); + } + private void InterfaceShowDebugStats(Object[] args) { double max = Double.MinValue; @@ -1248,6 +1274,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain rescaleCommand.AddArgument("min", "min terrain height after rescaling", "Double"); rescaleCommand.AddArgument("max", "max terrain height after rescaling", "Double"); + Command minCommand = new Command("min", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMinTerrain, "Sets the minimum terrain height to the specified value."); + minCommand.AddArgument("min", "terrain height to use as minimum", "Double"); + + Command maxCommand = new Command("max", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMaxTerrain, "Sets the maximum terrain height to the specified value."); + maxCommand.AddArgument("min", "terrain height to use as maximum", "Double"); + // Debug Command showDebugStatsCommand = @@ -1279,6 +1311,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_commander.RegisterCommand("effect", pluginRunCommand); m_commander.RegisterCommand("flip", flipCommand); m_commander.RegisterCommand("rescale", rescaleCommand); + m_commander.RegisterCommand("min", minCommand); + m_commander.RegisterCommand("max", maxCommand); // Add this to our scene so scripts can call these functions m_scene.RegisterModuleCommander(m_commander); -- cgit v1.1