diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 1542230..2cf77ff 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
38 | { | 38 | { |
39 | public interface ITerrainPaintableEffect | 39 | public interface ITerrainPaintableEffect |
40 | { | 40 | { |
41 | void PaintEffect(ITerrainChannel map, double x, double y, double strength); | 41 | void PaintEffect(ITerrainChannel map, double x, double y, double strength, double duration); |
42 | } | 42 | } |
43 | 43 | ||
44 | public interface ITerrainFloodEffect | 44 | public interface ITerrainFloodEffect |
@@ -63,6 +63,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
63 | public class TerrainChannel : ITerrainChannel | 63 | public class TerrainChannel : ITerrainChannel |
64 | { | 64 | { |
65 | private double[,] map; | 65 | private double[,] map; |
66 | private bool[,] taint; | ||
66 | 67 | ||
67 | public int Width | 68 | public int Width |
68 | { | 69 | { |
@@ -103,29 +104,41 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
103 | } | 104 | } |
104 | set | 105 | set |
105 | { | 106 | { |
107 | taint[x / 16, y / 16] = true; | ||
106 | map[x, y] = value; | 108 | map[x, y] = value; |
107 | } | 109 | } |
108 | } | 110 | } |
109 | 111 | ||
112 | public bool Tainted(int x, int y) | ||
113 | { | ||
114 | return taint[x / 16, y / 16]; | ||
115 | } | ||
116 | |||
110 | public TerrainChannel() | 117 | public TerrainChannel() |
111 | { | 118 | { |
112 | map = new double[Constants.RegionSize, Constants.RegionSize]; | 119 | map = new double[Constants.RegionSize, Constants.RegionSize]; |
120 | taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16]; | ||
113 | } | 121 | } |
114 | 122 | ||
115 | public TerrainChannel(double[,] import) | 123 | public TerrainChannel(double[,] import) |
116 | { | 124 | { |
117 | map = import; | 125 | map = import; |
126 | taint = new bool[import.GetLength(0), import.GetLength(1)]; | ||
118 | } | 127 | } |
119 | 128 | ||
120 | public TerrainChannel(bool createMap) | 129 | public TerrainChannel(bool createMap) |
121 | { | 130 | { |
122 | if (createMap) | 131 | if (createMap) |
132 | { | ||
123 | map = new double[Constants.RegionSize, Constants.RegionSize]; | 133 | map = new double[Constants.RegionSize, Constants.RegionSize]; |
134 | taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16]; | ||
135 | } | ||
124 | } | 136 | } |
125 | 137 | ||
126 | public TerrainChannel(int w, int h) | 138 | public TerrainChannel(int w, int h) |
127 | { | 139 | { |
128 | map = new double[w, h]; | 140 | map = new double[w, h]; |
141 | taint = new bool[w / 16, h / 16]; | ||
129 | } | 142 | } |
130 | } | 143 | } |
131 | 144 | ||
@@ -246,7 +259,14 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
246 | if (m_painteffects.ContainsKey((StandardTerrainEffects)action)) | 259 | if (m_painteffects.ContainsKey((StandardTerrainEffects)action)) |
247 | { | 260 | { |
248 | m_painteffects[(StandardTerrainEffects)action].PaintEffect( | 261 | m_painteffects[(StandardTerrainEffects)action].PaintEffect( |
249 | m_channel, west, south, Math.Pow(size, 2.0)); | 262 | m_channel, west, south, Math.Pow(size, 2.0), seconds); |
263 | |||
264 | bool usingTerrainModule = false; | ||
265 | |||
266 | if (usingTerrainModule) | ||
267 | { | ||
268 | remoteClient.SendLayerData(m_channel.GetFloatsSerialised()); | ||
269 | } | ||
250 | } | 270 | } |
251 | else | 271 | else |
252 | { | 272 | { |
@@ -258,20 +278,32 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
258 | if (m_floodeffects.ContainsKey((StandardTerrainEffects)action)) | 278 | if (m_floodeffects.ContainsKey((StandardTerrainEffects)action)) |
259 | { | 279 | { |
260 | bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; | 280 | bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; |
261 | |||
262 | fillArea.Initialize(); | 281 | fillArea.Initialize(); |
263 | 282 | ||
264 | int x, y; | 283 | int x, y; |
284 | |||
265 | for (x = 0; x < m_channel.Width; x++) | 285 | for (x = 0; x < m_channel.Width; x++) |
266 | { | 286 | { |
267 | for (y = 0; y < m_channel.Height; y++) | 287 | for (y = 0; y < m_channel.Height; y++) |
268 | { | 288 | { |
269 | fillArea[x, y] = true; | 289 | if (x < east && x > west) |
290 | { | ||
291 | if (y < south && y > north) | ||
292 | { | ||
293 | fillArea[x, y] = true; | ||
294 | } | ||
295 | } | ||
270 | } | 296 | } |
271 | } | 297 | } |
272 | 298 | ||
273 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect( | 299 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect( |
274 | m_channel, fillArea, Math.Pow(size, 2.0)); | 300 | m_channel, fillArea, Math.Pow(size, 2.0)); |
301 | bool usingTerrainModule = false; | ||
302 | |||
303 | if (usingTerrainModule) | ||
304 | { | ||
305 | remoteClient.SendLayerData(m_channel.GetFloatsSerialised()); | ||
306 | } | ||
275 | } | 307 | } |
276 | else | 308 | else |
277 | { | 309 | { |