diff options
author | Charles Krinke | 2008-10-06 00:46:27 +0000 |
---|---|---|
committer | Charles Krinke | 2008-10-06 00:46:27 +0000 |
commit | 4f6cdc08d65cbdd60591d08d71c1c7648a3032cd (patch) | |
tree | c124af14da43a3b6f15d8a96d8ed151cbfca05b5 /OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | |
parent | Patch by Fly-Man, with modifications. Add more fields to DataSnapshot. (diff) | |
download | opensim-SC_OLD-4f6cdc08d65cbdd60591d08d71c1c7648a3032cd.zip opensim-SC_OLD-4f6cdc08d65cbdd60591d08d71c1c7648a3032cd.tar.gz opensim-SC_OLD-4f6cdc08d65cbdd60591d08d71c1c7648a3032cd.tar.bz2 opensim-SC_OLD-4f6cdc08d65cbdd60591d08d71c1c7648a3032cd.tar.xz |
Mantis#1207. Thank you, TGlion for a patch that addresses:
Implementation of llModifyLand() and There is a bug on
permission-check of land-terraforming: x an y-coordinates
are interchanged on function-call ExternalChecksCanTerraformLand.
Correct: x is west, and y is north. 2) Missing check of
"Other allow to terraform-flag" (Parcel.ParcelFlags.AllowTerraform)
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | 97 |
1 files changed, 72 insertions, 25 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index ed4075c..3b8debb 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes; | |||
40 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; | 40 | using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; |
41 | using OpenSim.Region.Environment.Scenes; | 41 | using OpenSim.Region.Environment.Scenes; |
42 | 42 | ||
43 | |||
43 | namespace OpenSim.Region.Environment.Modules.World.Terrain | 44 | namespace OpenSim.Region.Environment.Modules.World.Terrain |
44 | { | 45 | { |
45 | public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule | 46 | public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule |
@@ -259,6 +260,18 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
259 | } | 260 | } |
260 | 261 | ||
261 | /// <summary> | 262 | /// <summary> |
263 | /// Modify Land | ||
264 | /// </summary> | ||
265 | /// <param name="pos">Land-position (X,Y,0)</param> | ||
266 | /// <param name="size">The size of the brush (0=small, 1=medium, 2=large)</param> | ||
267 | /// <param name="action">0=LAND_LEVEL, 1=LAND_RAISE, 2=LAND_LOWER, 3=LAND_SMOOTH, 4=LAND_NOISE, 5=LAND_REVERT</param> | ||
268 | /// <param name="agentId">UUID of script-owner</param> | ||
269 | public void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId) | ||
270 | { | ||
271 | client_OnModifyTerrain((float)pos.Z, (float)0.25, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); | ||
272 | } | ||
273 | |||
274 | /// <summary> | ||
262 | /// Saves the current heightmap to a specified stream. | 275 | /// Saves the current heightmap to a specified stream. |
263 | /// </summary> | 276 | /// </summary> |
264 | /// <param name="filename">The destination filename. Used here only to identify the image type</param> | 277 | /// <param name="filename">The destination filename. Used here only to identify the image type</param> |
@@ -587,58 +600,92 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
587 | ); | 600 | ); |
588 | } | 601 | } |
589 | 602 | ||
590 | private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, | 603 | private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, |
591 | float south, float east, IClientAPI remoteClient) | 604 | float north, float west, float south, float east, UUID agentId) |
592 | { | 605 | { |
593 | // Not a good permissions check, if in area mode, need to check the entire area. | 606 | bool allowed = false; |
594 | if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new Vector3(north, west, 0))) | 607 | if (north == south && east == west) |
595 | { | 608 | { |
596 | if (north == south && east == west) | 609 | if (m_painteffects.ContainsKey((StandardTerrainEffects) action)) |
597 | { | 610 | { |
598 | if (m_painteffects.ContainsKey((StandardTerrainEffects) action)) | 611 | bool[,] allowMask = new bool[m_channel.Width,m_channel.Height]; |
612 | allowMask.Initialize(); | ||
613 | int n = size + 1; | ||
614 | if (n > 2) | ||
615 | n = 4; | ||
616 | |||
617 | int zx = (int) (west + 0.5); | ||
618 | int zy = (int) (north + 0.5); | ||
619 | |||
620 | int dx; | ||
621 | for (dx=-n; dx<=n; dx++) | ||
622 | { | ||
623 | int dy; | ||
624 | for (dy=-n; dy<=n; dy++) | ||
625 | { | ||
626 | int x = zx + dx; | ||
627 | int y = zy + dy; | ||
628 | if (x>=0 && y>=0 && x<m_channel.Width && y<m_channel.Height) | ||
629 | { | ||
630 | if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0))) | ||
631 | { | ||
632 | allowMask[x, y] = true; | ||
633 | allowed = true; | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | } | ||
638 | if (allowed) | ||
599 | { | 639 | { |
600 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( | 640 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( |
601 | m_channel, west, south, size, seconds); | 641 | m_channel, allowMask, west, south, height, size, seconds); |
602 | 642 | ||
603 | CheckForTerrainUpdates(true); //revert changes outside estate limits | 643 | CheckForTerrainUpdates(true); //revert changes outside estate limits |
604 | } | 644 | } |
605 | else | ||
606 | { | ||
607 | m_log.Debug("Unknown terrain brush type " + action); | ||
608 | } | ||
609 | } | 645 | } |
610 | else | 646 | else |
611 | { | 647 | { |
612 | if (m_floodeffects.ContainsKey((StandardTerrainEffects) action)) | 648 | m_log.Debug("Unknown terrain brush type " + action); |
613 | { | 649 | } |
614 | bool[,] fillArea = new bool[m_channel.Width,m_channel.Height]; | 650 | } |
615 | fillArea.Initialize(); | 651 | else |
652 | { | ||
653 | if (m_floodeffects.ContainsKey((StandardTerrainEffects) action)) | ||
654 | { | ||
655 | bool[,] fillArea = new bool[m_channel.Width,m_channel.Height]; | ||
656 | fillArea.Initialize(); | ||
616 | 657 | ||
617 | int x; | 658 | int x; |
618 | for (x = 0; x < m_channel.Width; x++) | 659 | for (x = 0; x < m_channel.Width; x++) |
660 | { | ||
661 | int y; | ||
662 | for (y = 0; y < m_channel.Height; y++) | ||
619 | { | 663 | { |
620 | int y; | 664 | if (x < east && x > west) |
621 | for (y = 0; y < m_channel.Height; y++) | ||
622 | { | 665 | { |
623 | if (x < east && x > west) | 666 | if (y < north && y > south) |
624 | { | 667 | { |
625 | if (y < north && y > south) | 668 | if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0))) |
626 | { | 669 | { |
627 | fillArea[x, y] = true; | 670 | fillArea[x, y] = true; |
671 | allowed = true; | ||
628 | } | 672 | } |
629 | } | 673 | } |
630 | } | 674 | } |
631 | } | 675 | } |
676 | } | ||
632 | 677 | ||
678 | if (allowed) | ||
679 | { | ||
633 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( | 680 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect( |
634 | m_channel, fillArea, size); | 681 | m_channel, fillArea, size); |
635 | 682 | ||
636 | CheckForTerrainUpdates(true); //revert changes outside estate limits | 683 | CheckForTerrainUpdates(true); //revert changes outside estate limits |
637 | } | 684 | } |
638 | else | 685 | } |
639 | { | 686 | else |
640 | m_log.Debug("Unknown terrain flood type " + action); | 687 | { |
641 | } | 688 | m_log.Debug("Unknown terrain flood type " + action); |
642 | } | 689 | } |
643 | } | 690 | } |
644 | } | 691 | } |