From def7335b6c0b88ee2b7b15194ec7fae30bd476da Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Apr 2007 10:19:21 +0000 Subject: More work on adding Packets handlers and tested the first handler. --- OpenSim.RegionServer/world/World.cs | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'OpenSim.RegionServer/world') diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 82e8b8d..66247a2 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -426,5 +426,50 @@ namespace OpenSim.world return true; } + #region Packet Handlers + public bool ModifyTerrain(SimClient simClient, Packet packet) + { + ModifyLandPacket modify = (ModifyLandPacket)packet; + + switch (modify.ModifyBlock.Action) + { + case 1: + // raise terrain + if (modify.ParcelData.Length > 0) + { + int mody = (int)modify.ParcelData[0].North; + int modx = (int)modify.ParcelData[0].West; + lock (LandMap) + { + LandMap[(mody * 256) + modx - 1] += 0.05f; + LandMap[(mody * 256) + modx] += 0.1f; + LandMap[(mody * 256) + modx + 1] += 0.05f; + LandMap[((mody + 1) * 256) + modx] += 0.05f; + LandMap[((mody - 1) * 256) + modx] += 0.05f; + } + RegenerateTerrain(true, modx, mody); + } + break; + case 2: + //lower terrain + if (modify.ParcelData.Length > 0) + { + int mody = (int)modify.ParcelData[0].North; + int modx = (int)modify.ParcelData[0].West; + lock (LandMap) + { + LandMap[(mody * 256) + modx - 1] -= 0.05f; + LandMap[(mody * 256) + modx] -= 0.1f; + LandMap[(mody * 256) + modx + 1] -= 0.05f; + LandMap[((mody + 1) * 256) + modx] -= 0.05f; + LandMap[((mody - 1) * 256) + modx] -= 0.05f; + } + RegenerateTerrain(true, modx, mody); + } + break; + } + return true; + } + #endregion } } -- cgit v1.1