From 8e3b2392d129d727bfd00a2d9faa08d9e5be92de Mon Sep 17 00:00:00 2001
From: MW
Date: Tue, 28 Aug 2007 14:21:17 +0000
Subject: Start of trying to make Region/Scene more modular. Added preliminary
IRegionModule interface. Also have a work in progress way of Modules
registering optional API methods (kind of like Apache optional functions).
But there must be a cleaner/nicer way in c# of doing these than the current
way. Added three work in progress modules: ChatModule (simple handles in
world chat, but by moving this to a module, we could support other types of
chat modules, ie like a irc - opensim bridge module. ) , AvatarProfilesModule
and XferModule. Moved most of the code from Scene.ModifyTerrain() into the
BasicTerrain library, as the start of trying to make that more modular.
Stopped Child agents showing up as part of the "show users" command.
---
.../Region/Terrain.BasicTerrain/TerrainEngine.cs | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
(limited to 'OpenSim/Region/Terrain.BasicTerrain')
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index af92fe7..d5cfb69 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -32,6 +32,7 @@ using System.Drawing.Imaging;
using System.IO;
using libTerrain;
using OpenJPEGNet;
+using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Terrain
{
@@ -128,6 +129,76 @@ namespace OpenSim.Region.Terrain
heightmap.diff = new int[w / 16, h / 16];
}
+ //Testing to see if moving the TerraForming packet handling code into here works well
+ ///
+ /// Modifies terrain using the specified information
+ ///
+ /// The height at which the user started modifying the terrain
+ /// The number of seconds the modify button was pressed
+ /// The size of the brush used
+ /// The action to be performed
+ /// Distance from the north border where the cursor is located
+ /// Distance from the west border where the cursor is located
+ public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser)
+ {
+
+ // Shiny.
+ double size = (double)(1 << brushsize);
+
+ switch (action)
+ {
+ case 0:
+ // flatten terrain
+ this.FlattenTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+ case 1:
+ // raise terrain
+ this.RaiseTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+ case 2:
+ //lower terrain
+ this.LowerTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+ case 3:
+ // smooth terrain
+ this.SmoothTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+ case 4:
+ // noise
+ this.NoiseTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+ case 5:
+ // revert
+ this.RevertTerrain(west, north, size, (double)seconds / 5.0);
+ break;
+
+ // CLIENT EXTENSIONS GO HERE
+ case 128:
+ // erode-thermal
+ break;
+ case 129:
+ // erode-aerobic
+ break;
+ case 130:
+ // erode-hydraulic
+ break;
+ }
+
+ for (int x = 0; x < 16; x++)
+ {
+ for (int y = 0; y < 16; y++)
+ {
+ if (this.Tainted(x * 16, y * 16))
+ {
+ remoteUser.SendLayerData(x, y, this.GetHeights1D());
+ }
+ }
+ }
+
+ return;
+ }
+
+
///
/// Checks to make sure the terrain is within baked values +/- maxRaise/minLower
///
--
cgit v1.1