diff options
Diffstat (limited to 'OpenSim')
8 files changed, 135 insertions, 113 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs index e5e6f4d..c302c08 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs | |||
@@ -36,18 +36,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, float height, float strength, | 36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, float height, float strength, |
37 | int startX, int endX, int startY, int endY) | 37 | int startX, int endX, int startY, int endY) |
38 | { | 38 | { |
39 | double area = 4; | 39 | int sx = (endX - startX + 1) / 2; |
40 | double step = 1; | 40 | if (sx > 4) |
41 | sx = 4; | ||
42 | |||
43 | int sy = (endY - startY + 1) / 2; | ||
44 | if (sy > 4) | ||
45 | sy = 4; | ||
41 | 46 | ||
42 | strength *= 0.002f; | 47 | strength *= 0.002f; |
43 | if(strength > 1.0f) | 48 | if(strength > 1.0f) |
44 | strength = 1.0f; | 49 | strength = 1.0f; |
45 | 50 | ||
46 | double[,] manipulate = new double[map.Width,map.Height]; | 51 | double[,] tweak = new double[endX - startX + 1, endX - startX + 1]; |
47 | int x, y; | 52 | |
48 | for (x = startX; x <= endX; x++) | 53 | for (int x = startX, i = 0; x <= endX; x++, i++) |
49 | { | 54 | { |
50 | for (y = startY; y <= endY; y++) | 55 | for (int y = startY, j = 0; y <= endY; y++, j++) |
51 | { | 56 | { |
52 | if (!fillArea[x, y]) | 57 | if (!fillArea[x, y]) |
53 | continue; | 58 | continue; |
@@ -55,65 +60,31 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
55 | double average = 0.0; | 60 | double average = 0.0; |
56 | int avgsteps = 0; | 61 | int avgsteps = 0; |
57 | 62 | ||
58 | double n; | 63 | for (int n = x - sx; n <= x + sx; ++n) |
59 | for (n = -area; n < area; n += step) | ||
60 | { | 64 | { |
61 | double l; | 65 | for (int l = y - sy; l < y + sy; ++l) |
62 | for (l = -area; l < area; l += step) | ||
63 | { | 66 | { |
64 | avgsteps++; | 67 | avgsteps++; |
65 | average += GetBilinearInterpolate(x + n, y + l, map); | 68 | average += map[n, l]; |
66 | } | 69 | } |
67 | } | 70 | } |
68 | 71 | ||
69 | manipulate[x, y] = average / avgsteps; | 72 | tweak[i, j] = average / avgsteps; |
70 | } | 73 | } |
71 | } | 74 | } |
72 | for (x = startX; x <= endX; x++) | 75 | |
76 | for (int x = startX, i = 0; x <= endX; x++, i++) | ||
73 | { | 77 | { |
74 | for (y = startY; y <= endY; y++) | 78 | for (int y = startY, j = 0; y <= endY; y++, j++) |
75 | { | 79 | { |
76 | if (!fillArea[x, y]) | 80 | double ty = tweak[i, j]; |
81 | if (ty == 0.0) | ||
77 | continue; | 82 | continue; |
78 | 83 | ||
79 | map[x, y] = (1.0 - strength) * map[x, y] + strength * manipulate[x, y]; | 84 | map[x, y] = (1.0 - strength) * map[x, y] + strength * ty; |
80 | } | 85 | } |
81 | } | 86 | } |
82 | } | 87 | } |
83 | |||
84 | #endregion | ||
85 | |||
86 | private static double GetBilinearInterpolate(double x, double y, ITerrainChannel map) | ||
87 | { | ||
88 | int w = map.Width; | ||
89 | int h = map.Height; | ||
90 | |||
91 | if (x > w - 2.0) | ||
92 | x = w - 2.0; | ||
93 | if (y > h - 2.0) | ||
94 | y = h - 2.0; | ||
95 | if (x < 0.0) | ||
96 | x = 0.0; | ||
97 | if (y < 0.0) | ||
98 | y = 0.0; | ||
99 | |||
100 | const int stepSize = 1; | ||
101 | double h00 = map[(int) x, (int) y]; | ||
102 | double h10 = map[(int) x + stepSize, (int) y]; | ||
103 | double h01 = map[(int) x, (int) y + stepSize]; | ||
104 | double h11 = map[(int) x + stepSize, (int) y + stepSize]; | ||
105 | double h1 = h00; | ||
106 | double h2 = h10; | ||
107 | double h3 = h01; | ||
108 | double h4 = h11; | ||
109 | double a00 = h1; | ||
110 | double a10 = h2 - h1; | ||
111 | double a01 = h3 - h1; | ||
112 | double a11 = h1 - h2 - h3 + h4; | ||
113 | double partialx = x - (int) x; | ||
114 | double partialz = y - (int) y; | ||
115 | double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); | ||
116 | return hi; | ||
117 | } | ||
118 | } | 88 | } |
89 | #endregion | ||
119 | } \ No newline at end of file | 90 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs index 4c24e49..5e3e935 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -39,22 +39,26 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
39 | float size, float strength, int startX, int endX, int startY, int endY) | 39 | float size, float strength, int startX, int endX, int startY, int endY) |
40 | { | 40 | { |
41 | int x, y; | 41 | int x, y; |
42 | |||
43 | size *= 2; | ||
44 | |||
45 | float distancefactor; | 42 | float distancefactor; |
43 | float dx2; | ||
44 | |||
45 | size *= 2 * size; | ||
46 | 46 | ||
47 | // blend in map | 47 | // blend in map |
48 | for (x = startX; x <= endX; ++x) | 48 | for (x = startX; x <= endX; ++x) |
49 | { | 49 | { |
50 | dx2 = (x - rx) * (x - rx); | ||
50 | for (y = startY; y <= endY; ++y) | 51 | for (y = startY; y <= endY; ++y) |
51 | { | 52 | { |
52 | if (!mask[x,y]) | 53 | if (!mask[x,y]) |
53 | continue; | 54 | continue; |
55 | |||
56 | distancefactor = (dx2 + (y - ry) * (y - ry)) / size; | ||
57 | if(distancefactor > 1.0f) | ||
58 | continue; | ||
54 | 59 | ||
55 | distancefactor = strength * TerrainUtil.SphericalFactor(x - rx, y - ry, size); | 60 | distancefactor = strength * (1.0f - distancefactor); |
56 | 61 | if (distancefactor >= 1.0f) | |
57 | if(distancefactor >= 1.0f) | ||
58 | map[x, y] = rz; | 62 | map[x, y] = rz; |
59 | else | 63 | else |
60 | map[x, y] += (rz - (float)map[x, y]) * distancefactor; | 64 | map[x, y] += (rz - (float)map[x, y]) * distancefactor; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs index 5a31a60..4e1d0fc 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs | |||
@@ -38,18 +38,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
38 | float size, float strength, int startX, int endX, int startY, int endY) | 38 | float size, float strength, int startX, int endX, int startY, int endY) |
39 | { | 39 | { |
40 | size = 0.5f * (float)Math.PI / size; | 40 | size = 0.5f * (float)Math.PI / size; |
41 | strength *= 2; | ||
42 | int x, y; | ||
43 | 41 | ||
44 | for (x = startX; x <= endX; x++) | 42 | float dx2; |
43 | for (int x = startX; x <= endX; ++x) | ||
45 | { | 44 | { |
46 | for (y = startY; y <= endY; y++) | 45 | dx2 = (x - rx) * (x - rx); |
46 | for (int y = startY; y <= endY; ++y) | ||
47 | { | 47 | { |
48 | if (!mask[x, y]) | 48 | if (!mask[x, y]) |
49 | continue; | 49 | continue; |
50 | 50 | ||
51 | // Calculate a cos-sphere and add it to the heighmap | 51 | // Calculate a cos-sphere and add it to the heighmap |
52 | double r = Math.Sqrt((x - rx) * (x - rx) + (y - ry) * (y - ry)); | 52 | double r = Math.Sqrt(dx2 + (y - ry) * (y - ry)); |
53 | double distancefactor = Math.Cos(r * size); | 53 | double distancefactor = Math.Cos(r * size); |
54 | if (distancefactor > 0.0) | 54 | if (distancefactor > 0.0) |
55 | { | 55 | { |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs index 010ca0c..ac6d1af 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs | |||
@@ -39,21 +39,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
39 | float size, float strength, int startX, int endX, int startY, int endY) | 39 | float size, float strength, int startX, int endX, int startY, int endY) |
40 | { | 40 | { |
41 | int x, y; | 41 | int x, y; |
42 | float distancefactor; | ||
43 | float dx2; | ||
44 | |||
45 | size *= size; | ||
42 | 46 | ||
43 | for (x = startX; x <= endX; x++) | 47 | for (x = startX; x <= endX; x++) |
44 | { | 48 | { |
49 | dx2 = (x - rx) * (x - rx); | ||
45 | for (y = startY; y <= endY; y++) | 50 | for (y = startY; y <= endY; y++) |
46 | { | 51 | { |
47 | if (!mask[x, y]) | 52 | if (!mask[x, y]) |
48 | continue; | 53 | continue; |
49 | 54 | ||
50 | // Calculate a sphere and add it to the heighmap | 55 | // Calculate a sphere and add it to the heighmap |
51 | float distancefactor = TerrainUtil.SphericalFactor(x - rx, y - ry, size); | 56 | distancefactor = (dx2 + (y - ry) * (y - ry)) / size; |
57 | if (distancefactor > 1.0f) | ||
58 | continue; | ||
52 | 59 | ||
60 | distancefactor = strength * (1.0f - distancefactor); | ||
53 | double noise = TerrainUtil.PerlinNoise2D(x / (double) map.Width, y / (double) map.Height, 8, 1.0); | 61 | double noise = TerrainUtil.PerlinNoise2D(x / (double) map.Width, y / (double) map.Height, 8, 1.0); |
54 | 62 | map[x, y] += noise * distancefactor; | |
55 | if (distancefactor > 0.0) | ||
56 | map[x, y] += noise * distancefactor * strength; | ||
57 | } | 63 | } |
58 | } | 64 | } |
59 | } | 65 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs index e277363..1946f27 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -39,19 +39,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
39 | float size, float strength, int startX, int endX, int startY, int endY) | 39 | float size, float strength, int startX, int endX, int startY, int endY) |
40 | { | 40 | { |
41 | size = 0.5f *(float)Math.PI / size; | 41 | size = 0.5f *(float)Math.PI / size; |
42 | strength *= 2; | ||
43 | 42 | ||
44 | int x, y; | 43 | float dx2; |
45 | 44 | for (int x = startX; x <= endX; ++x) | |
46 | for (x = startX; x <= endX; ++x) | ||
47 | { | 45 | { |
48 | for (y = startY; y <= endY; ++y) | 46 | dx2 = (x - rx) * (x - rx); |
47 | for (int y = startY; y <= endY; ++y) | ||
49 | { | 48 | { |
50 | if (!mask[x, y]) | 49 | if (!mask[x, y]) |
51 | continue; | 50 | continue; |
52 | 51 | ||
53 | // Calculate a cos-sphere and add it to the heighmap | 52 | // Calculate a cos-sphere and add it to the heighmap |
54 | double r = Math.Sqrt((x - rx) * (x - rx) + (y - ry) * (y - ry)); | 53 | double r = Math.Sqrt(dx2 + (y - ry) * (y - ry)); |
55 | double distancefactor = Math.Cos(r * size); | 54 | double distancefactor = Math.Cos(r * size); |
56 | if (distancefactor > 0.0) | 55 | if (distancefactor > 0.0) |
57 | map[x, y] += distancefactor * strength; | 56 | map[x, y] += distancefactor * strength; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs index ab3c5b7..4b7d9a1 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs | |||
@@ -50,21 +50,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
50 | if (strength > 1.0f) | 50 | if (strength > 1.0f) |
51 | strength = 1.0f; | 51 | strength = 1.0f; |
52 | 52 | ||
53 | int x,y; | 53 | int x, y; |
54 | float distancefactor; | ||
55 | float dx2; | ||
56 | |||
54 | for (x = startX; x <= endX; x++) | 57 | for (x = startX; x <= endX; x++) |
55 | { | 58 | { |
59 | dx2 = (x - rx) * (x - rx); | ||
56 | for (y = startY; y <= endY; y++) | 60 | for (y = startY; y <= endY; y++) |
57 | { | 61 | { |
58 | if (!mask[x, y]) | 62 | if (!mask[x, y]) |
59 | continue; | 63 | continue; |
60 | 64 | ||
61 | // Calculate a sphere and add it to the heighmap | 65 | // Calculate a sphere and add it to the heighmap |
62 | double distancefactor = TerrainUtil.SphericalFactor(x - rx, y - ry, size); | 66 | distancefactor = (dx2 + (y - ry) * (y - ry)) / size; |
63 | if (distancefactor > 0.0) | 67 | if (distancefactor > 1.0f) |
64 | { | 68 | continue; |
65 | distancefactor *= strength; | 69 | |
66 | map[x, y] = (map[x, y] * (1.0 - distancefactor)) + (m_revertmap[x, y] * distancefactor); | 70 | distancefactor = strength * (1.0f - distancefactor); |
67 | } | 71 | map[x, y] = (map[x, y] * (1.0 - distancefactor)) + (m_revertmap[x, y] * distancefactor); |
68 | } | 72 | } |
69 | } | 73 | } |
70 | } | 74 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs index a952694..69efdb9 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs | |||
@@ -35,60 +35,66 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | 36 | ||
37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, float rx, float ry, float rz, | 37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, float rx, float ry, float rz, |
38 | float size, float strengh, int startX, int endX, int startY, int endY) | 38 | float size, float strength, int startX, int endX, int startY, int endY) |
39 | { | 39 | { |
40 | int x, y; | 40 | float distancefactor; |
41 | double[,] tweak = new double[map.Width, map.Height]; | 41 | float dx2; |
42 | 42 | ||
43 | double step = size / 4.0; | 43 | double[,] tweak = new double[endX - startX + 1, endX - startX + 1]; |
44 | int ssize = (int)(size + 0.5); | ||
45 | if(ssize > 4) | ||
46 | ssize = 4; | ||
44 | 47 | ||
45 | if(strengh > 1.0f) | 48 | size *= size; |
46 | strengh = 1.0f; | 49 | |
50 | if (strength > 1.0f) | ||
51 | strength = 1.0f; | ||
47 | 52 | ||
48 | // compute delta map | 53 | // compute delta map |
49 | for (x = startX; x <= endX; x++) | 54 | for (int x = startX, i = 0; x <= endX; x++, i++) |
50 | { | 55 | { |
51 | for (y = startY; y <= endY; y++) | 56 | dx2 = (x - rx) * (x - rx); |
57 | for (int y = startY, j = 0; y <= endY; y++, j++) | ||
52 | { | 58 | { |
53 | if (!mask[x, y]) | 59 | if (!mask[x, y]) |
54 | continue; | 60 | continue; |
55 | 61 | ||
56 | double z = TerrainUtil.SphericalFactor(x - rx, y - ry, size); | 62 | distancefactor = (dx2 + (y - ry) * (y - ry)) / size; |
57 | 63 | if (distancefactor <= 1.0f) | |
58 | if (z > 0) // add in non-zero amount | ||
59 | { | 64 | { |
65 | distancefactor = strength * (1.0f - distancefactor); | ||
66 | |||
60 | double average = 0.0; | 67 | double average = 0.0; |
61 | int avgsteps = 0; | 68 | int avgsteps = 0; |
62 | 69 | ||
63 | double n; | 70 | for (int n = x - ssize; n <= x + ssize; ++n) |
64 | for (n =- size; n < size; n += step) | ||
65 | { | 71 | { |
66 | double l; | 72 | if(n > 0 && n < map.Width) |
67 | for (l = -size; l < size; l += step) | ||
68 | { | 73 | { |
69 | avgsteps++; | 74 | for (int l = y - ssize; l <= y + ssize; ++l) |
70 | average += TerrainUtil.GetBilinearInterpolate(x + n, y + l, map); | 75 | { |
76 | if (l > 0 && l < map.Height) | ||
77 | { | ||
78 | avgsteps++; | ||
79 | average += map[n, l]; | ||
80 | } | ||
81 | } | ||
71 | } | 82 | } |
72 | } | 83 | } |
73 | tweak[x, y] = average / avgsteps; | 84 | average /= avgsteps; |
85 | tweak[i, j] = distancefactor * (map[x, y] - average); | ||
74 | } | 86 | } |
75 | } | 87 | } |
76 | } | 88 | } |
77 | // blend in map | 89 | // blend in map |
78 | for (x = startX; x <= endX; x++) | 90 | for (int x = startX, i = 0; x <= endX; x++, i++) |
79 | { | 91 | { |
80 | for (y = startY; y <= endY; y++) | 92 | for (int y = startY, j = 0; y <= endY; y++, j++) |
81 | { | 93 | { |
82 | if (!mask[x, y]) | 94 | double tz = tweak[i, j]; |
83 | continue; | 95 | if(tz != 0.0) |
84 | |||
85 | float distancefactor = TerrainUtil.SphericalFactor(x - rx, y - ry, size); | ||
86 | |||
87 | if (distancefactor > 0) // add in non-zero amount | ||
88 | { | 96 | { |
89 | double a = (map[x, y] - tweak[x, y]) * distancefactor; | 97 | double newz = map[x, y] - tz; |
90 | double newz = map[x, y] - (a * strengh); | ||
91 | |||
92 | if (newz > 0.0) | 98 | if (newz > 0.0) |
93 | map[x, y] = newz; | 99 | map[x, y] = newz; |
94 | } | 100 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 9e7237b..b98bc9d 100755 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -516,12 +516,35 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
516 | /// <param name="agentId">UUID of script-owner</param> | 516 | /// <param name="agentId">UUID of script-owner</param> |
517 | public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action) | 517 | public void ModifyTerrain(UUID user, Vector3 pos, byte size, byte action) |
518 | { | 518 | { |
519 | float duration = 0.25f; | 519 | float duration; |
520 | float brushSize; | 520 | float brushSize; |
521 | if(action == (byte)StandardTerrainEffects.Lower || action == (byte)StandardTerrainEffects.Raise) | 521 | if (size > 2) |
522 | brushSize = (int)(Math.Pow(2, size) + 0.5); | 522 | { |
523 | size = 3; | ||
524 | brushSize = 4.0f; | ||
525 | } | ||
523 | else | 526 | else |
524 | brushSize = (size + 1) * 1.35f; | 527 | { |
528 | size++; | ||
529 | brushSize = size; | ||
530 | } | ||
531 | |||
532 | switch((StandardTerrainEffects)action) | ||
533 | { | ||
534 | case StandardTerrainEffects.Flatten: | ||
535 | duration = 7.29f * size * size; | ||
536 | break; | ||
537 | case StandardTerrainEffects.Smooth: | ||
538 | case StandardTerrainEffects.Revert: | ||
539 | duration = 0.06f * size * size; | ||
540 | break; | ||
541 | case StandardTerrainEffects.Noise: | ||
542 | duration = 0.46f * size * size; | ||
543 | break; | ||
544 | default: | ||
545 | duration = 0.25f; | ||
546 | break; | ||
547 | } | ||
525 | 548 | ||
526 | client_OnModifyTerrain(user, pos.Z, duration, brushSize, action, pos.Y, pos.X, pos.Y, pos.X, -1); | 549 | client_OnModifyTerrain(user, pos.Z, duration, brushSize, action, pos.Y, pos.X, pos.Y, pos.X, -1); |
527 | } | 550 | } |
@@ -1304,9 +1327,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1304 | return ret; | 1327 | return ret; |
1305 | } | 1328 | } |
1306 | 1329 | ||
1330 | private double NextModifyTerrainTime = double.MinValue; | ||
1331 | |||
1307 | private void client_OnModifyTerrain(UUID user, float height, float seconds, float brushSize, byte action, | 1332 | private void client_OnModifyTerrain(UUID user, float height, float seconds, float brushSize, byte action, |
1308 | float north, float west, float south, float east, int parcelLocalID) | 1333 | float north, float west, float south, float east, int parcelLocalID) |
1309 | { | 1334 | { |
1335 | double now = Util.GetTimeStamp(); | ||
1336 | if(now < NextModifyTerrainTime) | ||
1337 | return; | ||
1338 | |||
1339 | NextModifyTerrainTime = double.MaxValue; // block it | ||
1340 | |||
1310 | //m_log.DebugFormat("brushs {0} seconds {1} height {2}, parcel {3}", brushSize, seconds, height, parcelLocalID); | 1341 | //m_log.DebugFormat("brushs {0} seconds {1} height {2}, parcel {3}", brushSize, seconds, height, parcelLocalID); |
1311 | bool god = m_scene.Permissions.IsGod(user); | 1342 | bool god = m_scene.Permissions.IsGod(user); |
1312 | bool allowed = false; | 1343 | bool allowed = false; |
@@ -1454,6 +1485,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1454 | m_log.Debug("Unknown terrain flood type " + action); | 1485 | m_log.Debug("Unknown terrain flood type " + action); |
1455 | } | 1486 | } |
1456 | } | 1487 | } |
1488 | NextModifyTerrainTime = Util.GetTimeStamp() + 0.02; // 20ms cooldown | ||
1457 | } | 1489 | } |
1458 | 1490 | ||
1459 | private void client_OnBakeTerrain(IClientAPI remoteClient) | 1491 | private void client_OnBakeTerrain(IClientAPI remoteClient) |