Merged Revision 7650 from Trunk to 0.6.0-stable branch. A patch from jonc to add a "terrain flip x/y" command.

0.6.0-stable
MW 2008-12-16 13:57:48 +00:00
parent d19212c3e4
commit 8c19809ed2
2 changed files with 48 additions and 1 deletions

View File

@ -54,6 +54,7 @@ Patches
* jhurliman
* jimbo2120 (IBM)
* John R Sohn (XenReborn)
* jonc
* Junta Kohime
* Kayne
* Kevin Cozens
@ -63,6 +64,7 @@ Patches
* M.Igarashi
* Mic Bowman
* mikkopa/_someone - RealXtend
* Mircea Kitsune
* nlin
* nornalbion
* openlifegrid.com
@ -79,7 +81,6 @@ Patches
* Y. Nitta
* YZh
* Zha Ewry
* Mircea Kitsune
LSL Devs

View File

@ -752,6 +752,47 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
CheckForTerrainUpdates();
}
private void InterfaceFlipTerrain(Object[] args)
{
String direction = (String)args[0];
if( direction.ToLower().StartsWith("y"))
{
for (int x = 0; x < Constants.RegionSize; x++)
{
for (int y = 0; y < Constants.RegionSize / 2; y++)
{
double height = m_channel[x, y];
double flippedHeight = m_channel[x, (int)Constants.RegionSize - 1 - y];
m_channel[x, y] = flippedHeight;
m_channel[x, (int)Constants.RegionSize - 1 - y] = height;
}
}
}
else if (direction.ToLower().StartsWith("x"))
{
for (int y = 0; y < Constants.RegionSize; y++)
{
for (int x = 0; x < Constants.RegionSize / 2; x++)
{
double height = m_channel[x, y];
double flippedHeight = m_channel[(int)Constants.RegionSize - 1 - x, y];
m_channel[x, y] = flippedHeight;
m_channel[(int)Constants.RegionSize - 1 - x, y] = height;
}
}
}
else
{
m_log.Error("Unrecognised direction - need x or y");
}
CheckForTerrainUpdates();
}
private void InterfaceElevateTerrain(Object[] args)
{
int x, y;
@ -910,6 +951,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
Command revertRegionCommand =
new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the revert map terrain into the regions heightmap.");
Command flipCommand =
new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis");
flipCommand.AddArgument("direction", "[x|y] the direction to flip the terrain in", "String");
// Debug
Command showDebugStatsCommand =
new Command("stats", CommandIntentions.COMMAND_STATISTICAL, InterfaceShowDebugStats,
@ -937,6 +982,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
m_commander.RegisterCommand("newbrushes", experimentalBrushesCommand);
m_commander.RegisterCommand("stats", showDebugStatsCommand);
m_commander.RegisterCommand("effect", pluginRunCommand);
m_commander.RegisterCommand("flip", flipCommand);
// Add this to our scene so scripts can call these functions
m_scene.RegisterModuleCommander("Terrain", m_commander);