aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorCharles Krinke2008-10-06 00:58:43 +0000
committerCharles Krinke2008-10-06 00:58:43 +0000
commite575ef7ad2245aad17f57273f6bd7b774f99f057 (patch)
treea85fd727bac7f3d39259df3aaea6c93f3f32ba05 /OpenSim/Region
parentMantis#2336. Thank you kindly, Ralphos for a patch that: (diff)
downloadopensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.zip
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.gz
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.bz2
opensim-SC_OLD-e575ef7ad2245aad17f57273f6bd7b774f99f057.tar.xz
Revert r6697 patch as the build fails.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs18
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/Effects/CookieCutter.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/ITerrainPaintableEffect.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs24
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs41
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs97
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs27
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs7
18 files changed, 117 insertions, 177 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 6402974..102b9c4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4171,7 +4171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4171 modify.ModifyBlock.BrushSize, 4171 modify.ModifyBlock.BrushSize,
4172 modify.ModifyBlock.Action, modify.ParcelData[i].North, 4172 modify.ModifyBlock.Action, modify.ParcelData[i].North,
4173 modify.ParcelData[i].West, modify.ParcelData[i].South, 4173 modify.ParcelData[i].West, modify.ParcelData[i].South,
4174 modify.ParcelData[i].East, this.AgentId); 4174 modify.ParcelData[i].East, this);
4175 } 4175 }
4176 } 4176 }
4177 } 4177 }
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index abbf40e..16743ea 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -984,9 +984,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
984 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 984 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
985 if (m_bypassPermissions) return m_bypassPermissionsValue; 985 if (m_bypassPermissions) return m_bypassPermissionsValue;
986 986
987 bool permission = false;
988
987 // Estate override 989 // Estate override
988 if (GenericEstatePermission(user)) 990 if (GenericEstatePermission(user))
989 return true; 991 permission = true;
990 992
991 float X = position.X; 993 float X = position.X;
992 float Y = position.Y; 994 float Y = position.Y;
@@ -1000,19 +1002,13 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1000 if (Y < 0) 1002 if (Y < 0)
1001 Y = 0; 1003 Y = 0;
1002 1004
1003 ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
1004 if (parcel == null)
1005 return false;
1006
1007 // Others allowed to terraform?
1008 if ((parcel.landData.Flags & ((int)Parcel.ParcelFlags.AllowTerraform)) != 0)
1009 return true;
1010
1011 // Land owner can terraform too 1005 // Land owner can terraform too
1006 ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
1012 if (parcel != null && GenericParcelPermission(user, parcel)) 1007 if (parcel != null && GenericParcelPermission(user, parcel))
1013 return true; 1008 permission = true;
1014 1009
1015 return false; 1010
1011 return permission;
1016 } 1012 }
1017 1013
1018 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) 1014 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Effects/CookieCutter.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Effects/CookieCutter.cs
index c5e99b5..399287d 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/Effects/CookieCutter.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/Effects/CookieCutter.cs
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
41 bool[,] cliffMask = new bool[map.Width,map.Height]; 41 bool[,] cliffMask = new bool[map.Width,map.Height];
42 bool[,] channelMask = new bool[map.Width,map.Height]; 42 bool[,] channelMask = new bool[map.Width,map.Height];
43 bool[,] smoothMask = new bool[map.Width,map.Height]; 43 bool[,] smoothMask = new bool[map.Width,map.Height];
44 bool[,] allowMask = new bool[map.Width,map.Height];
45 44
46 Console.WriteLine("S1"); 45 Console.WriteLine("S1");
47 46
@@ -53,7 +52,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
53 { 52 {
54 Console.Write("."); 53 Console.Write(".");
55 smoothMask[x, y] = true; 54 smoothMask[x, y] = true;
56 allowMask[x,y] = true;
57 55
58 // Start underwater 56 // Start underwater
59 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 5; 57 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 5;
@@ -79,7 +77,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
79 for (y = 0; y < map.Height; y++) 77 for (y = 0; y < map.Height; y++)
80 { 78 {
81 if (cliffMask[x, y]) 79 if (cliffMask[x, y])
82 eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1); 80 eroder.PaintEffect(map, x, y, 4, 0.1);
83 } 81 }
84 } 82 }
85 83
@@ -121,4 +119,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
121 } 119 }
122 } 120 }
123 } 121 }
124} 122} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
index bc5dc72..beeff03 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
@@ -25,9 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28
29using System.IO; 28using System.IO;
30using OpenMetaverse;
31 29
32namespace OpenSim.Region.Environment.Modules.World.Terrain 30namespace OpenSim.Region.Environment.Modules.World.Terrain
33{ 31{
@@ -35,8 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
35 { 33 {
36 void LoadFromFile(string filename); 34 void LoadFromFile(string filename);
37 void SaveToFile(string filename); 35 void SaveToFile(string filename);
38 void ModifyTerrain(Vector3 pos, byte size, byte action, UUID agentId); 36
39
40 /// <summary> 37 /// <summary>
41 /// Load a terrain from a stream. 38 /// Load a terrain from a stream.
42 /// </summary> 39 /// </summary>
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainPaintableEffect.cs b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainPaintableEffect.cs
index e2a9cde..cf2e58a 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainPaintableEffect.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainPaintableEffect.cs
@@ -31,6 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
31{ 31{
32 public interface ITerrainPaintableEffect 32 public interface ITerrainPaintableEffect
33 { 33 {
34 void PaintEffect(ITerrainChannel map, bool[,] allowMask, double x, double y, double z, double strength, double duration); 34 void PaintEffect(ITerrainChannel map, double x, double y, double strength, double duration);
35 } 35 }
36} 36} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
index 3fa3f8a..dae4cf8 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
150 150
151 #region ITerrainPaintableEffect Members 151 #region ITerrainPaintableEffect Members
152 152
153 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 153 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
154 { 154 {
155 strength = TerrainUtil.MetersToSphericalStrength(strength); 155 strength = TerrainUtil.MetersToSphericalStrength(strength);
156 156
@@ -173,13 +173,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
173 { 173 {
174 for (y = 0; y < water.Height; y++) 174 for (y = 0; y < water.Height; y++)
175 { 175 {
176 if (mask[x,y]) 176 const double solConst = (1.0 / rounds);
177 { 177 double sedDelta = water[x, y] * solConst;
178 const double solConst = (1.0 / rounds); 178 map[x, y] -= sedDelta;
179 double sedDelta = water[x, y] * solConst; 179 sediment[x, y] += sedDelta;
180 map[x, y] -= sedDelta;
181 sediment[x, y] += sedDelta;
182 }
183 } 180 }
184 } 181 }
185 182
@@ -295,11 +292,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
295 double sedimentDeposit = sediment[x, y] - waterCapacity; 292 double sedimentDeposit = sediment[x, y] - waterCapacity;
296 if (sedimentDeposit > 0) 293 if (sedimentDeposit > 0)
297 { 294 {
298 if (mask[x,y]) 295 sediment[x, y] -= sedimentDeposit;
299 { 296 map[x, y] += sedimentDeposit;
300 sediment[x, y] -= sedimentDeposit;
301 map[x, y] += sedimentDeposit;
302 }
303 } 297 }
304 } 298 }
305 } 299 }
@@ -308,10 +302,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
308 // Deposit any remainder (should be minimal) 302 // Deposit any remainder (should be minimal)
309 for (x = 0; x < water.Width; x++) 303 for (x = 0; x < water.Width; x++)
310 for (y = 0; y < water.Height; y++) 304 for (y = 0; y < water.Height; y++)
311 if (mask[x,y] && sediment[x, y] > 0) 305 if (sediment[x, y] > 0)
312 map[x, y] += sediment[x, y]; 306 map[x, y] += sediment[x, y];
313 } 307 }
314 308
315 #endregion 309 #endregion
316 } 310 }
317} 311} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
index e507481..1e2d611 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
@@ -25,29 +25,48 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using OpenSim.Region.Environment.Interfaces; 28using OpenSim.Region.Environment.Interfaces;
30 29
31namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes 30namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
32{ 31{
33 public class FlattenSphere : ITerrainPaintableEffect 32 public class FlattenSphere : ITerrainPaintableEffect
34 { 33 {
34
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 37 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
38 { 38 {
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 strength = TerrainUtil.MetersToSphericalStrength(strength);
40 40
41 int x, y; 41 int x, y;
42 42
43 // blend in map 43 double sum = 0.0;
44 double step2 = 0.0;
45 duration = 0.009; //MCP Should be read from ini file
46
47
48 // compute delta map
44 for (x = 0; x < map.Width; x++) 49 for (x = 0; x < map.Width; x++)
45 { 50 {
46 for (y = 0; y < map.Height; y++) 51 for (y = 0; y < map.Height; y++)
47 { 52 {
48 if (!mask[x,y]) 53 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
49 continue; 54
55 if (z > 0) // add in non-zero amount
56 {
57 sum += map[x, y] * z;
58 step2 += z;
59 }
60 }
61 }
62
63 double avg = sum / step2;
50 64
65 // blend in map
66 for (x = 0; x < map.Width; x++)
67 {
68 for (y = 0; y < map.Height; y++)
69 {
51 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; 70 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration;
52 71
53 if (z > 0) // add in non-zero amount 72 if (z > 0) // add in non-zero amount
@@ -55,18 +74,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
55 if (z > 1.0) 74 if (z > 1.0)
56 z = 1.0; 75 z = 1.0;
57 76
58 map[x, y] = (map[x, y] * (1.0 - z)) + (rz * z); 77 map[x, y] = (map[x, y] * (1.0 - z)) + (avg * z);
59 } 78 }
60
61 double delta = rz - map[x, y];
62 if (Math.Abs(delta) > 0.1)
63 delta *= 0.25;
64
65 if (delta != 0) // add in non-zero amount
66 {
67 map[x, y] += delta;
68 }
69
70 } 79 }
71 } 80 }
72 } 81 }
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
index fe82396..08b2879 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
34 { 34 {
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 37 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
38 { 38 {
39 strength = TerrainUtil.MetersToSphericalStrength(strength); 39 strength = TerrainUtil.MetersToSphericalStrength(strength);
40 duration = 0.03; //MCP Should be read from ini file 40 duration = 0.03; //MCP Should be read from ini file
@@ -42,10 +42,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
42 int x; 42 int x;
43 for (x = 0; x < map.Width; x++) 43 for (x = 0; x < map.Width; x++)
44 { 44 {
45 // Skip everything unlikely to be affected
46 if (Math.Abs(x - rx) > strength * 1.1)
47 continue;
48
45 int y; 49 int y;
46 for (y = 0; y < map.Height; y++) 50 for (y = 0; y < map.Height; y++)
47 { 51 {
48 if (!mask[x,y]) 52 // Skip everything unlikely to be affected
53 if (Math.Abs(y - ry) > strength * 1.1)
49 continue; 54 continue;
50 55
51 // Calculate a sphere and add it to the heighmap 56 // Calculate a sphere and add it to the heighmap
@@ -61,4 +66,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
61 66
62 #endregion 67 #endregion
63 } 68 }
64} 69} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
index 23f7bc5..0824efd 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
@@ -35,17 +35,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
35 { 35 {
36 #region ITerrainPaintableEffect Members 36 #region ITerrainPaintableEffect Members
37 37
38 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 38 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
39 { 39 {
40 strength = TerrainUtil.MetersToSphericalStrength(strength); 40 strength = TerrainUtil.MetersToSphericalStrength(strength);
41 41
42 int x; 42 int x;
43 for (x = 0; x < map.Width; x++) 43 for (x = 0; x < map.Width; x++)
44 { 44 {
45 // Skip everything unlikely to be affected
46 if (Math.Abs(x - rx) > strength * 1.1)
47 continue;
48
45 int y; 49 int y;
46 for (y = 0; y < map.Height; y++) 50 for (y = 0; y < map.Height; y++)
47 { 51 {
48 if (!mask[x,y]) 52 // Skip everything unlikely to be affected
53 if (Math.Abs(y - ry) > strength * 1.1)
49 continue; 54 continue;
50 55
51 // Calculate a sphere and add it to the heighmap 56 // Calculate a sphere and add it to the heighmap
@@ -63,4 +68,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
63 68
64 #endregion 69 #endregion
65 } 70 }
66} 71} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
index 42ec794..6df8408 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
151 151
152 #region ITerrainPaintableEffect Members 152 #region ITerrainPaintableEffect Members
153 153
154 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 154 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
155 { 155 {
156 strength = TerrainUtil.MetersToSphericalStrength(strength); 156 strength = TerrainUtil.MetersToSphericalStrength(strength);
157 157
@@ -162,9 +162,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
162 int y; 162 int y;
163 for (y = 0; y < map.Height; y++) 163 for (y = 0; y < map.Height; y++)
164 { 164 {
165 if (!mask[x,y])
166 continue;
167
168 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 165 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
169 166
170 if (z > 0) // add in non-zero amount 167 if (z > 0) // add in non-zero amount
@@ -219,4 +216,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
219 216
220 #endregion 217 #endregion
221 } 218 }
222} 219} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
index 92bac63..e4fe091 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
35 #region ITerrainPaintableEffect Members 35 #region ITerrainPaintableEffect Members
36 36
37 37
38 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 38 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
39 { 39 {
40 duration = 0.03; //MCP Should be read from ini file 40 duration = 0.03; //MCP Should be read from ini file
41 strength = TerrainUtil.MetersToSphericalStrength(strength); 41 strength = TerrainUtil.MetersToSphericalStrength(strength);
@@ -43,10 +43,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
43 int x; 43 int x;
44 for (x = 0; x < map.Width; x++) 44 for (x = 0; x < map.Width; x++)
45 { 45 {
46 // Skip everything unlikely to be affected
47 if (Math.Abs(x - rx) > strength * 1.1)
48 continue;
49
46 int y; 50 int y;
47 for (y = 0; y < map.Height; y++) 51 for (y = 0; y < map.Height; y++)
48 { 52 {
49 if (!mask[x,y]) 53 // Skip everything unlikely to be affected
54 if (Math.Abs(y - ry) > strength * 1.1)
50 continue; 55 continue;
51 56
52 // Calculate a sphere and add it to the heighmap 57 // Calculate a sphere and add it to the heighmap
@@ -62,4 +67,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
62 67
63 #endregion 68 #endregion
64 } 69 }
65} 70} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
index d3a1d3d..7a1ec72 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
41 41
42 #region ITerrainPaintableEffect Members 42 #region ITerrainPaintableEffect Members
43 43
44 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 44 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
45 { 45 {
46 strength = TerrainUtil.MetersToSphericalStrength(strength); 46 strength = TerrainUtil.MetersToSphericalStrength(strength);
47 duration = 0.03; //MCP Should be read from ini file 47 duration = 0.03; //MCP Should be read from ini file
@@ -54,10 +54,15 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
54 int x; 54 int x;
55 for (x = 0; x < map.Width; x++) 55 for (x = 0; x < map.Width; x++)
56 { 56 {
57 // Skip everything unlikely to be affected
58 if (Math.Abs(x - rx) > strength * 1.1)
59 continue;
60
57 int y; 61 int y;
58 for (y = 0; y < map.Height; y++) 62 for (y = 0; y < map.Height; y++)
59 { 63 {
60 if (!mask[x,y]) 64 // Skip everything unlikely to be affected
65 if (Math.Abs(y - ry) > strength * 1.1)
61 continue; 66 continue;
62 67
63 // Calculate a sphere and add it to the heighmap 68 // Calculate a sphere and add it to the heighmap
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
index c63cb90..89d9063 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
33 { 33 {
34 #region ITerrainPaintableEffect Members 34 #region ITerrainPaintableEffect Members
35 35
36 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 36 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
37 { 37 {
38 strength = TerrainUtil.MetersToSphericalStrength(strength); 38 strength = TerrainUtil.MetersToSphericalStrength(strength);
39 39
@@ -76,9 +76,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
76 { 76 {
77 for (y = 0; y < map.Height; y++) 77 for (y = 0; y < map.Height; y++)
78 { 78 {
79 if (!mask[x,y])
80 continue;
81
82 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 79 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
83 80
84 if (z > 0) // add in non-zero amount 81 if (z > 0) // add in non-zero amount
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
index 1288419..b3aa732 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
147 147
148 #region ITerrainPaintableEffect Members 148 #region ITerrainPaintableEffect Members
149 149
150 public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) 150 public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
151 { 151 {
152 strength = TerrainUtil.MetersToSphericalStrength(strength); 152 strength = TerrainUtil.MetersToSphericalStrength(strength);
153 153
@@ -158,9 +158,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
158 int y; 158 int y;
159 for (y = 0; y < map.Height; y++) 159 for (y = 0; y < map.Height; y++)
160 { 160 {
161 if (!mask[x,y])
162 continue;
163
164 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); 161 double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength);
165 162
166 if (z > 0) // add in non-zero amount 163 if (z > 0) // add in non-zero amount
@@ -207,4 +204,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
207 204
208 #endregion 205 #endregion
209 } 206 }
210} 207} \ No newline at end of file
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 }
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
index 71ea07d..eaa674e 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs
@@ -37,30 +37,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests
37 [Test] 37 [Test]
38 public void BrushTest() 38 public void BrushTest()
39 { 39 {
40 TerrainChannel map = new TerrainChannel(256, 256); 40 TerrainChannel x = new TerrainChannel(256, 256);
41 bool[,] allowMask = new bool[map.Width,map.Height];
42 int x;
43 int y;
44 for (x=0; x<map.Width; x++)
45 {
46 for (y=0; y<map.Height; y++)
47 {
48 allowMask[x,y] = true;
49 }
50 }
51
52 ITerrainPaintableEffect effect = new RaiseSphere(); 41 ITerrainPaintableEffect effect = new RaiseSphere();
53 42
54 effect.PaintEffect(map, allowMask, 128.0, 128.0, 23.0, 50, 0.1); 43 effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
55 Assert.That(map[128, 128] > 0.0, "Raise brush not raising values."); 44 Assert.That(x[128, 128] > 0.0, "Raise brush not raising values.");
56 Assert.That(map[0, 128] > 0.0, "Raise brush lowering edge values."); 45 Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values.");
57 46
58 map = new TerrainChannel(256, 256); 47 x = new TerrainChannel(256, 256);
59 effect = new LowerSphere(); 48 effect = new LowerSphere();
60 49
61 effect.PaintEffect(map, allowMask, 128.0, 128.0, -1, 50, 0.1); 50 effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
62 Assert.That(map[128, 128] < 0.0, "Lower not lowering values."); 51 Assert.That(x[128, 128] < 0.0, "Lower not lowering values.");
63 Assert.That(map[0, 128] < 0.0, "Lower brush affecting edge values."); 52 Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values.");
64 } 53 }
65 54
66 [Test] 55 [Test]
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 8391fab..80c4259 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -756,7 +756,6 @@ namespace OpenSim.Region.Environment.Scenes
756 set 756 set
757 { 757 {
758 StoreUndoState(); 758 StoreUndoState();
759if (m_shape != null) {
760 m_shape.Scale = value; 759 m_shape.Scale = value;
761 760
762 if (PhysActor != null && m_parentGroup != null) 761 if (PhysActor != null && m_parentGroup != null)
@@ -770,7 +769,6 @@ if (m_shape != null) {
770 } 769 }
771 } 770 }
772 } 771 }
773}
774 TriggerScriptChangedEvent(Changed.SCALE); 772 TriggerScriptChangedEvent(Changed.SCALE);
775 } 773 }
776 } 774 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b7072a0..fffc331 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -42,7 +42,6 @@ using OpenSim.Region.Interfaces;
42using OpenSim.Region.Environment.Interfaces; 42using OpenSim.Region.Environment.Interfaces;
43using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; 43using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
44using OpenSim.Region.Environment.Modules.World.Land; 44using OpenSim.Region.Environment.Modules.World.Land;
45using OpenSim.Region.Environment.Modules.World.Terrain;
46using OpenSim.Region.Environment.Scenes; 45using OpenSim.Region.Environment.Scenes;
47using OpenSim.Region.Physics.Manager; 46using OpenSim.Region.Physics.Manager;
48using OpenSim.Region.ScriptEngine.Shared; 47using OpenSim.Region.ScriptEngine.Shared;
@@ -3369,11 +3368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3369 public void llModifyLand(int action, int brush) 3368 public void llModifyLand(int action, int brush)
3370 { 3369 {
3371 m_host.AddScriptLPS(1); 3370 m_host.AddScriptLPS(1);
3372 ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface<ITerrainModule>(); 3371 World.ExternalChecks.ExternalChecksCanTerraformLand(m_host.OwnerID, new Vector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0));
3373 if (tm != null)
3374 {
3375 tm.ModifyTerrain(m_host.AbsolutePosition, (byte) brush, (byte) action, m_host.OwnerID);
3376 }
3377 } 3372 }
3378 3373
3379 public void llCollisionSound(string impact_sound, double impact_volume) 3374 public void llCollisionSound(string impact_sound, double impact_volume)