aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs97
1 files changed, 25 insertions, 72 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index 3b8debb..ed4075c 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes;
40using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes; 40using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes;
41using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
42 42
43
44namespace OpenSim.Region.Environment.Modules.World.Terrain 43namespace OpenSim.Region.Environment.Modules.World.Terrain
45{ 44{
46 public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule 45 public class TerrainModule : IRegionModule, ICommandableModule, ITerrainModule
@@ -260,18 +259,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
260 } 259 }
261 260
262 /// <summary> 261 /// <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>
275 /// Saves the current heightmap to a specified stream. 262 /// Saves the current heightmap to a specified stream.
276 /// </summary> 263 /// </summary>
277 /// <param name="filename">The destination filename. Used here only to identify the image type</param> 264 /// <param name="filename">The destination filename. Used here only to identify the image type</param>
@@ -600,92 +587,58 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
600 ); 587 );
601 } 588 }
602 589
603 private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, 590 private void client_OnModifyTerrain(float height, float seconds, byte size, byte action, float north, float west,
604 float north, float west, float south, float east, UUID agentId) 591 float south, float east, IClientAPI remoteClient)
605 { 592 {
606 bool allowed = false; 593 // Not a good permissions check, if in area mode, need to check the entire area.
607 if (north == south && east == west) 594 if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new Vector3(north, west, 0)))
608 { 595 {
609 if (m_painteffects.ContainsKey((StandardTerrainEffects) action)) 596 if (north == south && east == west)
610 { 597 {
611 bool[,] allowMask = new bool[m_channel.Width,m_channel.Height]; 598 if (m_painteffects.ContainsKey((StandardTerrainEffects) action))
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)
639 { 599 {
640 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 600 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
641 m_channel, allowMask, west, south, height, size, seconds); 601 m_channel, west, south, size, seconds);
642 602
643 CheckForTerrainUpdates(true); //revert changes outside estate limits 603 CheckForTerrainUpdates(true); //revert changes outside estate limits
644 } 604 }
605 else
606 {
607 m_log.Debug("Unknown terrain brush type " + action);
608 }
645 } 609 }
646 else 610 else
647 { 611 {
648 m_log.Debug("Unknown terrain brush type " + action); 612 if (m_floodeffects.ContainsKey((StandardTerrainEffects) action))
649 }
650 }
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();
657
658 int x;
659 for (x = 0; x < m_channel.Width; x++)
660 { 613 {
661 int y; 614 bool[,] fillArea = new bool[m_channel.Width,m_channel.Height];
662 for (y = 0; y < m_channel.Height; y++) 615 fillArea.Initialize();
616
617 int x;
618 for (x = 0; x < m_channel.Width; x++)
663 { 619 {
664 if (x < east && x > west) 620 int y;
621 for (y = 0; y < m_channel.Height; y++)
665 { 622 {
666 if (y < north && y > south) 623 if (x < east && x > west)
667 { 624 {
668 if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(agentId, new Vector3(x,y,0))) 625 if (y < north && y > south)
669 { 626 {
670 fillArea[x, y] = true; 627 fillArea[x, y] = true;
671 allowed = true;
672 } 628 }
673 } 629 }
674 } 630 }
675 } 631 }
676 }
677 632
678 if (allowed)
679 {
680 m_floodeffects[(StandardTerrainEffects) action].FloodEffect( 633 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(
681 m_channel, fillArea, size); 634 m_channel, fillArea, size);
682 635
683 CheckForTerrainUpdates(true); //revert changes outside estate limits 636 CheckForTerrainUpdates(true); //revert changes outside estate limits
684 } 637 }
685 } 638 else
686 else 639 {
687 { 640 m_log.Debug("Unknown terrain flood type " + action);
688 m_log.Debug("Unknown terrain flood type " + action); 641 }
689 } 642 }
690 } 643 }
691 } 644 }