diff options
author | Justin Clarke Casey | 2008-12-09 17:00:42 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-09 17:00:42 +0000 |
commit | 7c3bfdd8c902375981892ff364b34e68c5344f91 (patch) | |
tree | c184e4b19ba2c9d7f4c40574f1de78bd1ee5c357 /OpenSim/Region/Environment/Modules/World | |
parent | * Fixes a few instances of llSetStatus with Axis lock gone wrong. (diff) | |
download | opensim-SC_OLD-7c3bfdd8c902375981892ff364b34e68c5344f91.zip opensim-SC_OLD-7c3bfdd8c902375981892ff364b34e68c5344f91.tar.gz opensim-SC_OLD-7c3bfdd8c902375981892ff364b34e68c5344f91.tar.bz2 opensim-SC_OLD-7c3bfdd8c902375981892ff364b34e68c5344f91.tar.xz |
* Apply terrain flip patch from http://opensimulator.org/mantis/view.php?id=2315
* This allows terrain to be flipped on the x or y axis with the command "terrain flip x" (or y)
* See terrain help from the command prompt
* This is in anticipation of change the way around in which terrain raw files are imported to match that of Second Life (to reduce user confusion and improve useability)
* Thanks jonc!
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 5646de1..c1d6ab2 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | |||
@@ -753,6 +753,47 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
753 | CheckForTerrainUpdates(); | 753 | CheckForTerrainUpdates(); |
754 | } | 754 | } |
755 | 755 | ||
756 | private void InterfaceFlipTerrain(Object[] args) | ||
757 | { | ||
758 | String direction = (String)args[0]; | ||
759 | |||
760 | if( direction.ToLower().StartsWith("y")) | ||
761 | { | ||
762 | for (int x = 0; x < Constants.RegionSize; x++) | ||
763 | { | ||
764 | for (int y = 0; y < Constants.RegionSize / 2; y++) | ||
765 | { | ||
766 | double height = m_channel[x, y]; | ||
767 | double flippedHeight = m_channel[x, (int)Constants.RegionSize - 1 - y]; | ||
768 | m_channel[x, y] = flippedHeight; | ||
769 | m_channel[x, (int)Constants.RegionSize - 1 - y] = height; | ||
770 | |||
771 | } | ||
772 | } | ||
773 | } | ||
774 | else if (direction.ToLower().StartsWith("x")) | ||
775 | { | ||
776 | for (int y = 0; y < Constants.RegionSize; y++) | ||
777 | { | ||
778 | for (int x = 0; x < Constants.RegionSize / 2; x++) | ||
779 | { | ||
780 | double height = m_channel[x, y]; | ||
781 | double flippedHeight = m_channel[(int)Constants.RegionSize - 1 - x, y]; | ||
782 | m_channel[x, y] = flippedHeight; | ||
783 | m_channel[(int)Constants.RegionSize - 1 - x, y] = height; | ||
784 | |||
785 | } | ||
786 | } | ||
787 | } | ||
788 | else | ||
789 | { | ||
790 | m_log.Error("Unrecognised direction - need x or y"); | ||
791 | } | ||
792 | |||
793 | |||
794 | CheckForTerrainUpdates(); | ||
795 | } | ||
796 | |||
756 | private void InterfaceElevateTerrain(Object[] args) | 797 | private void InterfaceElevateTerrain(Object[] args) |
757 | { | 798 | { |
758 | int x, y; | 799 | int x, y; |
@@ -911,6 +952,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
911 | Command revertRegionCommand = | 952 | Command revertRegionCommand = |
912 | new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the revert map terrain into the regions heightmap."); | 953 | new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the revert map terrain into the regions heightmap."); |
913 | 954 | ||
955 | Command flipCommand = | ||
956 | new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis"); | ||
957 | flipCommand.AddArgument("direction", "[x|y] the direction to flip the terrain in", "String"); | ||
958 | |||
914 | // Debug | 959 | // Debug |
915 | Command showDebugStatsCommand = | 960 | Command showDebugStatsCommand = |
916 | new Command("stats", CommandIntentions.COMMAND_STATISTICAL, InterfaceShowDebugStats, | 961 | new Command("stats", CommandIntentions.COMMAND_STATISTICAL, InterfaceShowDebugStats, |
@@ -938,6 +983,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
938 | m_commander.RegisterCommand("newbrushes", experimentalBrushesCommand); | 983 | m_commander.RegisterCommand("newbrushes", experimentalBrushesCommand); |
939 | m_commander.RegisterCommand("stats", showDebugStatsCommand); | 984 | m_commander.RegisterCommand("stats", showDebugStatsCommand); |
940 | m_commander.RegisterCommand("effect", pluginRunCommand); | 985 | m_commander.RegisterCommand("effect", pluginRunCommand); |
986 | m_commander.RegisterCommand("flip", flipCommand); | ||
941 | 987 | ||
942 | // Add this to our scene so scripts can call these functions | 988 | // Add this to our scene so scripts can call these functions |
943 | m_scene.RegisterModuleCommander("Terrain", m_commander); | 989 | m_scene.RegisterModuleCommander("Terrain", m_commander); |