diff options
author | MW | 2007-04-01 10:19:21 +0000 |
---|---|---|
committer | MW | 2007-04-01 10:19:21 +0000 |
commit | def7335b6c0b88ee2b7b15194ec7fae30bd476da (patch) | |
tree | 50a86e6ece21bde1577cb5c8983941e64ee07d0e /OpenSim.RegionServer/world/World.cs | |
parent | Added Packet handlers to SimClient (diff) | |
download | opensim-SC-def7335b6c0b88ee2b7b15194ec7fae30bd476da.zip opensim-SC-def7335b6c0b88ee2b7b15194ec7fae30bd476da.tar.gz opensim-SC-def7335b6c0b88ee2b7b15194ec7fae30bd476da.tar.bz2 opensim-SC-def7335b6c0b88ee2b7b15194ec7fae30bd476da.tar.xz |
More work on adding Packets handlers and tested the first handler.
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 45 |
1 files changed, 45 insertions, 0 deletions
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 | |||
426 | return true; | 426 | return true; |
427 | } | 427 | } |
428 | 428 | ||
429 | #region Packet Handlers | ||
430 | public bool ModifyTerrain(SimClient simClient, Packet packet) | ||
431 | { | ||
432 | ModifyLandPacket modify = (ModifyLandPacket)packet; | ||
433 | |||
434 | switch (modify.ModifyBlock.Action) | ||
435 | { | ||
436 | case 1: | ||
437 | // raise terrain | ||
438 | if (modify.ParcelData.Length > 0) | ||
439 | { | ||
440 | int mody = (int)modify.ParcelData[0].North; | ||
441 | int modx = (int)modify.ParcelData[0].West; | ||
442 | lock (LandMap) | ||
443 | { | ||
444 | LandMap[(mody * 256) + modx - 1] += 0.05f; | ||
445 | LandMap[(mody * 256) + modx] += 0.1f; | ||
446 | LandMap[(mody * 256) + modx + 1] += 0.05f; | ||
447 | LandMap[((mody + 1) * 256) + modx] += 0.05f; | ||
448 | LandMap[((mody - 1) * 256) + modx] += 0.05f; | ||
449 | } | ||
450 | RegenerateTerrain(true, modx, mody); | ||
451 | } | ||
452 | break; | ||
453 | case 2: | ||
454 | //lower terrain | ||
455 | if (modify.ParcelData.Length > 0) | ||
456 | { | ||
457 | int mody = (int)modify.ParcelData[0].North; | ||
458 | int modx = (int)modify.ParcelData[0].West; | ||
459 | lock (LandMap) | ||
460 | { | ||
461 | LandMap[(mody * 256) + modx - 1] -= 0.05f; | ||
462 | LandMap[(mody * 256) + modx] -= 0.1f; | ||
463 | LandMap[(mody * 256) + modx + 1] -= 0.05f; | ||
464 | LandMap[((mody + 1) * 256) + modx] -= 0.05f; | ||
465 | LandMap[((mody - 1) * 256) + modx] -= 0.05f; | ||
466 | } | ||
467 | RegenerateTerrain(true, modx, mody); | ||
468 | } | ||
469 | break; | ||
470 | } | ||
471 | return true; | ||
472 | } | ||
473 | #endregion | ||
429 | } | 474 | } |
430 | } | 475 | } |