diff options
author | Adam Frisby | 2007-08-04 00:45:55 +0000 |
---|---|---|
committer | Adam Frisby | 2007-08-04 00:45:55 +0000 |
commit | a425e921680171c3eb3ae0c85c576030e2a8f834 (patch) | |
tree | f0f1b54afc492f83f6876b8762a31efdb7c36027 /OpenSim/Region/Environment | |
parent | * Extracted and refactored several large methods. Needs moving of packet hand... (diff) | |
download | opensim-SC_OLD-a425e921680171c3eb3ae0c85c576030e2a8f834.zip opensim-SC_OLD-a425e921680171c3eb3ae0c85c576030e2a8f834.tar.gz opensim-SC_OLD-a425e921680171c3eb3ae0c85c576030e2a8f834.tar.bz2 opensim-SC_OLD-a425e921680171c3eb3ae0c85c576030e2a8f834.tar.xz |
* Little more cleaning of EstateManager - still needs packets to be moved, but general functionality has been abstracted.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/EstateManager.cs | 146 |
1 files changed, 103 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index b8bc949..67cfba6 100644 --- a/OpenSim/Region/Environment/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs | |||
@@ -64,6 +64,88 @@ namespace OpenSim.Region.Environment | |||
64 | return false; | 64 | return false; |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | ||
68 | /// Sets terrain texture heights for each of the four corners of the region - textures are distributed as a linear range between the two heights. | ||
69 | /// </summary> | ||
70 | /// <param name="corner">Which corner</param> | ||
71 | /// <param name="lowValue">Minimum height that texture range should cover</param> | ||
72 | /// <param name="highValue">Maximum height that texture range should cover</param> | ||
73 | public void setEstateTextureRange(UInt16 corner, float lowValue, float highValue) | ||
74 | { | ||
75 | |||
76 | switch (corner) | ||
77 | { | ||
78 | case 0: | ||
79 | m_regInfo.estateSettings.terrainStartHeight0 = lowValue; | ||
80 | m_regInfo.estateSettings.terrainHeightRange0 = highValue; | ||
81 | break; | ||
82 | case 1: | ||
83 | m_regInfo.estateSettings.terrainStartHeight1 = lowValue; | ||
84 | m_regInfo.estateSettings.terrainHeightRange1 = highValue; | ||
85 | break; | ||
86 | case 2: | ||
87 | m_regInfo.estateSettings.terrainStartHeight2 = lowValue; | ||
88 | m_regInfo.estateSettings.terrainHeightRange2 = highValue; | ||
89 | break; | ||
90 | case 3: | ||
91 | m_regInfo.estateSettings.terrainStartHeight3 = lowValue; | ||
92 | m_regInfo.estateSettings.terrainHeightRange3 = highValue; | ||
93 | break; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | /// <summary> | ||
98 | /// Sets the 'detail' terrain texture on each of the bands. | ||
99 | /// </summary> | ||
100 | /// <param name="band">Which texture band</param> | ||
101 | /// <param name="textureUUID">The UUID of the texture</param> | ||
102 | public void setTerrainTexture(UInt16 band, LLUUID textureUUID) | ||
103 | { | ||
104 | switch (band) | ||
105 | { | ||
106 | case 0: | ||
107 | m_regInfo.estateSettings.terrainDetail0 = textureUUID; | ||
108 | break; | ||
109 | case 1: | ||
110 | m_regInfo.estateSettings.terrainDetail1 = textureUUID; | ||
111 | break; | ||
112 | case 2: | ||
113 | m_regInfo.estateSettings.terrainDetail2 = textureUUID; | ||
114 | break; | ||
115 | case 3: | ||
116 | m_regInfo.estateSettings.terrainDetail3 = textureUUID; | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | /// <summary> | ||
122 | /// Sets common region settings | ||
123 | /// </summary> | ||
124 | /// <param name="WaterHeight">Water height of the waterplane (may not nessecarily be one value)</param> | ||
125 | /// <param name="TerrainRaiseLimit">Maximum amount terrain can be raised from previous baking</param> | ||
126 | /// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param> | ||
127 | /// <param name="UseFixedSun">Use a fixed time of day on the sun?</param> | ||
128 | /// <param name="SunHour">The offset hour of the day</param> | ||
129 | public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, bool UseFixedSun, float SunHour) | ||
130 | { | ||
131 | // Water Height | ||
132 | m_regInfo.estateSettings.waterHeight = WaterHeight; | ||
133 | m_scene.Terrain.watermap.Fill(WaterHeight); | ||
134 | |||
135 | // Terraforming limits | ||
136 | m_regInfo.estateSettings.terrainRaiseLimit = TerrainRaiseLimit; | ||
137 | m_regInfo.estateSettings.terrainLowerLimit = TerrainLowerLimit; | ||
138 | m_scene.Terrain.maxRaise = TerrainRaiseLimit; | ||
139 | m_scene.Terrain.minLower = TerrainLowerLimit; | ||
140 | |||
141 | // Time of day / fixed sun | ||
142 | m_regInfo.estateSettings.useFixedSun = UseFixedSun; | ||
143 | m_regInfo.estateSettings.sunHour = SunHour; | ||
144 | } | ||
145 | |||
146 | #region Packet Handlers | ||
147 | |||
148 | |||
67 | public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) | 149 | public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) |
68 | { | 150 | { |
69 | if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) | 151 | if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID) |
@@ -162,11 +244,13 @@ namespace OpenSim.Region.Environment | |||
162 | } | 244 | } |
163 | else | 245 | else |
164 | { | 246 | { |
165 | m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); | 247 | float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); |
166 | m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); | 248 | float TerrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); |
167 | m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); | 249 | float TerrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); |
168 | m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); | 250 | bool UseFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); |
169 | m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); | 251 | float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); |
252 | |||
253 | setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); | ||
170 | 254 | ||
171 | sendRegionInfoPacketToAll(); | 255 | sendRegionInfoPacketToAll(); |
172 | } | 256 | } |
@@ -176,34 +260,16 @@ namespace OpenSim.Region.Environment | |||
176 | { | 260 | { |
177 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) | 261 | foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) |
178 | { | 262 | { |
179 | |||
180 | string s = Helpers.FieldToUTF8String(block.Parameter); | 263 | string s = Helpers.FieldToUTF8String(block.Parameter); |
181 | string[] splitField = s.Split(' '); | 264 | string[] splitField = s.Split(' '); |
182 | if (splitField.Length == 3) | 265 | if (splitField.Length == 3) |
183 | { | 266 | { |
184 | 267 | ||
185 | float tempHeightLow = (float)Convert.ToDecimal(splitField[1]); | 268 | UInt16 corner = Convert.ToInt16(splitField[0]); |
186 | float tempHeightHigh = (float)Convert.ToDecimal(splitField[2]); | 269 | float lowValue = (float)Convert.ToDecimal(splitField[1]); |
270 | float highValue = (float)Convert.ToDecimal(splitField[2]); | ||
187 | 271 | ||
188 | switch (Convert.ToInt16(splitField[0])) | 272 | setEstateTextureRange(corner, lowValue, highValue); |
189 | { | ||
190 | case 0: | ||
191 | m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow; | ||
192 | m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh; | ||
193 | break; | ||
194 | case 1: | ||
195 | m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow; | ||
196 | m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh; | ||
197 | break; | ||
198 | case 2: | ||
199 | m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow; | ||
200 | m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh; | ||
201 | break; | ||
202 | case 3: | ||
203 | m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow; | ||
204 | m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh; | ||
205 | break; | ||
206 | } | ||
207 | } | 273 | } |
208 | } | 274 | } |
209 | } | 275 | } |
@@ -217,22 +283,10 @@ namespace OpenSim.Region.Environment | |||
217 | string[] splitField = s.Split(' '); | 283 | string[] splitField = s.Split(' '); |
218 | if (splitField.Length == 2) | 284 | if (splitField.Length == 2) |
219 | { | 285 | { |
220 | LLUUID tempUUID = new LLUUID(splitField[1]); | 286 | UInt16 corner = Convert.ToInt16(splitField[0]); |
221 | switch (Convert.ToInt16(splitField[0])) | 287 | LLUUID textureUUID = new LLUUID(splitField[1]); |
222 | { | 288 | |
223 | case 0: | 289 | setTerrainTexture(corner, textureUUID); |
224 | m_regInfo.estateSettings.terrainDetail0 = tempUUID; | ||
225 | break; | ||
226 | case 1: | ||
227 | m_regInfo.estateSettings.terrainDetail1 = tempUUID; | ||
228 | break; | ||
229 | case 2: | ||
230 | m_regInfo.estateSettings.terrainDetail2 = tempUUID; | ||
231 | break; | ||
232 | case 3: | ||
233 | m_regInfo.estateSettings.terrainDetail3 = tempUUID; | ||
234 | break; | ||
235 | } | ||
236 | } | 290 | } |
237 | } | 291 | } |
238 | } | 292 | } |
@@ -265,6 +319,10 @@ namespace OpenSim.Region.Environment | |||
265 | } | 319 | } |
266 | } | 320 | } |
267 | 321 | ||
322 | #endregion | ||
323 | |||
324 | #region Outgoing Packets | ||
325 | |||
268 | public void sendRegionInfoPacketToAll() | 326 | public void sendRegionInfoPacketToAll() |
269 | { | 327 | { |
270 | List<Avatar> avatars = m_scene.RequestAvatarList(); | 328 | List<Avatar> avatars = m_scene.RequestAvatarList(); |
@@ -319,5 +377,7 @@ namespace OpenSim.Region.Environment | |||
319 | remoteClient.SendRegionHandshake(m_regInfo); | 377 | remoteClient.SendRegionHandshake(m_regInfo); |
320 | } | 378 | } |
321 | 379 | ||
380 | #endregion | ||
381 | |||
322 | } | 382 | } |
323 | } | 383 | } |