aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs81
-rw-r--r--OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs21
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs9
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs9
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionModule.cs10
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISimChat.cs9
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrain.cs16
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXfer.cs6
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs149
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs122
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs66
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs21
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs32
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs50
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs56
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs26
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs41
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs38
-rw-r--r--OpenSim/Region/Environment/RegionManager.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs134
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs115
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs284
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs54
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs402
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs345
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs393
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs28
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs38
-rw-r--r--OpenSim/Region/Environment/StorageManager.cs26
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs45
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs15
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs43
47 files changed, 1456 insertions, 1461 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 92e1956..30d206f 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -39,7 +39,6 @@ using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
39 39
40namespace OpenSim.Region.Environment 40namespace OpenSim.Region.Environment
41{ 41{
42
43 /// <summary> 42 /// <summary>
44 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings 43 /// Processes requests regarding estates. Refer to EstateSettings.cs in OpenSim.Framework. Types for all of the core settings
45 /// </summary> 44 /// </summary>
@@ -48,9 +47,9 @@ namespace OpenSim.Region.Environment
48 private Scene m_scene; 47 private Scene m_scene;
49 private RegionInfo m_regInfo; 48 private RegionInfo m_regInfo;
50 49
51 public EstateManager(Scene scene,RegionInfo reginfo) 50 public EstateManager(Scene scene, RegionInfo reginfo)
52 { 51 {
53 m_scene = scene; 52 m_scene = scene;
54 m_regInfo = reginfo; 53 m_regInfo = reginfo;
55 } 54 }
56 55
@@ -125,7 +124,8 @@ namespace OpenSim.Region.Environment
125 /// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param> 124 /// <param name="TerrainLowerLimit">Minimum amount terrain can be lowered from previous baking</param>
126 /// <param name="UseFixedSun">Use a fixed time of day on the sun?</param> 125 /// <param name="UseFixedSun">Use a fixed time of day on the sun?</param>
127 /// <param name="SunHour">The offset hour of the day</param> 126 /// <param name="SunHour">The offset hour of the day</param>
128 public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, bool UseFixedSun, float SunHour) 127 public void setRegionSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
128 bool UseFixedSun, float SunHour)
129 { 129 {
130 // Water Height 130 // Water Height
131 m_regInfo.estateSettings.waterHeight = WaterHeight; 131 m_regInfo.estateSettings.waterHeight = WaterHeight;
@@ -144,13 +144,12 @@ namespace OpenSim.Region.Environment
144 144
145 #region Packet Handlers 145 #region Packet Handlers
146 146
147
148 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client) 147 public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
149 { 148 {
150 switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) 149 switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
151 { 150 {
152 case "getinfo": 151 case "getinfo":
153 this.sendRegionInfoPacketToAll(); 152 sendRegionInfoPacketToAll();
154 break; 153 break;
155 case "setregioninfo": 154 case "setregioninfo":
156 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId)) 155 if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
@@ -193,47 +192,54 @@ namespace OpenSim.Region.Environment
193 192
194 if (convertParamStringToBool(packet.ParamList[0].Parameter)) 193 if (convertParamStringToBool(packet.ParamList[0].Parameter))
195 { 194 {
196 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockTerraform; 195 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
196 Simulator.RegionFlags.BlockTerraform;
197 } 197 }
198 198
199 if (convertParamStringToBool(packet.ParamList[1].Parameter)) 199 if (convertParamStringToBool(packet.ParamList[1].Parameter))
200 { 200 {
201 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.NoFly; 201 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
202 Simulator.RegionFlags.NoFly;
202 } 203 }
203 204
204 if (convertParamStringToBool(packet.ParamList[2].Parameter)) 205 if (convertParamStringToBool(packet.ParamList[2].Parameter))
205 { 206 {
206 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowDamage; 207 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
208 Simulator.RegionFlags.AllowDamage;
207 } 209 }
208 210
209 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false) 211 if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
210 { 212 {
211 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.BlockLandResell; 213 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
214 Simulator.RegionFlags.BlockLandResell;
212 } 215 }
213 216
214 217
215 int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); 218 int tempMaxAgents =
216 m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents; 219 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
220 m_regInfo.estateSettings.maxAgents = (byte) tempMaxAgents;
217 221
218 float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 222 float tempObjectBonusFactor =
223 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
219 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; 224 m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
220 225
221 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); 226 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
222 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; 227 m_regInfo.estateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel;
223 228
224 229
225 if (convertParamStringToBool(packet.ParamList[7].Parameter)) 230 if (convertParamStringToBool(packet.ParamList[7].Parameter))
226 { 231 {
227 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.RestrictPushObject; 232 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
233 Simulator.RegionFlags.RestrictPushObject;
228 } 234 }
229 235
230 if (convertParamStringToBool(packet.ParamList[8].Parameter)) 236 if (convertParamStringToBool(packet.ParamList[8].Parameter))
231 { 237 {
232 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | Simulator.RegionFlags.AllowParcelChanges; 238 m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
239 Simulator.RegionFlags.AllowParcelChanges;
233 } 240 }
234 241
235 sendRegionInfoPacketToAll(); 242 sendRegionInfoPacketToAll();
236
237 } 243 }
238 } 244 }
239 245
@@ -245,11 +251,13 @@ namespace OpenSim.Region.Environment
245 } 251 }
246 else 252 else
247 { 253 {
248 float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 254 float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
249 float TerrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 255 float TerrainRaiseLimit =
250 float TerrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 256 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
251 bool UseFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter); 257 float TerrainLowerLimit =
252 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 258 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
259 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
260 float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
253 261
254 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); 262 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
255 263
@@ -265,10 +273,9 @@ namespace OpenSim.Region.Environment
265 string[] splitField = s.Split(' '); 273 string[] splitField = s.Split(' ');
266 if (splitField.Length == 3) 274 if (splitField.Length == 3)
267 { 275 {
268
269 Int16 corner = Convert.ToInt16(splitField[0]); 276 Int16 corner = Convert.ToInt16(splitField[0]);
270 float lowValue = (float)Convert.ToDecimal(splitField[1]); 277 float lowValue = (float) Convert.ToDecimal(splitField[1]);
271 float highValue = (float)Convert.ToDecimal(splitField[2]); 278 float highValue = (float) Convert.ToDecimal(splitField[2]);
272 279
273 setEstateTextureRange(corner, lowValue, highValue); 280 setEstateTextureRange(corner, lowValue, highValue);
274 } 281 }
@@ -279,7 +286,6 @@ namespace OpenSim.Region.Environment
279 { 286 {
280 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 287 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
281 { 288 {
282
283 string s = Helpers.FieldToUTF8String(block.Parameter); 289 string s = Helpers.FieldToUTF8String(block.Parameter);
284 string[] splitField = s.Split(' '); 290 string[] splitField = s.Split(' ');
285 if (splitField.Length == 2) 291 if (splitField.Length == 2)
@@ -326,12 +332,12 @@ namespace OpenSim.Region.Environment
326 332
327 public void sendRegionInfoPacketToAll() 333 public void sendRegionInfoPacketToAll()
328 { 334 {
329 List<Avatar> avatars = m_scene.RequestAvatarList(); 335 List<Avatar> avatars = m_scene.RequestAvatarList();
330 336
331 for (int i = 0; i < avatars.Count; i++) 337 for (int i = 0; i < avatars.Count; i++)
332 { 338 {
333 this.sendRegionInfoPacket(avatars[i].ControllingClient); 339 sendRegionInfoPacket(avatars[i].ControllingClient);
334 } 340 }
335 } 341 }
336 342
337 public void sendRegionHandshakeToAll() 343 public void sendRegionHandshakeToAll()
@@ -340,8 +346,8 @@ namespace OpenSim.Region.Environment
340 346
341 for (int i = 0; i < avatars.Count; i++) 347 for (int i = 0; i < avatars.Count; i++)
342 { 348 {
343 this.sendRegionHandshake(avatars[i].ControllingClient); 349 sendRegionHandshake(avatars[i].ControllingClient);
344 } 350 }
345 } 351 }
346 352
347 public void sendRegionInfoPacket(IClientAPI remote_client) 353 public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -361,9 +367,9 @@ namespace OpenSim.Region.Environment
361 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; 367 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
362 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; 368 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
363 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; 369 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
364 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags; 370 regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags;
365 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess; 371 regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess;
366 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes( m_regInfo.RegionName); 372 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
367 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; 373 regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
368 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; 374 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
369 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit; 375 regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
@@ -379,6 +385,5 @@ namespace OpenSim.Region.Environment
379 } 385 }
380 386
381 #endregion 387 #endregion
382
383 } 388 }
384} 389} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
index 727b386..05cecf8 100644
--- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
@@ -1,17 +1,18 @@
1using System; 1using System.IO;
2using System.Collections.Generic; 2using libsecondlife;
3using System.Text; 3
4using System.IO;
5using libsecondlife;
6
7namespace OpenSim.Region.Environment.Interfaces 4namespace OpenSim.Region.Environment.Interfaces
8{ 5{
9 public interface IDynamicTextureManager 6 public interface IDynamicTextureManager
10 { 7 {
11 void RegisterRender(string handleType, IDynamicTextureRender render); 8 void RegisterRender(string handleType, IDynamicTextureRender render);
12 void ReturnData(LLUUID id, byte[] data); 9 void ReturnData(LLUUID id, byte[] data);
13 LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); 10
14 LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer); 11 LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams,
12 int updateTimer);
13
14 LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams,
15 int updateTimer);
15 } 16 }
16 17
17 public interface IDynamicTextureRender 18 public interface IDynamicTextureRender
@@ -24,4 +25,4 @@ namespace OpenSim.Region.Environment.Interfaces
24 bool AsyncConvertUrl(LLUUID id, string url, string extraParams); 25 bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
25 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); 26 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
26 } 27 }
27} 28} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index e974e25..cb00b48 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -1,12 +1,9 @@
1using System; 1using libsecondlife;
2using System.Collections.Generic; 2
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Environment.Interfaces 3namespace OpenSim.Region.Environment.Interfaces
7{ 4{
8 public interface IHttpRequests 5 public interface IHttpRequests
9 { 6 {
10 LLUUID MakeHttpRequest(string url, string type, string body); 7 LLUUID MakeHttpRequest(string url, string type, string body);
11 } 8 }
12} 9} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index 89a0e8c..1a00f2c 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -26,15 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30
31using OpenSim.Framework.Types;
32using OpenSim.Region;
33using OpenSim.Region.Environment;
34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Region.Environment.LandManagement; 31using OpenSim.Region.Environment.LandManagement;
36 32using OpenSim.Region.Environment.Scenes;
37using System.Collections.Generic;
38 33
39namespace OpenSim.Region.Environment.Interfaces 34namespace OpenSim.Region.Environment.Interfaces
40{ 35{
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
index 47f3d92..981b73f 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
@@ -1,15 +1,13 @@
1using System; 1using OpenSim.Region.Environment.Scenes;
2using System.Collections.Generic; 2
3using System.Text;
4
5namespace OpenSim.Region.Environment.Interfaces 3namespace OpenSim.Region.Environment.Interfaces
6{ 4{
7 public interface IRegionModule 5 public interface IRegionModule
8 { 6 {
9 void Initialise(Scenes.Scene scene); 7 void Initialise(Scene scene);
10 void PostInitialise(); 8 void PostInitialise();
11 void CloseDown(); 9 void CloseDown();
12 string GetName(); 10 string GetName();
13 bool IsSharedModule(); 11 bool IsSharedModule();
14 } 12 }
15} 13} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
index f0adabc..5aa78ab 100644
--- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
@@ -1,12 +1,9 @@
1using System; 1using libsecondlife;
2using System.Collections.Generic; 2
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Environment.Interfaces 3namespace OpenSim.Region.Environment.Interfaces
7{ 4{
8 public interface ISimChat 5 public interface ISimChat
9 { 6 {
10 void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 7 void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
11 } 8 }
12} 9} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
index 576c5b4..f9ff71a 100644
--- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
@@ -1,16 +1,16 @@
1using System; 1using OpenSim.Framework.Interfaces;
2using System.Collections.Generic; 2
3using System.Text;
4using OpenSim.Framework.Interfaces;
5
6namespace OpenSim.Region.Environment.Interfaces 3namespace OpenSim.Region.Environment.Interfaces
7{ 4{
8 public interface ITerrain 5 public interface ITerrain
9 { 6 {
10 bool Tainted(); 7 bool Tainted();
11 bool Tainted(int x, int y); 8 bool Tainted(int x, int y);
12 void ResetTaint(); 9 void ResetTaint();
13 void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser); 10
11 void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
12 IClientAPI remoteUser);
13
14 void CheckHeightValues(); 14 void CheckHeightValues();
15 float[] GetHeights1D(); 15 float[] GetHeights1D();
16 float[,] GetHeights2D(); 16 float[,] GetHeights2D();
@@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Interfaces
43 void ExportImage(string filename, string gradientmap); 43 void ExportImage(string filename, string gradientmap);
44 byte[] ExportJpegImage(string gradientmap); 44 byte[] ExportJpegImage(string gradientmap);
45 } 45 }
46} 46} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs
index 7482ec0..6fd4d6f 100644
--- a/OpenSim/Region/Environment/Interfaces/IXfer.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs
@@ -1,11 +1,7 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Interfaces 1namespace OpenSim.Region.Environment.Interfaces
6{ 2{
7 public interface IXfer 3 public interface IXfer
8 { 4 {
9 bool AddNewFile(string fileName, byte[] data); 5 bool AddNewFile(string fileName, byte[] data);
10 } 6 }
11} 7} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index a1d8885..4d36650 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -8,37 +8,40 @@ using OpenSim.Region.Environment.Scenes;
8 8
9namespace OpenSim.Region.Environment.LandManagement 9namespace OpenSim.Region.Environment.LandManagement
10{ 10{
11
11 #region Parcel Class 12 #region Parcel Class
13
12 /// <summary> 14 /// <summary>
13 /// Keeps track of a specific piece of land's information 15 /// Keeps track of a specific piece of land's information
14 /// </summary> 16 /// </summary>
15 public class Land 17 public class Land
16 { 18 {
17 #region Member Variables 19 #region Member Variables
20
18 public LandData landData = new LandData(); 21 public LandData landData = new LandData();
19 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 22 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
20 23
21 public Scene m_scene; 24 public Scene m_scene;
22 25
23 private bool[,] landBitmap = new bool[64, 64]; 26 private bool[,] landBitmap = new bool[64,64];
24 27
25 #endregion 28 #endregion
26 29
27
28 #region Constructors 30 #region Constructors
31
29 public Land(LLUUID owner_id, bool is_group_owned, Scene scene) 32 public Land(LLUUID owner_id, bool is_group_owned, Scene scene)
30 { 33 {
31 m_scene = scene; 34 m_scene = scene;
32 landData.ownerID = owner_id; 35 landData.ownerID = owner_id;
33 landData.isGroupOwned = is_group_owned; 36 landData.isGroupOwned = is_group_owned;
34
35 } 37 }
36 #endregion
37 38
39 #endregion
38 40
39 #region Member Functions 41 #region Member Functions
40 42
41 #region General Functions 43 #region General Functions
44
42 /// <summary> 45 /// <summary>
43 /// Checks to see if this land object contains a point 46 /// Checks to see if this land object contains a point
44 /// </summary> 47 /// </summary>
@@ -49,7 +52,7 @@ namespace OpenSim.Region.Environment.LandManagement
49 { 52 {
50 if (x >= 0 && y >= 0 && x <= 256 && x <= 256) 53 if (x >= 0 && y >= 0 && x <= 256 && x <= 256)
51 { 54 {
52 return (landBitmap[x / 4, y / 4] == true); 55 return (landBitmap[x/4, y/4] == true);
53 } 56 }
54 else 57 else
55 { 58 {
@@ -59,10 +62,10 @@ namespace OpenSim.Region.Environment.LandManagement
59 62
60 public Land Copy() 63 public Land Copy()
61 { 64 {
62 Land newLand = new Land(this.landData.ownerID, this.landData.isGroupOwned, m_scene); 65 Land newLand = new Land(landData.ownerID, landData.isGroupOwned, m_scene);
63 66
64 //Place all new variables here! 67 //Place all new variables here!
65 newLand.landBitmap = (bool[,])(this.landBitmap.Clone()); 68 newLand.landBitmap = (bool[,]) (landBitmap.Clone());
66 newLand.landData = landData.Copy(); 69 newLand.landData = landData.Copy();
67 70
68 return newLand; 71 return newLand;
@@ -70,17 +73,17 @@ namespace OpenSim.Region.Environment.LandManagement
70 73
71 #endregion 74 #endregion
72 75
73
74 #region Packet Request Handling 76 #region Packet Request Handling
77
75 /// <summary> 78 /// <summary>
76 /// Sends land properties as requested 79 /// Sends land properties as requested
77 /// </summary> 80 /// </summary>
78 /// <param name="sequence_id">ID sent by client for them to keep track of</param> 81 /// <param name="sequence_id">ID sent by client for them to keep track of</param>
79 /// <param name="snap_selection">Bool sent by client for them to use</param> 82 /// <param name="snap_selection">Bool sent by client for them to use</param>
80 /// <param name="remote_client">Object representing the client</param> 83 /// <param name="remote_client">Object representing the client</param>
81 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 84 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
85 IClientAPI remote_client)
82 { 86 {
83
84 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); 87 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
85 updatePacket.ParcelData.AABBMax = landData.AABBMax; 88 updatePacket.ParcelData.AABBMax = landData.AABBMax;
86 updatePacket.ParcelData.AABBMin = landData.AABBMin; 89 updatePacket.ParcelData.AABBMin = landData.AABBMin;
@@ -91,17 +94,20 @@ namespace OpenSim.Region.Environment.LandManagement
91 updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; 94 updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
92 95
93 updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); 96 updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
94 updatePacket.ParcelData.Category = (byte)landData.category; 97 updatePacket.ParcelData.Category = (byte) landData.category;
95 updatePacket.ParcelData.ClaimDate = landData.claimDate; 98 updatePacket.ParcelData.ClaimDate = landData.claimDate;
96 updatePacket.ParcelData.ClaimPrice = landData.claimPrice; 99 updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
97 updatePacket.ParcelData.GroupID = landData.groupID; 100 updatePacket.ParcelData.GroupID = landData.groupID;
98 updatePacket.ParcelData.GroupPrims = landData.groupPrims; 101 updatePacket.ParcelData.GroupPrims = landData.groupPrims;
99 updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; 102 updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
100 updatePacket.ParcelData.LandingType = (byte)landData.landingType; 103 updatePacket.ParcelData.LandingType = (byte) landData.landingType;
101 updatePacket.ParcelData.LocalID = landData.localID; 104 updatePacket.ParcelData.LocalID = landData.localID;
102 if (landData.area > 0) 105 if (landData.area > 0)
103 { 106 {
104 updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); 107 updatePacket.ParcelData.MaxPrims =
108 Convert.ToInt32(
109 Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000*
110 Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
105 } 111 }
106 else 112 else
107 { 113 {
@@ -122,22 +128,29 @@ namespace OpenSim.Region.Environment.LandManagement
122 updatePacket.ParcelData.PassHours = landData.passHours; 128 updatePacket.ParcelData.PassHours = landData.passHours;
123 updatePacket.ParcelData.PassPrice = landData.passPrice; 129 updatePacket.ParcelData.PassPrice = landData.passPrice;
124 updatePacket.ParcelData.PublicCount = 0; //unemplemented 130 updatePacket.ParcelData.PublicCount = 0; //unemplemented
125 131
126 uint regionFlags = (uint)m_scene.RegionInfo.estateSettings.regionFlags; 132 uint regionFlags = (uint) m_scene.RegionInfo.estateSettings.regionFlags;
127 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0); 133 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
128 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0); 134 0);
129 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0); 135 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
130 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0); 136 0);
131 137 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
138 0);
139 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
140 0);
141
132 updatePacket.ParcelData.RentPrice = 0; 142 updatePacket.ParcelData.RentPrice = 0;
133 updatePacket.ParcelData.RequestResult = request_result; 143 updatePacket.ParcelData.RequestResult = request_result;
134 updatePacket.ParcelData.SalePrice = landData.salePrice; 144 updatePacket.ParcelData.SalePrice = landData.salePrice;
135 updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; 145 updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
136 updatePacket.ParcelData.SelfCount = 0;//unemplemented 146 updatePacket.ParcelData.SelfCount = 0; //unemplemented
137 updatePacket.ParcelData.SequenceID = sequence_id; 147 updatePacket.ParcelData.SequenceID = sequence_id;
138 if (landData.simwideArea > 0) 148 if (landData.simwideArea > 0)
139 { 149 {
140 updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); 150 updatePacket.ParcelData.SimWideMaxPrims =
151 Convert.ToInt32(
152 Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000*
153 Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
141 } 154 }
142 else 155 else
143 { 156 {
@@ -146,11 +159,12 @@ namespace OpenSim.Region.Environment.LandManagement
146 updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; 159 updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
147 updatePacket.ParcelData.SnapSelection = snap_selection; 160 updatePacket.ParcelData.SnapSelection = snap_selection;
148 updatePacket.ParcelData.SnapshotID = landData.snapshotID; 161 updatePacket.ParcelData.SnapshotID = landData.snapshotID;
149 updatePacket.ParcelData.Status = (byte)landData.landStatus; 162 updatePacket.ParcelData.Status = (byte) landData.landStatus;
150 updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + landData.selectedPrims; 163 updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
164 landData.selectedPrims;
151 updatePacket.ParcelData.UserLocation = landData.userLocation; 165 updatePacket.ParcelData.UserLocation = landData.userLocation;
152 updatePacket.ParcelData.UserLookAt = landData.userLookAt; 166 updatePacket.ParcelData.UserLookAt = landData.userLookAt;
153 remote_client.OutPacket((Packet)updatePacket); 167 remote_client.OutPacket((Packet) updatePacket);
154 } 168 }
155 169
156 public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) 170 public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
@@ -159,7 +173,7 @@ namespace OpenSim.Region.Environment.LandManagement
159 { 173 {
160 //Needs later group support 174 //Needs later group support
161 landData.authBuyerID = packet.ParcelData.AuthBuyerID; 175 landData.authBuyerID = packet.ParcelData.AuthBuyerID;
162 landData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; 176 landData.category = (Parcel.ParcelCategory) packet.ParcelData.Category;
163 landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); 177 landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
164 landData.groupID = packet.ParcelData.GroupID; 178 landData.groupID = packet.ParcelData.GroupID;
165 landData.landingType = packet.ParcelData.LandingType; 179 landData.landingType = packet.ParcelData.LandingType;
@@ -176,8 +190,6 @@ namespace OpenSim.Region.Environment.LandManagement
176 landData.userLocation = packet.ParcelData.UserLocation; 190 landData.userLocation = packet.ParcelData.UserLocation;
177 landData.userLookAt = packet.ParcelData.UserLookAt; 191 landData.userLookAt = packet.ParcelData.UserLookAt;
178 sendLandUpdateToAvatarsOverMe(); 192 sendLandUpdateToAvatarsOverMe();
179
180
181 } 193 }
182 } 194 }
183 195
@@ -186,17 +198,20 @@ namespace OpenSim.Region.Environment.LandManagement
186 List<ScenePresence> avatars = m_scene.RequestAvatarList(); 198 List<ScenePresence> avatars = m_scene.RequestAvatarList();
187 for (int i = 0; i < avatars.Count; i++) 199 for (int i = 0; i < avatars.Count; i++)
188 { 200 {
189 Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].AbsolutePosition.X), (int)Math.Round(avatars[i].AbsolutePosition.Y)); 201 Land over =
190 if (over.landData.localID == this.landData.localID) 202 m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X),
203 (int) Math.Round(avatars[i].AbsolutePosition.Y));
204 if (over.landData.localID == landData.localID)
191 { 205 {
192 sendLandProperties(0, false, 0, avatars[i].ControllingClient); 206 sendLandProperties(0, false, 0, avatars[i].ControllingClient);
193 } 207 }
194 } 208 }
195 } 209 }
196 #endregion
197 210
211 #endregion
198 212
199 #region Update Functions 213 #region Update Functions
214
200 /// <summary> 215 /// <summary>
201 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object 216 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object
202 /// </summary> 217 /// </summary>
@@ -222,8 +237,12 @@ namespace OpenSim.Region.Environment.LandManagement
222 } 237 }
223 } 238 }
224 } 239 }
225 landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_scene.Terrain.GetHeight((min_x * 4), (min_y * 4))); 240 landData.AABBMin =
226 landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_scene.Terrain.GetHeight((max_x * 4), (max_y * 4))); 241 new LLVector3((float) (min_x*4), (float) (min_y*4),
242 (float) m_scene.Terrain.GetHeight((min_x*4), (min_y*4)));
243 landData.AABBMax =
244 new LLVector3((float) (max_x*4), (float) (max_y*4),
245 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4)));
227 landData.area = tempArea; 246 landData.area = tempArea;
228 } 247 }
229 248
@@ -237,18 +256,19 @@ namespace OpenSim.Region.Environment.LandManagement
237 /// </summary> 256 /// </summary>
238 public void forceUpdateLandInfo() 257 public void forceUpdateLandInfo()
239 { 258 {
240 this.updateAABBAndAreaValues(); 259 updateAABBAndAreaValues();
241 this.updateLandBitmapByteArray(); 260 updateLandBitmapByteArray();
242 } 261 }
243 262
244 public void setLandBitmapFromByteArray() 263 public void setLandBitmapFromByteArray()
245 { 264 {
246 landBitmap = convertBytesToLandBitmap(); 265 landBitmap = convertBytesToLandBitmap();
247 } 266 }
248 #endregion
249 267
268 #endregion
250 269
251 #region Land Bitmap Functions 270 #region Land Bitmap Functions
271
252 /// <summary> 272 /// <summary>
253 /// Sets the land's bitmap manually 273 /// Sets the land's bitmap manually
254 /// </summary> 274 /// </summary>
@@ -265,9 +285,9 @@ namespace OpenSim.Region.Environment.LandManagement
265 //Valid: Lets set it 285 //Valid: Lets set it
266 landBitmap = bitmap; 286 landBitmap = bitmap;
267 forceUpdateLandInfo(); 287 forceUpdateLandInfo();
268
269 } 288 }
270 } 289 }
290
271 /// <summary> 291 /// <summary>
272 /// Gets the land's bitmap manually 292 /// Gets the land's bitmap manually
273 /// </summary> 293 /// </summary>
@@ -276,6 +296,7 @@ namespace OpenSim.Region.Environment.LandManagement
276 { 296 {
277 return landBitmap; 297 return landBitmap;
278 } 298 }
299
279 /// <summary> 300 /// <summary>
280 /// Converts the land bitmap to a packet friendly byte array 301 /// Converts the land bitmap to a packet friendly byte array
281 /// </summary> 302 /// </summary>
@@ -290,11 +311,11 @@ namespace OpenSim.Region.Environment.LandManagement
290 { 311 {
291 for (x = 0; x < 64; x++) 312 for (x = 0; x < 64; x++)
292 { 313 {
293 tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); 314 tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8));
294 if (i % 8 == 0) 315 if (i%8 == 0)
295 { 316 {
296 tempConvertArr[byteNum] = tempByte; 317 tempConvertArr[byteNum] = tempByte;
297 tempByte = (byte)0; 318 tempByte = (byte) 0;
298 i = 0; 319 i = 0;
299 byteNum++; 320 byteNum++;
300 } 321 }
@@ -305,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement
305 326
306 private bool[,] convertBytesToLandBitmap() 327 private bool[,] convertBytesToLandBitmap()
307 { 328 {
308 bool[,] tempConvertMap = new bool[64, 64]; 329 bool[,] tempConvertMap = new bool[64,64];
309 tempConvertMap.Initialize(); 330 tempConvertMap.Initialize();
310 byte tempByte = 0; 331 byte tempByte = 0;
311 int x = 0, y = 0, i = 0, bitNum = 0; 332 int x = 0, y = 0, i = 0, bitNum = 0;
@@ -314,7 +335,7 @@ namespace OpenSim.Region.Environment.LandManagement
314 tempByte = landData.landBitmapByteArray[i]; 335 tempByte = landData.landBitmapByteArray[i];
315 for (bitNum = 0; bitNum < 8; bitNum++) 336 for (bitNum = 0; bitNum < 8; bitNum++)
316 { 337 {
317 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); 338 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
318 tempConvertMap[x, y] = bit; 339 tempConvertMap[x, y] = bit;
319 x++; 340 x++;
320 if (x > 63) 341 if (x > 63)
@@ -322,12 +343,11 @@ namespace OpenSim.Region.Environment.LandManagement
322 x = 0; 343 x = 0;
323 y++; 344 y++;
324 } 345 }
325
326 } 346 }
327
328 } 347 }
329 return tempConvertMap; 348 return tempConvertMap;
330 } 349 }
350
331 /// <summary> 351 /// <summary>
332 /// Full sim land object creation 352 /// Full sim land object creation
333 /// </summary> 353 /// </summary>
@@ -347,8 +367,7 @@ namespace OpenSim.Region.Environment.LandManagement
347 /// <returns></returns> 367 /// <returns></returns>
348 public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 368 public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
349 { 369 {
350 370 bool[,] tempBitmap = new bool[64,64];
351 bool[,] tempBitmap = new bool[64, 64];
352 tempBitmap.Initialize(); 371 tempBitmap.Initialize();
353 372
354 tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 373 tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
@@ -365,7 +384,8 @@ namespace OpenSim.Region.Environment.LandManagement
365 /// <param name="end_y"></param> 384 /// <param name="end_y"></param>
366 /// <param name="set_value"></param> 385 /// <param name="set_value"></param>
367 /// <returns></returns> 386 /// <returns></returns>
368 public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) 387 public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
388 bool set_value)
369 { 389 {
370 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) 390 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
371 { 391 {
@@ -378,8 +398,8 @@ namespace OpenSim.Region.Environment.LandManagement
378 { 398 {
379 for (x = 0; x < 64; x++) 399 for (x = 0; x < 64; x++)
380 { 400 {
381 if (x >= start_x / 4 && x < end_x / 4 401 if (x >= start_x/4 && x < end_x/4
382 && y >= start_y / 4 && y < end_y / 4) 402 && y >= start_y/4 && y < end_y/4)
383 { 403 {
384 land_bitmap[x, y] = set_value; 404 land_bitmap[x, y] = set_value;
385 } 405 }
@@ -387,6 +407,7 @@ namespace OpenSim.Region.Environment.LandManagement
387 } 407 }
388 return land_bitmap; 408 return land_bitmap;
389 } 409 }
410
390 /// <summary> 411 /// <summary>
391 /// Join the true values of 2 bitmaps together 412 /// Join the true values of 2 bitmaps together
392 /// </summary> 413 /// </summary>
@@ -404,7 +425,6 @@ namespace OpenSim.Region.Environment.LandManagement
404 { 425 {
405 //Throw an exception - The bitmap is not 64x64 426 //Throw an exception - The bitmap is not 64x64
406 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); 427 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps");
407
408 } 428 }
409 429
410 int x, y; 430 int x, y;
@@ -420,9 +440,11 @@ namespace OpenSim.Region.Environment.LandManagement
420 } 440 }
421 return bitmap_base; 441 return bitmap_base;
422 } 442 }
443
423 #endregion 444 #endregion
424 445
425 #region Object Select and Object Owner Listing 446 #region Object Select and Object Owner Listing
447
426 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) 448 public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
427 { 449 {
428 List<uint> resultLocalIDs = new List<uint>(); 450 List<uint> resultLocalIDs = new List<uint>();
@@ -430,15 +452,16 @@ namespace OpenSim.Region.Environment.LandManagement
430 { 452 {
431 if (obj.LocalId > 0) 453 if (obj.LocalId > 0)
432 { 454 {
433 if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == this.landData.ownerID) 455 if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID)
434 { 456 {
435 resultLocalIDs.Add(obj.LocalId); 457 resultLocalIDs.Add(obj.LocalId);
436 } 458 }
437 else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! 459 else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false)
460 //TODO: change false to group support!
438 { 461 {
439
440 } 462 }
441 else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && obj.OwnerID != remote_client.AgentId) 463 else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER &&
464 obj.OwnerID != remote_client.AgentId)
442 { 465 {
443 resultLocalIDs.Add(obj.LocalId); 466 resultLocalIDs.Add(obj.LocalId);
444 } 467 }
@@ -479,10 +502,10 @@ namespace OpenSim.Region.Environment.LandManagement
479 resultLocalIDs.RemoveAt(0); 502 resultLocalIDs.RemoveAt(0);
480 } 503 }
481 pack.Data = data; 504 pack.Data = data;
482 remote_client.OutPacket((Packet)pack); 505 remote_client.OutPacket((Packet) pack);
483 } 506 }
484
485 } 507 }
508
486 public void sendLandObjectOwners(IClientAPI remote_client) 509 public void sendLandObjectOwners(IClientAPI remote_client)
487 { 510 {
488 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); 511 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
@@ -496,7 +519,6 @@ namespace OpenSim.Region.Environment.LandManagement
496 } 519 }
497 if (ownersAndCount.Count > 0) 520 if (ownersAndCount.Count > 0)
498 { 521 {
499
500 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; 522 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
501 523
502 if (ownersAndCount.Count < 32) 524 if (ownersAndCount.Count < 32)
@@ -522,19 +544,23 @@ namespace OpenSim.Region.Environment.LandManagement
522 remote_client.OutPacket(pack); 544 remote_client.OutPacket(pack);
523 } 545 }
524 } 546 }
547
525 #endregion 548 #endregion
526 549
527 #region Object Returning 550 #region Object Returning
551
528 public void returnObject(SceneObjectGroup obj) 552 public void returnObject(SceneObjectGroup obj)
529 { 553 {
530 } 554 }
555
531 public void returnLandObjects(int type, LLUUID owner) 556 public void returnLandObjects(int type, LLUUID owner)
532 { 557 {
533
534 } 558 }
559
535 #endregion 560 #endregion
536 561
537 #region Object Adding/Removing from Parcel 562 #region Object Adding/Removing from Parcel
563
538 public void resetLandPrimCounts() 564 public void resetLandPrimCounts()
539 { 565 {
540 landData.groupPrims = 0; 566 landData.groupPrims = 0;
@@ -566,7 +592,6 @@ namespace OpenSim.Region.Environment.LandManagement
566 } 592 }
567 593
568 primsOverMe.Add(obj); 594 primsOverMe.Add(obj);
569
570 } 595 }
571 596
572 public void removePrimFromCount(SceneObjectGroup obj) 597 public void removePrimFromCount(SceneObjectGroup obj)
@@ -592,11 +617,11 @@ namespace OpenSim.Region.Environment.LandManagement
592 primsOverMe.Remove(obj); 617 primsOverMe.Remove(obj);
593 } 618 }
594 } 619 }
595 #endregion
596 620
597 #endregion 621 #endregion
598 622
599 623 #endregion
600 } 624 }
625
601 #endregion 626 #endregion
602} 627} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 8e49811..843c0f5 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -36,34 +36,34 @@ using OpenSim.Region.Environment.Scenes;
36namespace OpenSim.Region.Environment.LandManagement 36namespace OpenSim.Region.Environment.LandManagement
37{ 37{
38 38
39
40 #region LandManager Class 39 #region LandManager Class
40
41 /// <summary> 41 /// <summary>
42 /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) 42 /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc)
43 /// </summary> 43 /// </summary>
44 public class LandManager 44 public class LandManager
45 { 45 {
46
47 #region Constants 46 #region Constants
47
48 //Land types set with flags in ParcelOverlay. 48 //Land types set with flags in ParcelOverlay.
49 //Only one of these can be used. 49 //Only one of these can be used.
50 public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000 50 public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
51 public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 51 public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
52 public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 52 public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
53 public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 53 public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
54 public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 54 public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
55 public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 55 public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
56 56
57 57
58 //Flags that when set, a border on the given side will be placed 58 //Flags that when set, a border on the given side will be placed
59 //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) 59 //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc)
60 //This took forever to figure out -- jeesh. /blame LL for even having to send these 60 //This took forever to figure out -- jeesh. /blame LL for even having to send these
61 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 61 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
62 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 62 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
63 63
64 //RequestResults (I think these are right, they seem to work): 64 //RequestResults (I think these are right, they seem to work):
65 public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land 65 public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
66 public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land 66 public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
67 67
68 //ParcelSelectObjects 68 //ParcelSelectObjects
69 public const int LAND_SELECT_OBJECTS_OWNER = 2; 69 public const int LAND_SELECT_OBJECTS_OWNER = 2;
@@ -73,12 +73,14 @@ namespace OpenSim.Region.Environment.LandManagement
73 73
74 //These are other constants. Yay! 74 //These are other constants. Yay!
75 public const int START_LAND_LOCAL_ID = 1; 75 public const int START_LAND_LOCAL_ID = 1;
76
76 #endregion 77 #endregion
77 78
78 #region Member Variables 79 #region Member Variables
80
79 public Dictionary<int, Land> landList = new Dictionary<int, Land>(); 81 public Dictionary<int, Land> landList = new Dictionary<int, Land>();
80 private int lastLandLocalID = START_LAND_LOCAL_ID - 1; 82 private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
81 private int[,] landIDList = new int[64, 64]; 83 private int[,] landIDList = new int[64,64];
82 84
83 /// <summary> 85 /// <summary>
84 /// Set to true when a prim is moved, created, added. Performs a prim count update 86 /// Set to true when a prim is moved, created, added. Performs a prim count update
@@ -91,35 +93,37 @@ namespace OpenSim.Region.Environment.LandManagement
91 #endregion 93 #endregion
92 94
93 #region Constructors 95 #region Constructors
96
94 public LandManager(Scene scene, RegionInfo reginfo) 97 public LandManager(Scene scene, RegionInfo reginfo)
95 { 98 {
96
97 m_scene = scene; 99 m_scene = scene;
98 m_regInfo = reginfo; 100 m_regInfo = reginfo;
99 landIDList.Initialize(); 101 landIDList.Initialize();
100
101 } 102 }
103
102 #endregion 104 #endregion
103 105
104 #region Member Functions 106 #region Member Functions
105 107
106 #region Parcel From Storage Functions 108 #region Parcel From Storage Functions
109
107 public void LandFromStorage(LandData data) 110 public void LandFromStorage(LandData data)
108 { 111 {
109 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); 112 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
110 new_land.landData = data.Copy(); 113 new_land.landData = data.Copy();
111 new_land.setLandBitmapFromByteArray(); 114 new_land.setLandBitmapFromByteArray();
112 addLandObject(new_land); 115 addLandObject(new_land);
113
114 } 116 }
115 117
116 public void NoLandDataFromStorage() 118 public void NoLandDataFromStorage()
117 { 119 {
118 resetSimLandObjects(); 120 resetSimLandObjects();
119 } 121 }
122
120 #endregion 123 #endregion
121 124
122 #region Parcel Add/Remove/Get/Create 125 #region Parcel Add/Remove/Get/Create
126
123 /// <summary> 127 /// <summary>
124 /// Creates a basic Parcel object without an owner (a zeroed key) 128 /// Creates a basic Parcel object without an owner (a zeroed key)
125 /// </summary> 129 /// </summary>
@@ -155,8 +159,8 @@ namespace OpenSim.Region.Environment.LandManagement
155 landList[lastLandLocalID].forceUpdateLandInfo(); 159 landList[lastLandLocalID].forceUpdateLandInfo();
156 160
157 return new_land; 161 return new_land;
158
159 } 162 }
163
160 /// <summary> 164 /// <summary>
161 /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList 165 /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList
162 /// </summary> 166 /// </summary>
@@ -194,6 +198,7 @@ namespace OpenSim.Region.Environment.LandManagement
194 } 198 }
195 removeLandObject(slave.landData.localID); 199 removeLandObject(slave.landData.localID);
196 } 200 }
201
197 /// <summary> 202 /// <summary>
198 /// Get the land object at the specified point 203 /// Get the land object at the specified point
199 /// </summary> 204 /// </summary>
@@ -202,16 +207,16 @@ namespace OpenSim.Region.Environment.LandManagement
202 /// <returns>Land object at the point supplied</returns> 207 /// <returns>Land object at the point supplied</returns>
203 public Land getLandObject(float x_float, float y_float) 208 public Land getLandObject(float x_float, float y_float)
204 { 209 {
205 int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); 210 int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0)));
206 int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); 211 int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0)));
207 212
208 if (x > 63 || y > 63 || x < 0 || y < 0) 213 if (x > 63 || y > 63 || x < 0 || y < 0)
209 { 214 {
210 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 215 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
211 } 216 }
212 else 217 else
213 { 218 {
214 // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); 219 // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
215 return landList[landIDList[x, y]]; 220 return landList[landIDList[x, y]];
216 } 221 }
217 } 222 }
@@ -224,12 +229,14 @@ namespace OpenSim.Region.Environment.LandManagement
224 } 229 }
225 else 230 else
226 { 231 {
227 return landList[landIDList[x / 4, y / 4]]; 232 return landList[landIDList[x/4, y/4]];
228 } 233 }
229 } 234 }
235
230 #endregion 236 #endregion
231 237
232 #region Parcel Modification 238 #region Parcel Modification
239
233 /// <summary> 240 /// <summary>
234 /// Subdivides a piece of land 241 /// Subdivides a piece of land
235 /// </summary> 242 /// </summary>
@@ -241,7 +248,6 @@ namespace OpenSim.Region.Environment.LandManagement
241 /// <returns>Returns true if successful</returns> 248 /// <returns>Returns true if successful</returns>
242 private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) 249 private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
243 { 250 {
244
245 //First, lets loop through the points and make sure they are all in the same peice of land 251 //First, lets loop through the points and make sure they are all in the same peice of land
246 //Get the land object at start 252 //Get the land object at start
247 Land startLandObject = getLandObject(start_x, start_y); 253 Land startLandObject = getLandObject(start_x, start_y);
@@ -284,21 +290,21 @@ namespace OpenSim.Region.Environment.LandManagement
284 290
285 //Now, lets set the subdivision area of the original to false 291 //Now, lets set the subdivision area of the original to false
286 int startLandObjectIndex = startLandObject.landData.localID; 292 int startLandObjectIndex = startLandObject.landData.localID;
287 landList[startLandObjectIndex].setLandBitmap(Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); 293 landList[startLandObjectIndex].setLandBitmap(
294 Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false));
288 landList[startLandObjectIndex].forceUpdateLandInfo(); 295 landList[startLandObjectIndex].forceUpdateLandInfo();
289 296
290 297
291 this.setPrimsTainted(); 298 setPrimsTainted();
292 299
293 //Now add the new land object 300 //Now add the new land object
294 Land result = addLandObject(newLand); 301 Land result = addLandObject(newLand);
295 result.sendLandUpdateToAvatarsOverMe(); 302 result.sendLandUpdateToAvatarsOverMe();
296 303
297 304
298
299
300 return true; 305 return true;
301 } 306 }
307
302 /// <summary> 308 /// <summary>
303 /// Join 2 land objects together 309 /// Join 2 land objects together
304 /// </summary> 310 /// </summary>
@@ -320,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement
320 { 326 {
321 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) 327 for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
322 { 328 {
323 Land p = getLandObject(stepXSelected,stepYSelected); 329 Land p = getLandObject(stepXSelected, stepYSelected);
324 if (!selectedLandObjects.Contains(p)) 330 if (!selectedLandObjects.Contains(p))
325 { 331 {
326 selectedLandObjects.Add(p); 332 selectedLandObjects.Add(p);
@@ -330,7 +336,7 @@ namespace OpenSim.Region.Environment.LandManagement
330 Land masterLandObject = selectedLandObjects[0]; 336 Land masterLandObject = selectedLandObjects[0];
331 selectedLandObjects.RemoveAt(0); 337 selectedLandObjects.RemoveAt(0);
332 338
333 339
334 if (selectedLandObjects.Count < 1) 340 if (selectedLandObjects.Count < 1)
335 { 341 {
336 return false; //Only one piece of land selected 342 return false; //Only one piece of land selected
@@ -348,23 +354,23 @@ namespace OpenSim.Region.Environment.LandManagement
348 } 354 }
349 foreach (Land slaveLandObject in selectedLandObjects) 355 foreach (Land slaveLandObject in selectedLandObjects)
350 { 356 {
351 landList[masterLandObject.landData.localID].setLandBitmap(Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); 357 landList[masterLandObject.landData.localID].setLandBitmap(
358 Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap()));
352 performFinalLandJoin(masterLandObject, slaveLandObject); 359 performFinalLandJoin(masterLandObject, slaveLandObject);
353 } 360 }
354 361
355 362
356 this.setPrimsTainted(); 363 setPrimsTainted();
357 364
358 masterLandObject.sendLandUpdateToAvatarsOverMe(); 365 masterLandObject.sendLandUpdateToAvatarsOverMe();
359 366
360 return true; 367 return true;
361
362
363
364 } 368 }
369
365 #endregion 370 #endregion
366 371
367 #region Parcel Updating 372 #region Parcel Updating
373
368 /// <summary> 374 /// <summary>
369 /// Where we send the ParcelOverlay packet to the client 375 /// Where we send the ParcelOverlay packet to the client
370 /// </summary> 376 /// </summary>
@@ -382,15 +388,17 @@ namespace OpenSim.Region.Environment.LandManagement
382 { 388 {
383 for (x = 0; x < 64; x++) 389 for (x = 0; x < 64; x++)
384 { 390 {
385 byte tempByte = (byte)0; //This represents the byte for the current 4x4 391 byte tempByte = (byte) 0; //This represents the byte for the current 4x4
386 Land currentParcelBlock = getLandObject(x * 4, y * 4); 392 Land currentParcelBlock = getLandObject(x*4, y*4);
387 393
388 if (currentParcelBlock.landData.ownerID == remote_client.AgentId) 394 if (currentParcelBlock.landData.ownerID == remote_client.AgentId)
389 { 395 {
390 //Owner Flag 396 //Owner Flag
391 tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); 397 tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER);
392 } 398 }
393 else if (currentParcelBlock.landData.salePrice > 0 && (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) 399 else if (currentParcelBlock.landData.salePrice > 0 &&
400 (currentParcelBlock.landData.authBuyerID == LLUUID.Zero ||
401 currentParcelBlock.landData.authBuyerID == remote_client.AgentId))
394 { 402 {
395 //Sale Flag 403 //Sale Flag
396 tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); 404 tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE);
@@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.LandManagement
412 { 420 {
413 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); 421 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
414 } 422 }
415 else if (getLandObject((x - 1) * 4, y * 4) != currentParcelBlock) 423 else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock)
416 { 424 {
417 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); 425 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST);
418 } 426 }
@@ -421,7 +429,7 @@ namespace OpenSim.Region.Environment.LandManagement
421 { 429 {
422 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); 430 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
423 } 431 }
424 else if (getLandObject(x * 4, (y - 1) * 4) != currentParcelBlock) 432 else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock)
425 { 433 {
426 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); 434 tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH);
427 } 435 }
@@ -434,17 +442,16 @@ namespace OpenSim.Region.Environment.LandManagement
434 packet = new ParcelOverlayPacket(); 442 packet = new ParcelOverlayPacket();
435 packet.ParcelData.Data = byteArray; 443 packet.ParcelData.Data = byteArray;
436 packet.ParcelData.SequenceID = sequenceID; 444 packet.ParcelData.SequenceID = sequenceID;
437 remote_client.OutPacket((Packet)packet); 445 remote_client.OutPacket((Packet) packet);
438 sequenceID++; 446 sequenceID++;
439 byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 447 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
440 } 448 }
441 } 449 }
442 } 450 }
443
444
445 } 451 }
446 452
447 public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) 453 public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
454 bool snap_selection, IClientAPI remote_client)
448 { 455 {
449 //Get the land objects within the bounds 456 //Get the land objects within the bounds
450 List<Land> temp = new List<Land>(); 457 List<Land> temp = new List<Land>();
@@ -486,14 +493,15 @@ namespace OpenSim.Region.Environment.LandManagement
486 landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); 493 landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client);
487 } 494 }
488 } 495 }
496
489 public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 497 public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
490 { 498 {
491 subdivide(west, south, east, north, remote_client.AgentId); 499 subdivide(west, south, east, north, remote_client.AgentId);
492 } 500 }
501
493 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) 502 public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
494 { 503 {
495 join(west, south, east, north, remote_client.AgentId); 504 join(west, south, east, north, remote_client.AgentId);
496
497 } 505 }
498 506
499 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) 507 public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client)
@@ -505,6 +513,7 @@ namespace OpenSim.Region.Environment.LandManagement
505 { 513 {
506 landList[local_id].sendLandObjectOwners(remote_client); 514 landList[local_id].sendLandObjectOwners(remote_client);
507 } 515 }
516
508 #endregion 517 #endregion
509 518
510 /// <summary> 519 /// <summary>
@@ -523,7 +532,6 @@ namespace OpenSim.Region.Environment.LandManagement
523 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; 532 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
524 533
525 addLandObject(fullSimParcel); 534 addLandObject(fullSimParcel);
526
527 } 535 }
528 536
529 537
@@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.LandManagement
532 ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); 540 ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
533 if (clientAvatar != null) 541 if (clientAvatar != null)
534 { 542 {
535 Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y); 543 Land over = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
536 if (over != null) 544 if (over != null)
537 { 545 {
538 over.sendLandProperties(0, false, 0, remote_client); 546 over.sendLandProperties(0, false, 0, remote_client);
@@ -547,9 +555,10 @@ namespace OpenSim.Region.Environment.LandManagement
547 p.resetLandPrimCounts(); 555 p.resetLandPrimCounts();
548 } 556 }
549 } 557 }
558
550 public void setPrimsTainted() 559 public void setPrimsTainted()
551 { 560 {
552 this.landPrimCountTainted = true; 561 landPrimCountTainted = true;
553 } 562 }
554 563
555 public void addPrimToLandPrimCounts(SceneObjectGroup obj) 564 public void addPrimToLandPrimCounts(SceneObjectGroup obj)
@@ -573,14 +582,14 @@ namespace OpenSim.Region.Environment.LandManagement
573 public void finalizeLandPrimCountUpdate() 582 public void finalizeLandPrimCountUpdate()
574 { 583 {
575 //Get Simwide prim count for owner 584 //Get Simwide prim count for owner
576 Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID,List<Land>>(); 585 Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID, List<Land>>();
577 foreach (Land p in landList.Values) 586 foreach (Land p in landList.Values)
578 { 587 {
579 if(!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) 588 if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
580 { 589 {
581 List<Land> tempList = new List<Land>(); 590 List<Land> tempList = new List<Land>();
582 tempList.Add(p); 591 tempList.Add(p);
583 landOwnersAndParcels.Add(p.landData.ownerID,tempList); 592 landOwnersAndParcels.Add(p.landData.ownerID, tempList);
584 } 593 }
585 else 594 else
586 { 595 {
@@ -595,7 +604,8 @@ namespace OpenSim.Region.Environment.LandManagement
595 foreach (Land p in landOwnersAndParcels[owner]) 604 foreach (Land p in landOwnersAndParcels[owner])
596 { 605 {
597 simArea += p.landData.area; 606 simArea += p.landData.area;
598 simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + p.landData.selectedPrims; 607 simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
608 p.landData.selectedPrims;
599 } 609 }
600 610
601 foreach (Land p in landOwnersAndParcels[owner]) 611 foreach (Land p in landOwnersAndParcels[owner])
@@ -604,14 +614,10 @@ namespace OpenSim.Region.Environment.LandManagement
604 p.landData.simwidePrims = simPrims; 614 p.landData.simwidePrims = simPrims;
605 } 615 }
606 } 616 }
607
608 } 617 }
618
609 #endregion 619 #endregion
610 } 620 }
611 #endregion
612
613
614
615 621
616 622 #endregion
617} 623} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 5e27f50..34cc383 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -1,25 +1,22 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Reflection; 3using System.IO;
4using System.Text; 4using System.Reflection;
5using OpenSim.Framework.Console; 5using OpenSim.Region.Environment.Interfaces;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Modules;
7using OpenSim.Region.Environment.Interfaces; 7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.Modules; 8
9
10namespace OpenSim.Region.Environment 9namespace OpenSim.Region.Environment
11{ 10{
12 public class ModuleLoader 11 public class ModuleLoader
13 { 12 {
14
15 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 13 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
16 14
17 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 15 public List<IRegionModule> LoadedModules = new List<IRegionModule>();
18 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 16 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
19
20 public ModuleLoader()
21 {
22 17
18 public ModuleLoader()
19 {
23 } 20 }
24 21
25 /// <summary> 22 /// <summary>
@@ -28,32 +25,31 @@ namespace OpenSim.Region.Environment
28 /// <param name="scene"></param> 25 /// <param name="scene"></param>
29 public void CreateDefaultModules(Scene scene, string exceptModules) 26 public void CreateDefaultModules(Scene scene, string exceptModules)
30 { 27 {
31 IRegionModule module = new XferModule(); 28 IRegionModule module = new XferModule();
32 InitialiseModule(module, scene); 29 InitialiseModule(module, scene);
33 30
34 module = new ChatModule(); 31 module = new ChatModule();
35 InitialiseModule(module, scene); 32 InitialiseModule(module, scene);
36 33
37 module = new AvatarProfilesModule(); 34 module = new AvatarProfilesModule();
38 InitialiseModule(module, scene); 35 InitialiseModule(module, scene);
39 36
40 this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); 37 LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
41
42 string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
43 this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
44 38
39 string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
40 LoadRegionModule(lslPath, "LSLScriptingModule", scene);
45 } 41 }
46 42
47 43
48 public void LoadDefaultSharedModules(string exceptModules) 44 public void LoadDefaultSharedModules(string exceptModules)
49 { 45 {
50 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 46 DynamicTextureModule dynamicModule = new DynamicTextureModule();
51 this.LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); 47 LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
52 } 48 }
53 49
54 public void InitialiseSharedModules(Scene scene) 50 public void InitialiseSharedModules(Scene scene)
55 { 51 {
56 foreach (IRegionModule module in this.LoadedSharedModules.Values) 52 foreach (IRegionModule module in LoadedSharedModules.Values)
57 { 53 {
58 module.Initialise(scene); 54 module.Initialise(scene);
59 scene.AddModule(module.GetName(), module); //should be doing this? 55 scene.AddModule(module.GetName(), module); //should be doing this?
@@ -75,19 +71,19 @@ namespace OpenSim.Region.Environment
75 /// <param name="scene"></param> 71 /// <param name="scene"></param>
76 public void LoadSharedModule(string dllName, string moduleName) 72 public void LoadSharedModule(string dllName, string moduleName)
77 { 73 {
78 IRegionModule module = this.LoadModule(dllName, moduleName); 74 IRegionModule module = LoadModule(dllName, moduleName);
79 if (module != null) 75 if (module != null)
80 { 76 {
81 this.LoadedSharedModules.Add(module.GetName(), module); 77 LoadedSharedModules.Add(module.GetName(), module);
82 } 78 }
83 } 79 }
84 80
85 public void LoadRegionModule(string dllName, string moduleName, Scene scene) 81 public void LoadRegionModule(string dllName, string moduleName, Scene scene)
86 { 82 {
87 IRegionModule module = this.LoadModule(dllName, moduleName); 83 IRegionModule module = LoadModule(dllName, moduleName);
88 if (module != null) 84 if (module != null)
89 { 85 {
90 this.InitialiseModule(module, scene); 86 InitialiseModule(module, scene);
91 } 87 }
92 } 88 }
93 89
@@ -107,7 +103,7 @@ namespace OpenSim.Region.Environment
107 else 103 else
108 { 104 {
109 pluginAssembly = Assembly.LoadFrom(dllName); 105 pluginAssembly = Assembly.LoadFrom(dllName);
110 this.LoadedAssemblys.Add(dllName, pluginAssembly); 106 LoadedAssemblys.Add(dllName, pluginAssembly);
111 } 107 }
112 108
113 IRegionModule module = null; 109 IRegionModule module = null;
@@ -121,7 +117,8 @@ namespace OpenSim.Region.Environment
121 117
122 if (typeInterface != null) 118 if (typeInterface != null)
123 { 119 {
124 module = (IRegionModule)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 120 module =
121 (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
125 break; 122 break;
126 } 123 }
127 typeInterface = null; 124 typeInterface = null;
@@ -130,23 +127,22 @@ namespace OpenSim.Region.Environment
130 } 127 }
131 pluginAssembly = null; 128 pluginAssembly = null;
132 129
133 if ((module != null ) || (module.GetName() == moduleName)) 130 if ((module != null) || (module.GetName() == moduleName))
134 { 131 {
135 return module; 132 return module;
136 } 133 }
137 134
138 return null; 135 return null;
139
140 } 136 }
141 137
142 public void PostInitialise() 138 public void PostInitialise()
143 { 139 {
144 foreach (IRegionModule module in this.LoadedSharedModules.Values) 140 foreach (IRegionModule module in LoadedSharedModules.Values)
145 { 141 {
146 module.PostInitialise(); 142 module.PostInitialise();
147 } 143 }
148 144
149 foreach (IRegionModule module in this.LoadedModules) 145 foreach (IRegionModule module in LoadedModules)
150 { 146 {
151 module.PostInitialise(); 147 module.PostInitialise();
152 } 148 }
@@ -154,7 +150,7 @@ namespace OpenSim.Region.Environment
154 150
155 public void ClearCache() 151 public void ClearCache()
156 { 152 {
157 this.LoadedAssemblys.Clear(); 153 LoadedAssemblys.Clear();
158 } 154 }
159 } 155 }
160} 156} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index 7a53f6f..511b5f6 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -1,12 +1,7 @@
1using System; 1using OpenSim.Framework.Interfaces;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Interfaces;
3using System.Text; 3using OpenSim.Region.Environment.Scenes;
4using libsecondlife; 4
5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9
10namespace OpenSim.Region.Environment.Modules 5namespace OpenSim.Region.Environment.Modules
11{ 6{
12 public class AssetDownloadModule : IRegionModule 7 public class AssetDownloadModule : IRegionModule
@@ -14,8 +9,7 @@ namespace OpenSim.Region.Environment.Modules
14 private Scene m_scene; 9 private Scene m_scene;
15 10
16 public AssetDownloadModule() 11 public AssetDownloadModule()
17 { 12 {
18
19 } 13 }
20 14
21 public void Initialise(Scene scene) 15 public void Initialise(Scene scene)
@@ -25,8 +19,7 @@ namespace OpenSim.Region.Environment.Modules
25 } 19 }
26 20
27 public void PostInitialise() 21 public void PostInitialise()
28 { 22 {
29
30 } 23 }
31 24
32 public void CloseDown() 25 public void CloseDown()
@@ -47,4 +40,4 @@ namespace OpenSim.Region.Environment.Modules
47 { 40 {
48 } 41 }
49 } 42 }
50} 43} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index c349888..ea5f787 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -1,21 +1,16 @@
1using System; 1using libsecondlife;
2using System.Collections.Generic; 2using OpenSim.Framework.Interfaces;
3using System.Text; 3using OpenSim.Region.Environment.Interfaces;
4using libsecondlife; 4using OpenSim.Region.Environment.Scenes;
5using OpenSim.Framework.Interfaces; 5
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9namespace OpenSim.Region.Environment.Modules 6namespace OpenSim.Region.Environment.Modules
10{ 7{
11 public class AvatarProfilesModule :IRegionModule 8 public class AvatarProfilesModule : IRegionModule
12 { 9 {
13
14 private Scene m_scene; 10 private Scene m_scene;
15 11
16 public AvatarProfilesModule() 12 public AvatarProfilesModule()
17 { 13 {
18
19 } 14 }
20 15
21 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
@@ -25,13 +20,11 @@ namespace OpenSim.Region.Environment.Modules
25 } 20 }
26 21
27 public void PostInitialise() 22 public void PostInitialise()
28 { 23 {
29
30 } 24 }
31 25
32 public void CloseDown() 26 public void CloseDown()
33 { 27 {
34
35 } 28 }
36 29
37 public string GetName() 30 public string GetName()
@@ -65,7 +58,8 @@ namespace OpenSim.Region.Environment.Modules
65 string bornOn = "Before now"; 58 string bornOn = "Before now";
66 string flAbout = "First life? What is one of those? OpenSim is my life!"; 59 string flAbout = "First life? What is one of those? OpenSim is my life!";
67 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 60 LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
68 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); 61 remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
62 partner);
69 } 63 }
70 } 64 }
71} 65} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 8d3a553..468a5b7 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -1,17 +1,13 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.IO;
3using System.Text; 3using System.Net.Sockets;
4using System.Net; 4using System.Threading;
5using System.Net.Sockets; 5using libsecondlife;
6using System.Threading; 6using OpenSim.Framework.Interfaces;
7using System.IO; 7using OpenSim.Framework.Utilities;
8using libsecondlife; 8using OpenSim.Region.Environment.Interfaces;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 10
11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Utilities;
13using OpenSim.Framework.Console;
14
15namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
16{ 12{
17 public class ChatModule : IRegionModule, ISimChat 13 public class ChatModule : IRegionModule, ISimChat
@@ -20,18 +16,18 @@ namespace OpenSim.Region.Environment.Modules
20 16
21 private string m_server = "irc2.choopa.net"; 17 private string m_server = "irc2.choopa.net";
22 18
23 // private int m_port = 6668; 19 // private int m_port = 6668;
24 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 20 //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
25 private string m_nick = "OSimBot"; 21 private string m_nick = "OSimBot";
26 private string m_channel = "#opensim"; 22 private string m_channel = "#opensim";
27 23
28 // private NetworkStream m_stream; 24 // private NetworkStream m_stream;
29 private TcpClient m_irc; 25 private TcpClient m_irc;
30 private StreamWriter m_ircWriter; 26 private StreamWriter m_ircWriter;
31 private StreamReader m_ircReader; 27 private StreamReader m_ircReader;
32 28
33 // private Thread pingSender; 29 // private Thread pingSender;
34 // private Thread listener; 30 // private Thread listener;
35 31
36 private bool connected = false; 32 private bool connected = false;
37 33
@@ -127,16 +123,18 @@ namespace OpenSim.Region.Environment.Modules
127 { 123 {
128 string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); 124 string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
129 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 125 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
130 { 126 {
131 presence.ControllingClient.SendChatMessage(Helpers.StringToField(mess), 255, pos, "IRC:", 127 presence.ControllingClient.SendChatMessage(
132 LLUUID.Zero); 128 Helpers.StringToField(mess), 255, pos, "IRC:",
133 }); 129 LLUUID.Zero);
130 });
134 } 131 }
135 } 132 }
136 } 133 }
137 } 134 }
138 135
139 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 136 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
137 LLUUID fromAgentID)
140 { 138 {
141 ScenePresence avatar = null; 139 ScenePresence avatar = null;
142 avatar = m_scene.RequestAvatar(fromAgentID); 140 avatar = m_scene.RequestAvatar(fromAgentID);
@@ -213,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules
213 } 211 }
214 } 212 }
215 } 213 }
216} 214} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index bbd9810..3f737e1 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -1,23 +1,20 @@
1using System.Text; 1using System;
2using System.Net; 2using System.Collections.Generic;
3using System.Net.Sockets; 3using libsecondlife;
4using System.Threading; 4using OpenSim.Framework.Types;
5using System.IO; 5using OpenSim.Framework.Utilities;
6using System.Collections.Generic; 6using OpenSim.Region.Environment.Interfaces;
7using libsecondlife; 7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.Scenes; 8
9using OpenSim.Region.Environment.Interfaces;
10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Utilities;
12using OpenSim.Framework.Console;
13using OpenSim.Framework.Types;
14
15namespace OpenSim.Region.Environment.Modules 9namespace OpenSim.Region.Environment.Modules
16{ 10{
17 public class DynamicTextureModule :IRegionModule, IDynamicTextureManager 11 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
18 { 12 {
19 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 13 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
20 private Dictionary<string, IDynamicTextureRender> RenderPlugins= new Dictionary<string, IDynamicTextureRender>(); 14
15 private Dictionary<string, IDynamicTextureRender> RenderPlugins =
16 new Dictionary<string, IDynamicTextureRender>();
17
21 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); 18 private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
22 19
23 public void Initialise(Scene scene) 20 public void Initialise(Scene scene)
@@ -30,8 +27,7 @@ namespace OpenSim.Region.Environment.Modules
30 } 27 }
31 28
32 public void PostInitialise() 29 public void PostInitialise()
33 { 30 {
34
35 } 31 }
36 32
37 public void CloseDown() 33 public void CloseDown()
@@ -69,10 +65,11 @@ namespace OpenSim.Region.Environment.Modules
69 } 65 }
70 } 66 }
71 67
72 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer) 68 public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
69 string extraParams, int updateTimer)
73 { 70 {
74 System.Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 71 Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
75 if (this.RenderPlugins.ContainsKey(contentType)) 72 if (RenderPlugins.ContainsKey(contentType))
76 { 73 {
77 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 74 DynamicTextureUpdater updater = new DynamicTextureUpdater();
78 updater.SimUUID = simID; 75 updater.SimUUID = simID;
@@ -83,7 +80,7 @@ namespace OpenSim.Region.Environment.Modules
83 updater.UpdaterID = LLUUID.Random(); 80 updater.UpdaterID = LLUUID.Random();
84 updater.Params = extraParams; 81 updater.Params = extraParams;
85 82
86 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 83 if (!Updaters.ContainsKey(updater.UpdaterID))
87 { 84 {
88 Updaters.Add(updater.UpdaterID, updater); 85 Updaters.Add(updater.UpdaterID, updater);
89 } 86 }
@@ -94,9 +91,10 @@ namespace OpenSim.Region.Environment.Modules
94 return LLUUID.Zero; 91 return LLUUID.Zero;
95 } 92 }
96 93
97 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer) 94 public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
95 string extraParams, int updateTimer)
98 { 96 {
99 if (this.RenderPlugins.ContainsKey(contentType)) 97 if (RenderPlugins.ContainsKey(contentType))
100 { 98 {
101 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 99 DynamicTextureUpdater updater = new DynamicTextureUpdater();
102 updater.SimUUID = simID; 100 updater.SimUUID = simID;
@@ -107,7 +105,7 @@ namespace OpenSim.Region.Environment.Modules
107 updater.UpdaterID = LLUUID.Random(); 105 updater.UpdaterID = LLUUID.Random();
108 updater.Params = extraParams; 106 updater.Params = extraParams;
109 107
110 if (!this.Updaters.ContainsKey(updater.UpdaterID)) 108 if (!Updaters.ContainsKey(updater.UpdaterID))
111 { 109 {
112 Updaters.Add(updater.UpdaterID, updater); 110 Updaters.Add(updater.UpdaterID, updater);
113 } 111 }
@@ -140,7 +138,7 @@ namespace OpenSim.Region.Environment.Modules
140 public void DataReceived(byte[] data, Scene scene) 138 public void DataReceived(byte[] data, Scene scene)
141 { 139 {
142 //TODO delete the last asset(data), if it was a dynamic texture 140 //TODO delete the last asset(data), if it was a dynamic texture
143 141
144 AssetBase asset = new AssetBase(); 142 AssetBase asset = new AssetBase();
145 asset.FullID = LLUUID.Random(); 143 asset.FullID = LLUUID.Random();
146 asset.Data = data; 144 asset.Data = data;
@@ -148,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules
148 asset.Type = 0; 146 asset.Type = 0;
149 scene.commsManager.AssetCache.AddAsset(asset); 147 scene.commsManager.AssetCache.AddAsset(asset);
150 148
151 this.LastAssetID = asset.FullID; 149 LastAssetID = asset.FullID;
152 150
153 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 151 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
154 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); 152 part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
@@ -156,4 +154,4 @@ namespace OpenSim.Region.Environment.Modules
156 } 154 }
157 } 155 }
158 } 156 }
159} 157} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
index fff9539..7a61373 100644
--- a/OpenSim/Region/Environment/Modules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/EmailModule.cs
@@ -1,10 +1,6 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules 1namespace OpenSim.Region.Environment.Modules
6{ 2{
7 class EmailModule 3 internal class EmailModule
8 { 4 {
9 } 5 }
10} 6} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 411b838..c2a7291 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -1,12 +1,6 @@
1using System; 1using OpenSim.Region.Environment.Interfaces;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Scenes;
3using System.Text; 3
4using libsecondlife;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9
10namespace OpenSim.Region.Environment.Modules 4namespace OpenSim.Region.Environment.Modules
11{ 5{
12 public class FriendsModule : IRegionModule 6 public class FriendsModule : IRegionModule
@@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
19 } 13 }
20 14
21 public void PostInitialise() 15 public void PostInitialise()
22 { 16 {
23
24 } 17 }
25 18
26 public void CloseDown() 19 public void CloseDown()
@@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
37 return false; 30 return false;
38 } 31 }
39 } 32 }
40} 33} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 9ed0e96..dcef2c5 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -1,11 +1,6 @@
1using System; 1using OpenSim.Region.Environment.Interfaces;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Scenes;
3using System.Text; 3
4using libsecondlife;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9namespace OpenSim.Region.Environment.Modules 4namespace OpenSim.Region.Environment.Modules
10{ 5{
11 public class GroupsModule : IRegionModule 6 public class GroupsModule : IRegionModule
@@ -18,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
18 } 13 }
19 14
20 public void PostInitialise() 15 public void PostInitialise()
21 { 16 {
22
23 } 17 }
24 18
25 public void CloseDown() 19 public void CloseDown()
@@ -36,5 +30,4 @@ namespace OpenSim.Region.Environment.Modules
36 return false; 30 return false;
37 } 31 }
38 } 32 }
39} 33} \ No newline at end of file
40
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 25c118a..14f2b65 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -1,15 +1,9 @@
1using System; 1using OpenSim.Region.Environment.Interfaces;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Scenes;
3using System.Text; 3
4using libsecondlife;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9
10namespace OpenSim.Region.Environment.Modules 4namespace OpenSim.Region.Environment.Modules
11{ 5{
12 public class InstantMessageModule :IRegionModule 6 public class InstantMessageModule : IRegionModule
13 { 7 {
14 private Scene m_scene; 8 private Scene m_scene;
15 9
@@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
19 } 13 }
20 14
21 public void PostInitialise() 15 public void PostInitialise()
22 { 16 {
23
24 } 17 }
25 18
26 public void CloseDown() 19 public void CloseDown()
@@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
37 return false; 30 return false;
38 } 31 }
39 } 32 }
40} 33} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index bfcb7d7..40bd37e 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -1,15 +1,9 @@
1using System; 1using OpenSim.Region.Environment.Interfaces;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Scenes;
3using System.Text; 3
4using libsecondlife;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9
10namespace OpenSim.Region.Environment.Modules 4namespace OpenSim.Region.Environment.Modules
11{ 5{
12 public class InventoryModule :IRegionModule 6 public class InventoryModule : IRegionModule
13 { 7 {
14 private Scene m_scene; 8 private Scene m_scene;
15 9
@@ -19,8 +13,7 @@ namespace OpenSim.Region.Environment.Modules
19 } 13 }
20 14
21 public void PostInitialise() 15 public void PostInitialise()
22 { 16 {
23
24 } 17 }
25 18
26 public void CloseDown() 19 public void CloseDown()
@@ -37,4 +30,4 @@ namespace OpenSim.Region.Environment.Modules
37 return false; 30 return false;
38 } 31 }
39 } 32 }
40} 33} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index e47cc9e..1e84a59 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -1,10 +1,6 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules 1namespace OpenSim.Region.Environment.Modules
6{ 2{
7 class ScriptsHttpRequests 3 internal class ScriptsHttpRequests
8 { 4 {
9 } 5 }
10} 6} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
index 1c01b27..f331a9c 100644
--- a/OpenSim/Region/Environment/Modules/TeleportModule.cs
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs
@@ -1,10 +1,6 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.Environment.Modules 1namespace OpenSim.Region.Environment.Modules
6{ 2{
7 class TeleportModule 3 internal class TeleportModule
8 { 4 {
9 } 5 }
10} 6} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 59c0839..f107d77 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -1,20 +1,16 @@
1using System; 1using libsecondlife;
2using System.Collections.Generic; 2using OpenSim.Framework.Interfaces;
3using System.Text; 3using OpenSim.Region.Environment.Interfaces;
4using libsecondlife; 4using OpenSim.Region.Environment.Scenes;
5using OpenSim.Framework.Interfaces; 5
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Interfaces;
8
9namespace OpenSim.Region.Environment.Modules 6namespace OpenSim.Region.Environment.Modules
10{ 7{
11 public class TextureDownloadModule :IRegionModule 8 public class TextureDownloadModule : IRegionModule
12 { 9 {
13 private Scene m_scene; 10 private Scene m_scene;
14 11
15 public TextureDownloadModule() 12 public TextureDownloadModule()
16 { 13 {
17
18 } 14 }
19 15
20 public void Initialise(Scene scene) 16 public void Initialise(Scene scene)
@@ -24,8 +20,7 @@ namespace OpenSim.Region.Environment.Modules
24 } 20 }
25 21
26 public void PostInitialise() 22 public void PostInitialise()
27 { 23 {
28
29 } 24 }
30 25
31 public void CloseDown() 26 public void CloseDown()
@@ -47,8 +42,7 @@ namespace OpenSim.Region.Environment.Modules
47 } 42 }
48 43
49 public void TextureAssetCallback(LLUUID texture, byte[] data) 44 public void TextureAssetCallback(LLUUID texture, byte[] data)
50 { 45 {
51
52 } 46 }
53 } 47 }
54} 48} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index 216d10a..7f8c5c1 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -1,13 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using libsecondlife;
4 4using OpenSim.Framework.Interfaces;
5using libsecondlife; 5using OpenSim.Region.Environment.Interfaces;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Framework.Utilities; 7
8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Interfaces;
10
11namespace OpenSim.Region.Environment.Modules 8namespace OpenSim.Region.Environment.Modules
12{ 9{
13 public class XferModule : IRegionModule, IXfer 10 public class XferModule : IRegionModule, IXfer
@@ -18,8 +15,7 @@ namespace OpenSim.Region.Environment.Modules
18 private Scene m_scene; 15 private Scene m_scene;
19 16
20 public XferModule() 17 public XferModule()
21 { 18 {
22
23 } 19 }
24 20
25 public void Initialise(Scene scene) 21 public void Initialise(Scene scene)
@@ -31,13 +27,11 @@ namespace OpenSim.Region.Environment.Modules
31 } 27 }
32 28
33 public void PostInitialise() 29 public void PostInitialise()
34 { 30 {
35
36 } 31 }
37 32
38 public void CloseDown() 33 public void CloseDown()
39 { 34 {
40
41 } 35 }
42 36
43 public string GetName() 37 public string GetName()
@@ -67,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules
67 lock (NewFiles) 61 lock (NewFiles)
68 { 62 {
69 if (NewFiles.ContainsKey(fileName)) 63 if (NewFiles.ContainsKey(fileName))
70 { 64 {
71 if (!Transfers.ContainsKey(xferID)) 65 if (!Transfers.ContainsKey(xferID))
72 { 66 {
73 byte[] fileData = NewFiles[fileName]; 67 byte[] fileData = NewFiles[fileName];
@@ -82,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules
82 76
83 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 77 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
84 { 78 {
85 if (this.Transfers.ContainsKey(xferID)) 79 if (Transfers.ContainsKey(xferID))
86 { 80 {
87 Transfers[xferID].AckPacket(packet); 81 Transfers[xferID].AckPacket(packet);
88 } 82 }
@@ -125,8 +119,7 @@ namespace OpenSim.Region.Environment.Modules
125 } 119 }
126 120
127 public XferDownLoad() 121 public XferDownLoad()
128 { 122 {
129
130 } 123 }
131 124
132 public void StartSend() 125 public void StartSend()
@@ -142,10 +135,10 @@ namespace OpenSim.Region.Environment.Modules
142 } 135 }
143 else 136 else
144 { 137 {
145 byte[] transferData = new byte[1000 +4]; 138 byte[] transferData = new byte[1000 + 4];
146 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 139 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
147 Array.Copy(Data, 0, transferData, 4, 1000); 140 Array.Copy(Data, 0, transferData, 4, 1000);
148 Client.SendXferPacket(XferID, 0 , transferData); 141 Client.SendXferPacket(XferID, 0, transferData);
149 Packet++; 142 Packet++;
150 DataPointer = 1000; 143 DataPointer = 1000;
151 } 144 }
@@ -167,7 +160,7 @@ namespace OpenSim.Region.Environment.Modules
167 { 160 {
168 byte[] transferData = new byte[Data.Length - DataPointer]; 161 byte[] transferData = new byte[Data.Length - DataPointer];
169 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 162 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
170 uint endPacket = Packet |= (uint)0x80000000; 163 uint endPacket = Packet |= (uint) 0x80000000;
171 Client.SendXferPacket(XferID, endPacket, transferData); 164 Client.SendXferPacket(XferID, endPacket, transferData);
172 Packet++; 165 Packet++;
173 DataPointer += (Data.Length - DataPointer); 166 DataPointer += (Data.Length - DataPointer);
@@ -177,4 +170,4 @@ namespace OpenSim.Region.Environment.Modules
177 } 170 }
178 } 171 }
179 } 172 }
180} 173} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index cb455f4..0a33380 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -1,14 +1,7 @@
1using System.Collections.Generic; 1using libsecondlife;
2using OpenSim.Framework; 2using OpenSim.Region.Environment.LandManagement;
3using OpenSim.Framework.Types; 3using OpenSim.Region.Environment.Scenes;
4using OpenSim.Framework.Communications; 4
5using OpenSim.Framework.Servers;
6using OpenSim.Region.Capabilities;
7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.LandManagement;
9
10using libsecondlife;
11
12namespace OpenSim.Region.Environment 5namespace OpenSim.Region.Environment
13{ 6{
14 public class PermissionManager 7 public class PermissionManager
@@ -19,7 +12,8 @@ namespace OpenSim.Region.Environment
19 // disable in any production environment 12 // disable in any production environment
20 // TODO: Change this to false when permissions are a desired default 13 // TODO: Change this to false when permissions are a desired default
21 // TODO: Move to configuration option. 14 // TODO: Move to configuration option.
22 private bool m_bypassPermissions = true; 15 private bool m_bypassPermissions = true;
16
23 public bool BypassPermissions 17 public bool BypassPermissions
24 { 18 {
25 get { return m_bypassPermissions; } 19 get { return m_bypassPermissions; }
@@ -104,26 +98,27 @@ namespace OpenSim.Region.Environment
104 // Default: deny 98 // Default: deny
105 bool permission = false; 99 bool permission = false;
106 100
107 if( !m_scene.Entities.ContainsKey( objId )) 101 if (!m_scene.Entities.ContainsKey(objId))
108 { 102 {
109 return false; 103 return false;
110 } 104 }
111 105
112 // If it's not an object, we cant edit it. 106 // If it's not an object, we cant edit it.
113 if (!(m_scene.Entities[objId] is SceneObjectGroup)) 107 if (!(m_scene.Entities[objId] is SceneObjectGroup))
114 { 108 {
115 return false; 109 return false;
116 } 110 }
117 111
118 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; 112 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objId];
119 LLUUID taskOwner = null; 113 LLUUID taskOwner = null;
120 114
121 // Object owners should be able to edit their own content 115 // Object owners should be able to edit their own content
122 if (user == taskOwner) 116 if (user == taskOwner)
123 permission = true; 117 permission = true;
124 118
125 // Users should be able to edit what is over their land. 119 // Users should be able to edit what is over their land.
126 if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) 120 if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
121 user)
127 permission = true; 122 permission = true;
128 123
129 // Estate users should be able to edit anything in the sim 124 // Estate users should be able to edit anything in the sim
@@ -270,7 +265,7 @@ namespace OpenSim.Region.Environment
270 // TODO: Need to do some extra checks here. Requires group code. 265 // TODO: Need to do some extra checks here. Requires group code.
271 } 266 }
272 267
273 if(IsEstateManager(user)) 268 if (IsEstateManager(user))
274 permission = true; 269 permission = true;
275 270
276 if (IsAdministrator(user)) 271 if (IsAdministrator(user))
@@ -299,7 +294,6 @@ namespace OpenSim.Region.Environment
299 return GenericParcelPermission(user, parcel); 294 return GenericParcelPermission(user, parcel);
300 } 295 }
301 296
302 #endregion 297 #endregion
303
304 } 298 }
305} 299} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs
index 86a3626..dfae0fd 100644
--- a/OpenSim/Region/Environment/RegionManager.cs
+++ b/OpenSim/Region/Environment/RegionManager.cs
@@ -1,34 +1,3 @@
1using System.Collections.Generic;
2using OpenSim.Framework;
3using OpenSim.Framework.Types;
4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Servers;
6using OpenSim.Region.Capabilities;
7using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.LandManagement;
9
10namespace OpenSim.Region.Environment 1namespace OpenSim.Region.Environment
11{ 2{
12 public delegate TResult ModuleAPIMethod1<TResult, TParam0>(TParam0 param0); 3} \ No newline at end of file
13 public delegate TResult ModuleAPIMethod2<TResult, TParam0, TParam1>(TParam0 param0, TParam1 param1);
14
15 public class RegionManager
16 {
17 protected AgentCircuitManager authenticateHandler;
18 protected RegionCommsListener regionCommsHost;
19 protected CommunicationsManager commsManager;
20 protected List<Caps> capsHandlers = new List<Caps>();
21 protected BaseHttpServer httpListener;
22
23 protected Scene m_Scene;
24
25 public LandManager LandManager;
26 public EstateManager estateManager;
27
28 public RegionManager()
29 {
30
31 }
32
33 }
34}
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 2caab9e..bc27ec8 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -1,30 +1,25 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using Axiom.Math; 2using Axiom.Math;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Region.Environment.Scenes.Scripting;
5 4
6namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
7{ 6{
8 public abstract class EntityBase 7 public abstract class EntityBase
9 { 8 {
10 protected List<EntityBase> m_children; 9 protected List<EntityBase> m_children;
11 10
12 protected Scene m_scene; 11 protected Scene m_scene;
13 12
14 public LLUUID m_uuid; 13 public LLUUID m_uuid;
14
15 public virtual LLUUID UUID 15 public virtual LLUUID UUID
16 { 16 {
17 get 17 get { return m_uuid; }
18 { 18 set { m_uuid = value; }
19 return m_uuid;
20 }
21 set
22 {
23 m_uuid = value;
24 }
25 } 19 }
26 20
27 protected string m_name; 21 protected string m_name;
22
28 /// <summary> 23 /// <summary>
29 /// 24 ///
30 /// </summary> 25 /// </summary>
@@ -35,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
35 } 30 }
36 31
37 protected LLVector3 m_pos; 32 protected LLVector3 m_pos;
33
38 /// <summary> 34 /// <summary>
39 /// 35 ///
40 /// </summary> 36 /// </summary>
@@ -45,6 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
45 } 41 }
46 42
47 public LLVector3 m_velocity; 43 public LLVector3 m_velocity;
44
48 /// <summary> 45 /// <summary>
49 /// 46 ///
50 /// </summary> 47 /// </summary>
@@ -55,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes
55 } 52 }
56 53
57 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0); 54 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
55
58 public virtual Quaternion Rotation 56 public virtual Quaternion Rotation
59 { 57 {
60 get { return m_rotation; } 58 get { return m_rotation; }
@@ -62,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
62 } 60 }
63 61
64 protected uint m_localId; 62 protected uint m_localId;
63
65 public virtual uint LocalId 64 public virtual uint LocalId
66 { 65 {
67 get { return m_localId; } 66 get { return m_localId; }
@@ -125,5 +124,5 @@ namespace OpenSim.Region.Environment.Scenes
125 } 124 }
126 125
127 public abstract void SetText(string text, Vector3 color, double alpha); 126 public abstract void SetText(string text, Vector3 color, double alpha);
128 } 127 }
129} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 8551b70..851ad4e 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -11,4 +11,4 @@ namespace OpenSim.Region.Environment.Scenes
11 void SendOurAppearance(IClientAPI OurClient); 11 void SendOurAppearance(IClientAPI OurClient);
12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo); 12 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
13 } 13 }
14} 14} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index a259dd0..048d2b4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1,15 +1,13 @@
1using System; 1using Axiom.Math;
2using System.IO; 2using libsecondlife;
3using System.Collections.Generic; 3using libsecondlife.Packets;
4using libsecondlife; 4using OpenSim.Framework.Communications.Caches;
5using libsecondlife.Packets; 5using OpenSim.Framework.Data;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Framework.Communications.Caches; 8using OpenSim.Framework.Utilities;
9using OpenSim.Framework.Data; 9using OpenSim.Region.Physics.Manager;
10using OpenSim.Framework.Utilities; 10
11using OpenSim.Region.Physics.Manager;
12
13namespace OpenSim.Region.Environment.Scenes 11namespace OpenSim.Region.Environment.Scenes
14{ 12{
15 public partial class Scene 13 public partial class Scene
@@ -19,9 +17,9 @@ namespace OpenSim.Region.Environment.Scenes
19 17
20 public void AddInventoryItem(LLUUID userID, InventoryItemBase item) 18 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
21 { 19 {
22 if (this.Avatars.ContainsKey(userID)) 20 if (Avatars.ContainsKey(userID))
23 { 21 {
24 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); 22 AddInventoryItem(Avatars[userID].ControllingClient, item);
25 } 23 }
26 } 24 }
27 25
@@ -37,9 +35,9 @@ namespace OpenSim.Region.Environment.Scenes
37 35
38 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) 36 public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
39 { 37 {
40 if (this.Avatars.ContainsKey(userID)) 38 if (Avatars.ContainsKey(userID))
41 { 39 {
42 return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); 40 return CapsUpdateInventoryItemAsset(Avatars[userID].ControllingClient, itemID, data);
43 } 41 }
44 return LLUUID.Zero; 42 return LLUUID.Zero;
45 } 43 }
@@ -57,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
57 AssetBase asset; 55 AssetBase asset;
58 asset = new AssetBase(); 56 asset = new AssetBase();
59 asset.FullID = LLUUID.Random(); 57 asset.FullID = LLUUID.Random();
60 asset.Type = (sbyte)item.assetType; 58 asset.Type = (sbyte) item.assetType;
61 asset.InvType = (sbyte)item.invType; 59 asset.InvType = (sbyte) item.invType;
62 asset.Name = item.inventoryName; 60 asset.Name = item.inventoryName;
63 asset.Data = data; 61 asset.Data = data;
64 commsManager.AssetCache.AddAsset(asset); 62 commsManager.AssetCache.AddAsset(asset);
@@ -83,7 +81,8 @@ namespace OpenSim.Region.Environment.Scenes
83 return LLUUID.Zero; 81 return LLUUID.Zero;
84 } 82 }
85 83
86 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) 84 public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
85 LLUUID itemID)
87 { 86 {
88 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 87 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
89 if (userInfo != null) 88 if (userInfo != null)
@@ -93,7 +92,8 @@ namespace OpenSim.Region.Environment.Scenes
93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 92 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
94 if (item != null) 93 if (item != null)
95 { 94 {
96 AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 95 AgentAssetTransactions transactions =
96 commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
97 if (transactions != null) 97 if (transactions != null)
98 { 98 {
99 AssetBase asset = null; 99 AssetBase asset = null;
@@ -112,8 +112,8 @@ namespace OpenSim.Region.Environment.Scenes
112 { 112 {
113 asset.Name = item.inventoryName; 113 asset.Name = item.inventoryName;
114 asset.Description = item.inventoryDescription; 114 asset.Description = item.inventoryDescription;
115 asset.InvType = (sbyte)item.invType; 115 asset.InvType = (sbyte) item.invType;
116 asset.Type = (sbyte)item.assetType; 116 asset.Type = (sbyte) item.assetType;
117 item.assetID = asset.FullID; 117 item.assetID = asset.FullID;
118 118
119 if (addToCache) 119 if (addToCache)
@@ -143,7 +143,9 @@ namespace OpenSim.Region.Environment.Scenes
143 /// <param name="type"></param> 143 /// <param name="type"></param>
144 /// <param name="wearableType"></param> 144 /// <param name="wearableType"></param>
145 /// <param name="nextOwnerMask"></param> 145 /// <param name="nextOwnerMask"></param>
146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 146 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
147 uint callbackID, string description, string name, sbyte invType, sbyte type,
148 byte wearableType, uint nextOwnerMask)
147 { 149 {
148 if (transActionID == LLUUID.Zero) 150 if (transActionID == LLUUID.Zero)
149 { 151 {
@@ -157,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
157 asset.Type = type; 159 asset.Type = type;
158 asset.FullID = LLUUID.Random(); 160 asset.FullID = LLUUID.Random();
159 asset.Data = new byte[1]; 161 asset.Data = new byte[1];
160 this.commsManager.AssetCache.AddAsset(asset); 162 commsManager.AssetCache.AddAsset(asset);
161 163
162 InventoryItemBase item = new InventoryItemBase(); 164 InventoryItemBase item = new InventoryItemBase();
163 item.avatarID = remoteClient.AgentId; 165 item.avatarID = remoteClient.AgentId;
@@ -178,7 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
178 } 180 }
179 else 181 else
180 { 182 {
181 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 183 commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
184 callbackID, description, name, invType,
185 type, wearableType, nextOwnerMask);
182 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 186 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
183 } 187 }
184 } 188 }
@@ -195,15 +199,15 @@ namespace OpenSim.Region.Environment.Scenes
195 { 199 {
196 if (ent is SceneObjectGroup) 200 if (ent is SceneObjectGroup)
197 { 201 {
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 202 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 203 if (hasPrim != false)
200 { 204 {
201 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 205 bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
202 if (fileChange) 206 if (fileChange)
203 { 207 {
204 if (this.XferManager != null) 208 if (XferManager != null)
205 { 209 {
206 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, XferManager); 210 ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
207 } 211 }
208 } 212 }
209 break; 213 break;
@@ -219,14 +223,14 @@ namespace OpenSim.Region.Environment.Scenes
219 { 223 {
220 if (ent is SceneObjectGroup) 224 if (ent is SceneObjectGroup)
221 { 225 {
222 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 226 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
223 if (hasPrim != false) 227 if (hasPrim != false)
224 { 228 {
225 int type = ((SceneObjectGroup)ent).RemoveInventoryItem(remoteClient, localID, itemID); 229 int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
226 ((SceneObjectGroup)ent).GetProperites(remoteClient); 230 ((SceneObjectGroup) ent).GetProperites(remoteClient);
227 if (type == 10) 231 if (type == 10)
228 { 232 {
229 this.EventManager.TriggerRemoveScript(localID, itemID); 233 EventManager.TriggerRemoveScript(localID, itemID);
230 } 234 }
231 } 235 }
232 } 236 }
@@ -255,7 +259,7 @@ namespace OpenSim.Region.Environment.Scenes
255 { 259 {
256 string script = Util.FieldToString(rezAsset.Data); 260 string script = Util.FieldToString(rezAsset.Data);
257 //Console.WriteLine("rez script "+script); 261 //Console.WriteLine("rez script "+script);
258 this.EventManager.TriggerRezScript(localID, copyID, script); 262 EventManager.TriggerRezScript(localID, copyID, script);
259 rezzed = true; 263 rezzed = true;
260 } 264 }
261 else 265 else
@@ -266,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
266 { 270 {
267 string script = Util.FieldToString(rezAsset.Data); 271 string script = Util.FieldToString(rezAsset.Data);
268 // Console.WriteLine("rez script " + script); 272 // Console.WriteLine("rez script " + script);
269 this.EventManager.TriggerRezScript(localID, copyID, script); 273 EventManager.TriggerRezScript(localID, copyID, script);
270 rezzed = true; 274 rezzed = true;
271 } 275 }
272 } 276 }
@@ -278,12 +282,13 @@ namespace OpenSim.Region.Environment.Scenes
278 { 282 {
279 if (ent is SceneObjectGroup) 283 if (ent is SceneObjectGroup)
280 { 284 {
281 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 285 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
282 if (hasPrim != false) 286 if (hasPrim != false)
283 { 287 {
284 288 bool added =
285 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); 289 ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
286 ((SceneObjectGroup)ent).GetProperites(remoteClient); 290 copyID);
291 ((SceneObjectGroup) ent).GetProperites(remoteClient);
287 } 292 }
288 } 293 }
289 } 294 }
@@ -300,7 +305,7 @@ namespace OpenSim.Region.Environment.Scenes
300 /// <param name="simClient"></param> 305 /// <param name="simClient"></param>
301 public void DeRezObject(Packet packet, IClientAPI remoteClient) 306 public void DeRezObject(Packet packet, IClientAPI remoteClient)
302 { 307 {
303 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; 308 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
304 309
305 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) 310 if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
306 { 311 {
@@ -312,7 +317,7 @@ namespace OpenSim.Region.Environment.Scenes
312 { 317 {
313 EntityBase selectedEnt = null; 318 EntityBase selectedEnt = null;
314 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); 319 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
315 foreach (EntityBase ent in this.Entities.Values) 320 foreach (EntityBase ent in Entities.Values)
316 { 321 {
317 if (ent.LocalId == Data.ObjectLocalID) 322 if (ent.LocalId == Data.ObjectLocalID)
318 { 323 {
@@ -322,15 +327,16 @@ namespace OpenSim.Region.Environment.Scenes
322 } 327 }
323 if (selectedEnt != null) 328 if (selectedEnt != null)
324 { 329 {
325 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) 330 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
326 { 331 {
327 string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); 332 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
328 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); 333 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
329 if (userInfo != null) 334 if (userInfo != null)
330 { 335 {
331 AssetBase asset = new AssetBase(); 336 AssetBase asset = new AssetBase();
332 asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); 337 asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
333 asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); 338 asset.Description =
339 ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
334 asset.InvType = 6; 340 asset.InvType = 6;
335 asset.Type = 6; 341 asset.Type = 6;
336 asset.FullID = LLUUID.Random(); 342 asset.FullID = LLUUID.Random();
@@ -355,21 +361,23 @@ namespace OpenSim.Region.Environment.Scenes
355 remoteClient.SendInventoryItemUpdate(item); 361 remoteClient.SendInventoryItemUpdate(item);
356 } 362 }
357 363
358 SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); 364 SceneObjectPart rootPart =
365 ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
359 if (rootPart.PhysActor != null) 366 if (rootPart.PhysActor != null)
360 { 367 {
361 this.phyScene.RemovePrim(rootPart.PhysActor); 368 phyScene.RemovePrim(rootPart.PhysActor);
362 rootPart.PhysActor = null; 369 rootPart.PhysActor = null;
363 } 370 }
364 371
365 storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); 372 storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
366 ((SceneObjectGroup)selectedEnt).DeleteGroup(); 373 m_regInfo.SimUUID);
374 ((SceneObjectGroup) selectedEnt).DeleteGroup();
367 375
368 lock (Entities) 376 lock (Entities)
369 { 377 {
370 Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); 378 Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
371 } 379 }
372 ((SceneObjectGroup)selectedEnt).DeleteParts(); 380 ((SceneObjectGroup) selectedEnt).DeleteParts();
373 } 381 }
374 } 382 }
375 } 383 }
@@ -389,7 +397,7 @@ namespace OpenSim.Region.Environment.Scenes
389 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 397 AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
390 if (rezAsset != null) 398 if (rezAsset != null)
391 { 399 {
392 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 400 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
393 userInfo.DeleteItem(remoteClient.AgentId, item); 401 userInfo.DeleteItem(remoteClient.AgentId, item);
394 remoteClient.SendRemoveInventoryItem(itemID); 402 remoteClient.SendRemoveInventoryItem(itemID);
395 } 403 }
@@ -399,7 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
399 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); 407 rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
400 if (rezAsset != null) 408 if (rezAsset != null)
401 { 409 {
402 this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); 410 AddRezObject(Util.FieldToString(rezAsset.Data), pos);
403 userInfo.DeleteItem(remoteClient.AgentId, item); 411 userInfo.DeleteItem(remoteClient.AgentId, item);
404 remoteClient.SendRemoveInventoryItem(itemID); 412 remoteClient.SendRemoveInventoryItem(itemID);
405 } 413 }
@@ -411,17 +419,17 @@ namespace OpenSim.Region.Environment.Scenes
411 419
412 private void AddRezObject(string xmlData, LLVector3 pos) 420 private void AddRezObject(string xmlData, LLVector3 pos)
413 { 421 {
414 SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); 422 SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
415 this.AddEntity(group); 423 AddEntity(group);
416 group.AbsolutePosition = pos; 424 group.AbsolutePosition = pos;
417 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 425 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
418 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 426 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
419 rootPart.PhysActor = phyScene.AddPrim( 427 rootPart.PhysActor = phyScene.AddPrim(
420 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 428 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
429 rootPart.AbsolutePosition.Z),
421 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 430 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
422 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 431 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
423 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 432 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
424 } 433 }
425 } 434 }
426 435} \ No newline at end of file
427}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 881b4a1..5a7dda5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -25,17 +25,11 @@
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 System.IO;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using libsecondlife; 29using libsecondlife;
32using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Framework.Data;
37using OpenSim.Framework.Utilities;
38using OpenSim.Region.Environment.Interfaces;
39 33
40namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
41{ 35{
@@ -50,7 +44,8 @@ namespace OpenSim.Region.Environment.Scenes
50 /// <param name="action">The action to be performed</param> 44 /// <param name="action">The action to be performed</param>
51 /// <param name="north">Distance from the north border where the cursor is located</param> 45 /// <param name="north">Distance from the north border where the cursor is located</param>
52 /// <param name="west">Distance from the west border where the cursor is located</param> 46 /// <param name="west">Distance from the west border where the cursor is located</param>
53 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) 47 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
48 IClientAPI remoteUser)
54 { 49 {
55 // Do a permissions check before allowing terraforming. 50 // Do a permissions check before allowing terraforming.
56 // random users are now no longer allowed to terraform 51 // random users are now no longer allowed to terraform
@@ -71,17 +66,19 @@ namespace OpenSim.Region.Environment.Scenes
71 /// <param name="timestamp"></param> 66 /// <param name="timestamp"></param>
72 /// <param name="fromAgentName"></param> 67 /// <param name="fromAgentName"></param>
73 /// <param name="message"></param> 68 /// <param name="message"></param>
74 public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog) 69 public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID,
70 uint timestamp, string fromAgentName, string message, byte dialog)
75 { 71 {
76 if (this.Avatars.ContainsKey(toAgentID)) 72 if (Avatars.ContainsKey(toAgentID))
77 { 73 {
78 if (this.Avatars.ContainsKey(fromAgentID)) 74 if (Avatars.ContainsKey(fromAgentID))
79 { 75 {
80 // Local sim message 76 // Local sim message
81 ScenePresence fromAvatar = this.Avatars[fromAgentID]; 77 ScenePresence fromAvatar = Avatars[fromAgentID];
82 ScenePresence toAvatar = this.Avatars[toAgentID]; 78 ScenePresence toAvatar = Avatars[toAgentID];
83 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname; 79 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
84 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromName, dialog, timestamp); 80 toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID,
81 imSessionID, fromName, dialog, timestamp);
85 } 82 }
86 else 83 else
87 { 84 {
@@ -102,7 +99,8 @@ namespace OpenSim.Region.Environment.Scenes
102 /// <param name="fromPos"></param> 99 /// <param name="fromPos"></param>
103 /// <param name="fromName"></param> 100 /// <param name="fromName"></param>
104 /// <param name="fromAgentID"></param> 101 /// <param name="fromAgentID"></param>
105 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 102 public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
103 LLUUID fromAgentID)
106 { 104 {
107 if (m_simChatModule != null) 105 if (m_simChatModule != null)
108 { 106 {
@@ -123,9 +121,9 @@ namespace OpenSim.Region.Environment.Scenes
123 { 121 {
124 if (ent is SceneObjectGroup) 122 if (ent is SceneObjectGroup)
125 { 123 {
126 if (((SceneObjectGroup)ent).LocalId == originalPrim) 124 if (((SceneObjectGroup) ent).LocalId == originalPrim)
127 { 125 {
128 originPrim = (SceneObjectGroup)ent; 126 originPrim = (SceneObjectGroup) ent;
129 break; 127 break;
130 } 128 }
131 } 129 }
@@ -135,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes
135 { 133 {
136 SceneObjectGroup copy = originPrim.Copy(); 134 SceneObjectGroup copy = originPrim.Copy();
137 copy.AbsolutePosition = copy.AbsolutePosition + offset; 135 copy.AbsolutePosition = copy.AbsolutePosition + offset;
138 this.Entities.Add(copy.UUID, copy); 136 Entities.Add(copy.UUID, copy);
139 137
140 copy.ScheduleGroupForFullUpdate(); 138 copy.ScheduleGroupForFullUpdate();
141 /* List<ScenePresence> avatars = this.RequestAvatarList(); 139 /* List<ScenePresence> avatars = this.RequestAvatarList();
@@ -143,13 +141,11 @@ namespace OpenSim.Region.Environment.Scenes
143 { 141 {
144 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); 142 // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
145 }*/ 143 }*/
146
147 } 144 }
148 else 145 else
149 { 146 {
150 OpenSim.Framework.Console.MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 147 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
151 } 148 }
152
153 } 149 }
154 150
155 /// <summary> 151 /// <summary>
@@ -164,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
164 { 160 {
165 if (ent is SceneObjectGroup) 161 if (ent is SceneObjectGroup)
166 { 162 {
167 if (((SceneObjectGroup)ent).LocalId == parentPrim) 163 if (((SceneObjectGroup) ent).LocalId == parentPrim)
168 { 164 {
169 parenPrim = (SceneObjectGroup)ent; 165 parenPrim = (SceneObjectGroup) ent;
170 break; 166 break;
171 } 167 }
172 } 168 }
@@ -181,9 +177,9 @@ namespace OpenSim.Region.Environment.Scenes
181 { 177 {
182 if (ent is SceneObjectGroup) 178 if (ent is SceneObjectGroup)
183 { 179 {
184 if (((SceneObjectGroup)ent).LocalId == childPrims[i]) 180 if (((SceneObjectGroup) ent).LocalId == childPrims[i])
185 { 181 {
186 children.Add((SceneObjectGroup)ent); 182 children.Add((SceneObjectGroup) ent);
187 } 183 }
188 } 184 }
189 } 185 }
@@ -208,10 +204,10 @@ namespace OpenSim.Region.Environment.Scenes
208 { 204 {
209 if (ent is SceneObjectGroup) 205 if (ent is SceneObjectGroup)
210 { 206 {
211 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 207 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
212 if (hasPrim != false) 208 if (hasPrim != false)
213 { 209 {
214 ((SceneObjectGroup)ent).UpdateShape(shapeBlock, primLocalID); 210 ((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
215 break; 211 break;
216 } 212 }
217 } 213 }
@@ -225,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
225 { 221 {
226 if (ent is SceneObjectGroup) 222 if (ent is SceneObjectGroup)
227 { 223 {
228 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 224 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
229 if (hasPrim != false) 225 if (hasPrim != false)
230 { 226 {
231 ((SceneObjectGroup)ent).UpdateExtraParam(primLocalID, type, inUse, data); 227 ((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
232 break; 228 break;
233 } 229 }
234 } 230 }
@@ -246,11 +242,11 @@ namespace OpenSim.Region.Environment.Scenes
246 { 242 {
247 if (ent is SceneObjectGroup) 243 if (ent is SceneObjectGroup)
248 { 244 {
249 if (((SceneObjectGroup)ent).LocalId == primLocalID) 245 if (((SceneObjectGroup) ent).LocalId == primLocalID)
250 { 246 {
251 ((SceneObjectGroup)ent).GetProperites(remoteClient); 247 ((SceneObjectGroup) ent).GetProperites(remoteClient);
252 ((SceneObjectGroup)ent).IsSelected = true; 248 ((SceneObjectGroup) ent).IsSelected = true;
253 this.LandManager.setPrimsTainted(); 249 LandManager.setPrimsTainted();
254 break; 250 break;
255 } 251 }
256 } 252 }
@@ -268,10 +264,10 @@ namespace OpenSim.Region.Environment.Scenes
268 { 264 {
269 if (ent is SceneObjectGroup) 265 if (ent is SceneObjectGroup)
270 { 266 {
271 if (((SceneObjectGroup)ent).LocalId == primLocalID) 267 if (((SceneObjectGroup) ent).LocalId == primLocalID)
272 { 268 {
273 ((SceneObjectGroup)ent).IsSelected = false; 269 ((SceneObjectGroup) ent).IsSelected = false;
274 this.LandManager.setPrimsTainted(); 270 LandManager.setPrimsTainted();
275 break; 271 break;
276 } 272 }
277 } 273 }
@@ -290,10 +286,10 @@ namespace OpenSim.Region.Environment.Scenes
290 { 286 {
291 if (ent is SceneObjectGroup) 287 if (ent is SceneObjectGroup)
292 { 288 {
293 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 289 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
294 if (hasPrim != false) 290 if (hasPrim != false)
295 { 291 {
296 ((SceneObjectGroup)ent).SetPartDescription(description, primLocalID); 292 ((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
297 break; 293 break;
298 } 294 }
299 } 295 }
@@ -312,10 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
312 { 308 {
313 if (ent is SceneObjectGroup) 309 if (ent is SceneObjectGroup)
314 { 310 {
315 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 311 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
316 if (hasPrim != false) 312 if (hasPrim != false)
317 { 313 {
318 ((SceneObjectGroup)ent).SetPartName(name, primLocalID); 314 ((SceneObjectGroup) ent).SetPartName(name, primLocalID);
319 break; 315 break;
320 } 316 }
321 } 317 }
@@ -331,10 +327,10 @@ namespace OpenSim.Region.Environment.Scenes
331 { 327 {
332 if (ent is SceneObjectGroup) 328 if (ent is SceneObjectGroup)
333 { 329 {
334 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID); 330 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
335 if (hasPrim != false) 331 if (hasPrim != false)
336 { 332 {
337 ((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient); 333 ((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
338 break; 334 break;
339 } 335 }
340 } 336 }
@@ -350,7 +346,6 @@ namespace OpenSim.Region.Environment.Scenes
350 /// <param name="remoteClient"></param> 346 /// <param name="remoteClient"></param>
351 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) 347 public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
352 { 348 {
353
354 } 349 }
355 350
356 /// <summary> 351 /// <summary>
@@ -366,10 +361,10 @@ namespace OpenSim.Region.Environment.Scenes
366 { 361 {
367 if (ent is SceneObjectGroup) 362 if (ent is SceneObjectGroup)
368 { 363 {
369 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 364 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
370 if (hasPrim != false) 365 if (hasPrim != false)
371 { 366 {
372 ((SceneObjectGroup)ent).UpdateTextureEntry(localID, texture); 367 ((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
373 break; 368 break;
374 } 369 }
375 } 370 }
@@ -389,10 +384,10 @@ namespace OpenSim.Region.Environment.Scenes
389 { 384 {
390 if (ent is SceneObjectGroup) 385 if (ent is SceneObjectGroup)
391 { 386 {
392 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 387 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
393 if (hasPrim != false) 388 if (hasPrim != false)
394 { 389 {
395 ((SceneObjectGroup)ent).UpdateGroupPosition(pos); 390 ((SceneObjectGroup) ent).UpdateGroupPosition(pos);
396 break; 391 break;
397 } 392 }
398 } 393 }
@@ -406,10 +401,10 @@ namespace OpenSim.Region.Environment.Scenes
406 { 401 {
407 if (ent is SceneObjectGroup) 402 if (ent is SceneObjectGroup)
408 { 403 {
409 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 404 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
410 if (hasPrim != false) 405 if (hasPrim != false)
411 { 406 {
412 ((SceneObjectGroup)ent).UpdateSinglePosition(pos, localID); 407 ((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
413 break; 408 break;
414 } 409 }
415 } 410 }
@@ -430,10 +425,10 @@ namespace OpenSim.Region.Environment.Scenes
430 { 425 {
431 if (ent is SceneObjectGroup) 426 if (ent is SceneObjectGroup)
432 { 427 {
433 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 428 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
434 if (hasPrim != false) 429 if (hasPrim != false)
435 { 430 {
436 ((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot); 431 ((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
437 break; 432 break;
438 } 433 }
439 } 434 }
@@ -453,10 +448,10 @@ namespace OpenSim.Region.Environment.Scenes
453 { 448 {
454 if (ent is SceneObjectGroup) 449 if (ent is SceneObjectGroup)
455 { 450 {
456 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 451 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
457 if (hasPrim != false) 452 if (hasPrim != false)
458 { 453 {
459 ((SceneObjectGroup)ent).UpdateGroupRotation(rot); 454 ((SceneObjectGroup) ent).UpdateGroupRotation(rot);
460 break; 455 break;
461 } 456 }
462 } 457 }
@@ -476,10 +471,10 @@ namespace OpenSim.Region.Environment.Scenes
476 { 471 {
477 if (ent is SceneObjectGroup) 472 if (ent is SceneObjectGroup)
478 { 473 {
479 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 474 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
480 if (hasPrim != false) 475 if (hasPrim != false)
481 { 476 {
482 ((SceneObjectGroup)ent).UpdateSingleRotation(rot, localID); 477 ((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
483 break; 478 break;
484 } 479 }
485 } 480 }
@@ -499,10 +494,10 @@ namespace OpenSim.Region.Environment.Scenes
499 { 494 {
500 if (ent is SceneObjectGroup) 495 if (ent is SceneObjectGroup)
501 { 496 {
502 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 497 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
503 if (hasPrim != false) 498 if (hasPrim != false)
504 { 499 {
505 ((SceneObjectGroup)ent).Resize(scale, localID); 500 ((SceneObjectGroup) ent).Resize(scale, localID);
506 break; 501 break;
507 } 502 }
508 } 503 }
@@ -511,7 +506,7 @@ namespace OpenSim.Region.Environment.Scenes
511 506
512 public void StartAnimation(IClientAPI client, LLUUID animID, int seq) 507 public void StartAnimation(IClientAPI client, LLUUID animID, int seq)
513 { 508 {
514 List<ScenePresence> avatars = this.RequestAvatarList(); 509 List<ScenePresence> avatars = RequestAvatarList();
515 for (int i = 0; i < avatars.Count; i++) 510 for (int i = 0; i < avatars.Count; i++)
516 { 511 {
517 avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId); 512 avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId);
@@ -520,7 +515,7 @@ namespace OpenSim.Region.Environment.Scenes
520 515
521 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 516 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
522 { 517 {
523 this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); 518 EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
524 } 519 }
525 } 520 }
526} 521} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d763fe3..df125aa 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -27,28 +27,28 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Threading; 31using System.Threading;
31using System.Timers; 32using System.Timers;
32using System.IO;
33using System.Xml; 33using System.Xml;
34using Axiom.Math;
34using libsecondlife; 35using libsecondlife;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Caches;
37using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces; 40using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
40using OpenSim.Framework.Types; 42using OpenSim.Framework.Types;
41using OpenSim.Framework.Utilities; 43using OpenSim.Framework.Utilities;
42using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Capabilities;
43using OpenSim.Framework.Communications.Caches;
44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment;
46using OpenSim.Region.Environment.Interfaces; 45using OpenSim.Region.Environment.Interfaces;
46using OpenSim.Region.Environment.LandManagement;
47using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Environment.Types; 48using OpenSim.Region.Environment.Types;
49using OpenSim.Region.Physics.Manager;
48using OpenSim.Region.Terrain; 50using OpenSim.Region.Terrain;
49using OpenSim.Framework.Data; 51using Timer=System.Timers.Timer;
50using Caps = OpenSim.Region.Capabilities.Caps;
51using Timer = System.Timers.Timer;
52 52
53namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
54{ 54{
@@ -61,8 +61,11 @@ namespace OpenSim.Region.Environment.Scenes
61 protected Timer m_heartbeatTimer = new Timer(); 61 protected Timer m_heartbeatTimer = new Timer();
62 protected Dictionary<LLUUID, ScenePresence> Avatars; 62 protected Dictionary<LLUUID, ScenePresence> Avatars;
63 protected Dictionary<LLUUID, SceneObjectGroup> Prims; 63 protected Dictionary<LLUUID, SceneObjectGroup> Prims;
64 public PhysicsScene phyScene; /// publicized so it can be accessed from SceneObjectGroup. 64 public PhysicsScene phyScene;
65
66 /// publicized so it can be accessed from SceneObjectGroup.
65 protected float timeStep = 0.1f; 67 protected float timeStep = 0.1f;
68
66 private Random Rand = new Random(); 69 private Random Rand = new Random();
67 private uint _primCount = 702000; 70 private uint _primCount = 702000;
68 private Mutex _primAllocateMutex = new Mutex(false); 71 private Mutex _primAllocateMutex = new Mutex(false);
@@ -102,8 +105,9 @@ namespace OpenSim.Region.Environment.Scenes
102 105
103 public AgentCircuitManager AuthenticateHandler 106 public AgentCircuitManager AuthenticateHandler
104 { 107 {
105 get { return this.authenticateHandler; } 108 get { return authenticateHandler; }
106 } 109 }
110
107 /// <summary> 111 /// <summary>
108 /// 112 ///
109 /// </summary> 113 /// </summary>
@@ -141,7 +145,7 @@ namespace OpenSim.Region.Environment.Scenes
141 145
142 public int TimePhase 146 public int TimePhase
143 { 147 {
144 get { return this.m_timePhase; } 148 get { return m_timePhase; }
145 } 149 }
146 150
147 #endregion 151 #endregion
@@ -155,7 +159,8 @@ namespace OpenSim.Region.Environment.Scenes
155 /// <param name="regionHandle">Region Handle for this region</param> 159 /// <param name="regionHandle">Region Handle for this region</param>
156 /// <param name="regionName">Region Name for this region</param> 160 /// <param name="regionName">Region Name for this region</param>
157 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, 161 public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
158 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, ModuleLoader moduleLoader) 162 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
163 ModuleLoader moduleLoader)
159 { 164 {
160 updateLock = new Mutex(false); 165 updateLock = new Mutex(false);
161 166
@@ -190,22 +195,21 @@ namespace OpenSim.Region.Environment.Scenes
190 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 195 Prims = new Dictionary<LLUUID, SceneObjectGroup>();
191 196
192 MainLog.Instance.Verbose("Creating LandMap"); 197 MainLog.Instance.Verbose("Creating LandMap");
193 Terrain = new TerrainEngine((int)this.RegionInfo.RegionLocX, (int)this.RegionInfo.RegionLocY); 198 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
194 199
195 ScenePresence.LoadAnims(); 200 ScenePresence.LoadAnims();
196 201
197 httpListener = httpServer; 202 httpListener = httpServer;
198
199 } 203 }
200 204
201 #endregion 205 #endregion
202 206
203 public void SetModuleInterfaces() 207 public void SetModuleInterfaces()
204 { 208 {
205 m_simChatModule = this.RequestModuleInterface<ISimChat>(); 209 m_simChatModule = RequestModuleInterface<ISimChat>();
206 m_httpRequestModule = this.RequestModuleInterface<IHttpRequests>(); 210 m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
207 211
208 XferManager = this.RequestModuleInterface<IXfer>(); 212 XferManager = RequestModuleInterface<IXfer>();
209 } 213 }
210 214
211 #region Script Handling Methods 215 #region Script Handling Methods
@@ -249,7 +253,8 @@ namespace OpenSim.Region.Environment.Scenes
249 { 253 {
250 if (phyScene.IsThreaded) 254 if (phyScene.IsThreaded)
251 { 255 {
252 phyScene.GetResults(); /// no engines implement this, and what does it have to do with threading? possible DEAD CODE 256 phyScene.GetResults();
257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE
253 } 258 }
254 259
255 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values); 260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
@@ -308,9 +313,10 @@ namespace OpenSim.Region.Environment.Scenes
308 { 313 {
309 for (int y = 0; y < 16; y++) 314 for (int y = 0; y < 16; y++)
310 { 315 {
311 if (Terrain.Tainted(x * 16, y * 16)) 316 if (Terrain.Tainted(x*16, y*16))
312 { 317 {
313 SendLayerData(x, y, presence.ControllingClient, terData); 318 SendLayerData(x, y, presence.ControllingClient,
319 terData);
314 } 320 }
315 } 321 }
316 } 322 }
@@ -340,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes
340 m_timeUpdateCount++; 346 m_timeUpdateCount++;
341 if (m_timeUpdateCount > 600) 347 if (m_timeUpdateCount > 600)
342 { 348 {
343 List<ScenePresence> Avatars = this.RequestAvatarList(); 349 List<ScenePresence> Avatars = RequestAvatarList();
344 foreach (ScenePresence avatar in Avatars) 350 foreach (ScenePresence avatar in Avatars)
345 { 351 {
346 if (!avatar.childAgent) 352 if (!avatar.childAgent)
@@ -398,10 +404,7 @@ namespace OpenSim.Region.Environment.Scenes
398 404
399 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 405 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
400 406
401 ForEachScenePresence(delegate(ScenePresence presence) 407 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
402 {
403 SendLayerData(presence.ControllingClient);
404 });
405 408
406 foreach (LLUUID UUID in Entities.Keys) 409 foreach (LLUUID UUID in Entities.Keys)
407 { 410 {
@@ -429,10 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
429 } 432 }
430 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); 433 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
431 434
432 ForEachScenePresence(delegate(ScenePresence presence) 435 ForEachScenePresence(delegate(ScenePresence presence) { SendLayerData(presence.ControllingClient); });
433 {
434 SendLayerData(presence.ControllingClient);
435 });
436 436
437 foreach (LLUUID UUID in Entities.Keys) 437 foreach (LLUUID UUID in Entities.Keys)
438 { 438 {
@@ -521,23 +521,23 @@ namespace OpenSim.Region.Environment.Scenes
521 public void LoadPrimsFromStorage() 521 public void LoadPrimsFromStorage()
522 { 522 {
523 MainLog.Instance.Verbose("Loading objects from datastore"); 523 MainLog.Instance.Verbose("Loading objects from datastore");
524 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(this.m_regInfo.SimUUID); 524 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID);
525 foreach (SceneObjectGroup prim in PrimsFromDB) 525 foreach (SceneObjectGroup prim in PrimsFromDB)
526 { 526 {
527 AddEntityFromStorage(prim); 527 AddEntityFromStorage(prim);
528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
529 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 529 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
530 rootPart.PhysActor = phyScene.AddPrim( 530 rootPart.PhysActor = phyScene.AddPrim(
531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
532 rootPart.AbsolutePosition.Z),
532 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 533 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
533 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 534 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
534 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 535 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
535 } 536 }
536 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 537 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
537 } 538 }
538 539
539 540
540
541 /// <summary> 541 /// <summary>
542 /// Returns a new unallocated primitive ID 542 /// Returns a new unallocated primitive ID
543 /// </summary> 543 /// </summary>
@@ -561,20 +561,23 @@ namespace OpenSim.Region.Environment.Scenes
561 /// <param name="ownerID"></param> 561 /// <param name="ownerID"></param>
562 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) 562 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
563 { 563 {
564 if (this.PermissionsMngr.CanRezObject(ownerID, pos)) 564 if (PermissionsMngr.CanRezObject(ownerID, pos))
565 { 565 {
566 SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); 566 SceneObjectGroup sceneOb =
567 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
567 AddEntity(sceneOb); 568 AddEntity(sceneOb);
568 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); 569 SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
569 // if grass or tree, make phantom 570 // if grass or tree, make phantom
570 if ((rootPart.Shape.PCode==95) || (rootPart.Shape.PCode==255)) 571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
571 { 572 {
572 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 573 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom;
573 } 574 }
574 // if not phantom, add to physics 575 // if not phantom, add to physics
575 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 576 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
576 rootPart.PhysActor = phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 577 rootPart.PhysActor =
577 new Axiom.Math.Quaternion()); 578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z),
579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
580 new Quaternion());
578 } 581 }
579 } 582 }
580 583
@@ -584,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
584 { 587 {
585 if (obj is SceneObjectGroup) 588 if (obj is SceneObjectGroup)
586 { 589 {
587 if (((SceneObjectGroup)obj).LocalId == localID) 590 if (((SceneObjectGroup) obj).LocalId == localID)
588 { 591 {
589 RemoveEntity((SceneObjectGroup)obj); 592 RemoveEntity((SceneObjectGroup) obj);
590 return; 593 return;
591 } 594 }
592 } 595 }
@@ -595,21 +598,21 @@ namespace OpenSim.Region.Environment.Scenes
595 598
596 public void AddEntityFromStorage(SceneObjectGroup sceneObject) 599 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
597 { 600 {
598 sceneObject.RegionHandle = this.m_regionHandle; 601 sceneObject.RegionHandle = m_regionHandle;
599 sceneObject.SetScene(this); 602 sceneObject.SetScene(this);
600 foreach (SceneObjectPart part in sceneObject.Children.Values) 603 foreach (SceneObjectPart part in sceneObject.Children.Values)
601 { 604 {
602 part.LocalID = this.PrimIDAllocate(); 605 part.LocalID = PrimIDAllocate();
603 } 606 }
604 sceneObject.UpdateParentIDs(); 607 sceneObject.UpdateParentIDs();
605 this.AddEntity(sceneObject); 608 AddEntity(sceneObject);
606 } 609 }
607 610
608 public void AddEntity(SceneObjectGroup sceneObject) 611 public void AddEntity(SceneObjectGroup sceneObject)
609 { 612 {
610 if (!Entities.ContainsKey(sceneObject.UUID)) 613 if (!Entities.ContainsKey(sceneObject.UUID))
611 { 614 {
612 // QuadTree.AddObject(sceneObject); 615 // QuadTree.AddObject(sceneObject);
613 Entities.Add(sceneObject.UUID, sceneObject); 616 Entities.Add(sceneObject.UUID, sceneObject);
614 } 617 }
615 } 618 }
@@ -648,18 +651,19 @@ namespace OpenSim.Region.Environment.Scenes
648 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 651 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
649 { 652 {
650 SceneObjectGroup obj = new SceneObjectGroup(this, 653 SceneObjectGroup obj = new SceneObjectGroup(this,
651 this.m_regionHandle, aPrimNode.OuterXml); 654 m_regionHandle, aPrimNode.OuterXml);
652 //if we want this to be a import method then we need new uuids for the object to avoid any clashes 655 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
653 //obj.RegenerateFullIDs(); 656 //obj.RegenerateFullIDs();
654 AddEntity(obj); 657 AddEntity(obj);
655 658
656 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
657 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 660 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
658 rootPart.PhysActor = phyScene.AddPrim( 661 rootPart.PhysActor = phyScene.AddPrim(
659 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), 662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
660 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 663 rootPart.AbsolutePosition.Z),
661 new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 664 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
662 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); 665 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
666 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
663 primCount++; 667 primCount++;
664 } 668 }
665 } 669 }
@@ -679,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
679 { 683 {
680 if (ent is SceneObjectGroup) 684 if (ent is SceneObjectGroup)
681 { 685 {
682 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); 686 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
683 primCount++; 687 primCount++;
684 } 688 }
685 } 689 }
@@ -688,7 +692,6 @@ namespace OpenSim.Region.Environment.Scenes
688 file.Close(); 692 file.Close();
689 } 693 }
690 694
691
692 #endregion 695 #endregion
693 696
694 #region Add/Remove Avatar Methods 697 #region Add/Remove Avatar Methods
@@ -703,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes
703 { 706 {
704 SubscribeToClientEvents(client); 707 SubscribeToClientEvents(client);
705 m_estateManager.sendRegionHandshake(client); 708 m_estateManager.sendRegionHandshake(client);
706 CreateAndAddScenePresence(client, child ); 709 CreateAndAddScenePresence(client, child);
707 m_LandManager.sendParcelOverlay(client); 710 m_LandManager.sendParcelOverlay(client);
708 commsManager.UserProfiles.AddNewUser(client.AgentId); 711 commsManager.UserProfiles.AddNewUser(client.AgentId);
709 commsManager.TransactionsManager.AddUser(client.AgentId); 712 commsManager.TransactionsManager.AddUser(client.AgentId);
@@ -744,9 +747,11 @@ namespace OpenSim.Region.Environment.Scenes
744 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest); 747 client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
745 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest); 748 client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
746 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest); 749 client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest);
747 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest); 750 client.OnParcelPropertiesUpdateRequest +=
751 new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest);
748 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest); 752 client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
749 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); 753 client.OnParcelObjectOwnerRequest +=
754 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
750 755
751 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 756 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
752 757
@@ -768,7 +773,7 @@ namespace OpenSim.Region.Environment.Scenes
768 EventManager.TriggerOnNewClient(client); 773 EventManager.TriggerOnNewClient(client);
769 } 774 }
770 775
771 protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child ) 776 protected ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
772 { 777 {
773 ScenePresence newAvatar = null; 778 ScenePresence newAvatar = null;
774 779
@@ -777,16 +782,18 @@ namespace OpenSim.Region.Environment.Scenes
777 782
778 if (child) 783 if (child)
779 { 784 {
780 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new child agent."); 785 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new child agent.");
781 } 786 }
782 else 787 else
783 { 788 {
784 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement; 789 newAvatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
785 790
786 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Creating new root agent."); 791 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent.");
787 MainLog.Instance.Verbose(this.RegionInfo.RegionName + ": Adding Physical agent."); 792 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent.");
788 793
789 PhysicsVector pVec = new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, newAvatar.AbsolutePosition.Z); 794 PhysicsVector pVec =
795 new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y,
796 newAvatar.AbsolutePosition.Z);
790 lock (m_syncRoot) 797 lock (m_syncRoot)
791 { 798 {
792 newAvatar.PhysActor = phyScene.AddAvatar(pVec); 799 newAvatar.PhysActor = phyScene.AddAvatar(pVec);
@@ -832,14 +839,14 @@ namespace OpenSim.Region.Environment.Scenes
832 839
833 ForEachScenePresence( 840 ForEachScenePresence(
834 delegate(ScenePresence presence) 841 delegate(ScenePresence presence)
835 {
836 presence.CoarseLocationChange(avatar);
837 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
838 if (presence.PhysActor != null)
839 { 842 {
840 phyScene.RemoveAvatar(presence.PhysActor); 843 presence.CoarseLocationChange(avatar);
841 } 844 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
842 }); 845 if (presence.PhysActor != null)
846 {
847 phyScene.RemoveAvatar(presence.PhysActor);
848 }
849 });
843 850
844 lock (Avatars) 851 lock (Avatars)
845 { 852 {
@@ -943,7 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
943 if (Entities.ContainsKey(entID)) 950 if (Entities.ContainsKey(entID))
944 { 951 {
945 Entities.Remove(entID); 952 Entities.Remove(entID);
946 storageManager.DataStore.RemoveObject(entID, this.m_regInfo.SimUUID); 953 storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID);
947 return true; 954 return true;
948 } 955 }
949 return false; 956 return false;
@@ -951,10 +958,10 @@ namespace OpenSim.Region.Environment.Scenes
951 958
952 public void SendKillObject(uint localID) 959 public void SendKillObject(uint localID)
953 { 960 {
954 List<ScenePresence> avatars = this.RequestAvatarList(); 961 List<ScenePresence> avatars = RequestAvatarList();
955 for (int i = 0; i < avatars.Count; i++) 962 for (int i = 0; i < avatars.Count; i++)
956 { 963 {
957 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, localID); 964 avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID);
958 } 965 }
959 } 966 }
960 967
@@ -964,8 +971,8 @@ namespace OpenSim.Region.Environment.Scenes
964 { 971 {
965 if (ent is SceneObjectGroup) 972 if (ent is SceneObjectGroup)
966 { 973 {
967 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 974 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
968 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 975 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
969 } 976 }
970 } 977 }
971 } 978 }
@@ -999,15 +1006,19 @@ namespace OpenSim.Region.Environment.Scenes
999 if (agent.CapsPath != "") 1006 if (agent.CapsPath != "")
1000 { 1007 {
1001 //Console.WriteLine("new user, so creating caps handler for it"); 1008 //Console.WriteLine("new user, so creating caps handler for it");
1002 Caps cap = new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port, agent.CapsPath, agent.AgentID); 1009 Caps cap =
1003 Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); 1010 new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
1011 agent.CapsPath, agent.AgentID);
1012 Util.SetCapsURL(agent.AgentID,
1013 "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
1014 "/CAPS/" + agent.CapsPath + "0000/");
1004 cap.RegisterHandlers(); 1015 cap.RegisterHandlers();
1005 cap.AddNewInventoryItem = this.AddInventoryItem; 1016 cap.AddNewInventoryItem = AddInventoryItem;
1006 cap.ItemUpdatedCall = this.CapsUpdateInventoryItemAsset; 1017 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
1007 if (capsHandlers.ContainsKey(agent.AgentID)) 1018 if (capsHandlers.ContainsKey(agent.AgentID))
1008 { 1019 {
1009 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + 1020 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
1010 agent.AgentID.ToStringHyphenated()); 1021 agent.AgentID.ToStringHyphenated());
1011 capsHandlers[agent.AgentID] = cap; 1022 capsHandlers[agent.AgentID] = cap;
1012 } 1023 }
1013 else 1024 else
@@ -1142,43 +1153,25 @@ namespace OpenSim.Region.Environment.Scenes
1142 1153
1143 public void AddModule(string name, IRegionModule module) 1154 public void AddModule(string name, IRegionModule module)
1144 { 1155 {
1145 if (!this.Modules.ContainsKey(name)) 1156 if (!Modules.ContainsKey(name))
1146 { 1157 {
1147 Modules.Add(name, module); 1158 Modules.Add(name, module);
1148 } 1159 }
1149 } 1160 }
1150 1161
1151 //following delegate methods will be removed, so use the interface methods (below these)
1152 public void RegisterAPIMethod(string name, object method)
1153 {
1154 if (!this.ModuleAPIMethods.ContainsKey(name))
1155 {
1156 this.ModuleAPIMethods.Add(name, method);
1157 }
1158 }
1159
1160 public object RequestAPIMethod(string name)
1161 {
1162 if (this.ModuleAPIMethods.ContainsKey(name))
1163 {
1164 return ModuleAPIMethods[name];
1165 }
1166 return false;
1167 }
1168
1169 public void RegisterModuleInterface<M>(M mod) 1162 public void RegisterModuleInterface<M>(M mod)
1170 { 1163 {
1171 if (!this.ModuleInterfaces.ContainsKey(typeof(M))) 1164 if (!ModuleInterfaces.ContainsKey(typeof (M)))
1172 { 1165 {
1173 ModuleInterfaces.Add(typeof(M), mod); 1166 ModuleInterfaces.Add(typeof (M), mod);
1174 } 1167 }
1175 } 1168 }
1176 1169
1177 public T RequestModuleInterface<T>() 1170 public T RequestModuleInterface<T>()
1178 { 1171 {
1179 if (ModuleInterfaces.ContainsKey(typeof(T))) 1172 if (ModuleInterfaces.ContainsKey(typeof (T)))
1180 { 1173 {
1181 return (T)ModuleInterfaces[typeof(T)]; 1174 return (T) ModuleInterfaces[typeof (T)];
1182 } 1175 }
1183 else 1176 else
1184 { 1177 {
@@ -1191,7 +1184,8 @@ namespace OpenSim.Region.Environment.Scenes
1191 m_timePhase = phase; 1184 m_timePhase = phase;
1192 } 1185 }
1193 1186
1194 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) 1187 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned,
1188 string message, string url)
1195 { 1189 {
1196 if (Avatars.ContainsKey(avatarID)) 1190 if (Avatars.ContainsKey(avatarID))
1197 { 1191 {
@@ -1201,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
1201 1195
1202 #region Alert Methods 1196 #region Alert Methods
1203 1197
1204 void SendPermissionAlert(LLUUID user, string reason) 1198 private void SendPermissionAlert(LLUUID user, string reason)
1205 { 1199 {
1206 SendAlertToUser(user, reason, false); 1200 SendAlertToUser(user, reason, false);
1207 } 1201 }
@@ -1209,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
1209 1203
1210 public void SendGeneralAlert(string message) 1204 public void SendGeneralAlert(string message)
1211 { 1205 {
1212 foreach (ScenePresence presence in this.Avatars.Values) 1206 foreach (ScenePresence presence in Avatars.Values)
1213 { 1207 {
1214 presence.ControllingClient.SendAlertMessage(message); 1208 presence.ControllingClient.SendAlertMessage(message);
1215 } 1209 }
@@ -1217,15 +1211,15 @@ namespace OpenSim.Region.Environment.Scenes
1217 1211
1218 public void SendAlertToUser(LLUUID agentID, string message, bool modal) 1212 public void SendAlertToUser(LLUUID agentID, string message, bool modal)
1219 { 1213 {
1220 if (this.Avatars.ContainsKey(agentID)) 1214 if (Avatars.ContainsKey(agentID))
1221 { 1215 {
1222 this.Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal); 1216 Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
1223 } 1217 }
1224 } 1218 }
1225 1219
1226 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 1220 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
1227 { 1221 {
1228 foreach (ScenePresence presence in this.Avatars.Values) 1222 foreach (ScenePresence presence in Avatars.Values)
1229 { 1223 {
1230 if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) 1224 if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
1231 { 1225 {
@@ -1239,13 +1233,13 @@ namespace OpenSim.Region.Environment.Scenes
1239 { 1233 {
1240 if (commandParams[0] == "general") 1234 if (commandParams[0] == "general")
1241 { 1235 {
1242 string message = this.CombineParams(commandParams, 1); 1236 string message = CombineParams(commandParams, 1);
1243 this.SendGeneralAlert(message); 1237 SendGeneralAlert(message);
1244 } 1238 }
1245 else 1239 else
1246 { 1240 {
1247 string message = this.CombineParams(commandParams, 2); 1241 string message = CombineParams(commandParams, 2);
1248 this.SendAlertToUser(commandParams[0], commandParams[1], message, false); 1242 SendAlertToUser(commandParams[0], commandParams[1], message, false);
1249 } 1243 }
1250 } 1244 }
1251 1245
@@ -1258,36 +1252,39 @@ namespace OpenSim.Region.Environment.Scenes
1258 } 1252 }
1259 return result; 1253 return result;
1260 } 1254 }
1255
1261 #endregion 1256 #endregion
1262 1257
1263 public void ForceClientUpdate() 1258 public void ForceClientUpdate()
1264 { 1259 {
1265 foreach (EntityBase ent in this.Entities.Values) 1260 foreach (EntityBase ent in Entities.Values)
1266 { 1261 {
1267 if (ent is SceneObjectGroup) 1262 if (ent is SceneObjectGroup)
1268 { 1263 {
1269 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 1264 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
1270 } 1265 }
1271 } 1266 }
1272 } 1267 }
1273 1268
1274 public void HandleEditCommand(string[] cmmdparams) 1269 public void HandleEditCommand(string[] cmmdparams)
1275 { 1270 {
1276 Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); 1271 Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'");
1277 foreach (EntityBase ent in this.Entities.Values) 1272 foreach (EntityBase ent in Entities.Values)
1278 { 1273 {
1279 if (ent is SceneObjectGroup) 1274 if (ent is SceneObjectGroup)
1280 { 1275 {
1281 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); 1276 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
1282 if (part != null) 1277 if (part != null)
1283 { 1278 {
1284 if (part.Name == cmmdparams[0]) 1279 if (part.Name == cmmdparams[0])
1285 { 1280 {
1286 part.Resize( new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), Convert.ToSingle(cmmdparams[3]))); 1281 part.Resize(
1287 1282 new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]),
1288 Console.WriteLine("Edited scale of Primitive: " + part.Name); 1283 Convert.ToSingle(cmmdparams[3])));
1289 } 1284
1290 } 1285 Console.WriteLine("Edited scale of Primitive: " + part.Name);
1286 }
1287 }
1291 } 1288 }
1292 } 1289 }
1293 } 1290 }
@@ -1298,7 +1295,9 @@ namespace OpenSim.Region.Environment.Scenes
1298 { 1295 {
1299 case "users": 1296 case "users":
1300 MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); 1297 MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName);
1301 MainLog.Instance.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 1298 MainLog.Instance.Error(
1299 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
1300 "Agent ID", "Session ID", "Circuit", "IP", "World"));
1302 1301
1303 foreach (EntityBase entity in Entities.Values) 1302 foreach (EntityBase entity in Entities.Values)
1304 { 1303 {
@@ -1321,8 +1320,8 @@ namespace OpenSim.Region.Environment.Scenes
1321 } 1320 }
1322 break; 1321 break;
1323 case "modules": 1322 case "modules":
1324 MainLog.Instance.Error("The currently loaded modules in " + this.RegionInfo.RegionName + " are:"); 1323 MainLog.Instance.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
1325 foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in this.Modules.Values) 1324 foreach (IRegionModule module in Modules.Values)
1326 { 1325 {
1327 if (!module.IsSharedModule()) 1326 if (!module.IsSharedModule())
1328 { 1327 {
@@ -1337,19 +1336,22 @@ namespace OpenSim.Region.Environment.Scenes
1337 { 1336 {
1338 if (m_httpRequestModule != null) 1337 if (m_httpRequestModule != null)
1339 { 1338 {
1340 return m_httpRequestModule.MakeHttpRequest(url, type, body); 1339 return m_httpRequestModule.MakeHttpRequest(url, type, body);
1341 } 1340 }
1342 return LLUUID.Zero; 1341 return LLUUID.Zero;
1343 } 1342 }
1344 1343
1345 #region Script Engine 1344 #region Script Engine
1346 private List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface> ScriptEngines = new List<OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface>(); 1345
1347 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) 1346 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
1347
1348 public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger)
1348 { 1349 {
1349 ScriptEngines.Add(ScriptEngine); 1350 ScriptEngines.Add(ScriptEngine);
1350 1351
1351 ScriptEngine.InitializeEngine(this, m_logger); 1352 ScriptEngine.InitializeEngine(this, m_logger);
1352 } 1353 }
1354
1353 #endregion 1355 #endregion
1354 1356
1355 public LLUUID ConvertLocalIDToFullID(uint localID) 1357 public LLUUID ConvertLocalIDToFullID(uint localID)
@@ -1359,10 +1361,10 @@ namespace OpenSim.Region.Environment.Scenes
1359 { 1361 {
1360 if (ent is SceneObjectGroup) 1362 if (ent is SceneObjectGroup)
1361 { 1363 {
1362 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1364 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1363 if (hasPrim != false) 1365 if (hasPrim != false)
1364 { 1366 {
1365 return ((SceneObjectGroup)ent).GetPartsFullID(localID); 1367 return ((SceneObjectGroup) ent).GetPartsFullID(localID);
1366 } 1368 }
1367 } 1369 }
1368 } 1370 }
@@ -1376,10 +1378,10 @@ namespace OpenSim.Region.Environment.Scenes
1376 { 1378 {
1377 if (ent is SceneObjectGroup) 1379 if (ent is SceneObjectGroup)
1378 { 1380 {
1379 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1381 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1380 if (hasPrim != false) 1382 if (hasPrim != false)
1381 { 1383 {
1382 return ((SceneObjectGroup)ent).GetChildPart(localID); 1384 return ((SceneObjectGroup) ent).GetChildPart(localID);
1383 } 1385 }
1384 } 1386 }
1385 } 1387 }
@@ -1393,14 +1395,14 @@ namespace OpenSim.Region.Environment.Scenes
1393 { 1395 {
1394 if (ent is SceneObjectGroup) 1396 if (ent is SceneObjectGroup)
1395 { 1397 {
1396 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); 1398 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
1397 if (hasPrim != false) 1399 if (hasPrim != false)
1398 { 1400 {
1399 return ((SceneObjectGroup)ent).GetChildPart(fullID); 1401 return ((SceneObjectGroup) ent).GetChildPart(fullID);
1400 } 1402 }
1401 } 1403 }
1402 } 1404 }
1403 return null; 1405 return null;
1404 } 1406 }
1405 } 1407 }
1406} 1408} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index c01157d..7b2e17f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -27,15 +27,12 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework.Communications.Caches;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework.Types; 34using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Region.Terrain; 35using OpenSim.Region.Terrain;
37using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces;
39 36
40namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
41{ 38{
@@ -67,6 +64,7 @@ namespace OpenSim.Region.Environment.Scenes
67 protected AssetCache assetCache; 64 protected AssetCache assetCache;
68 65
69 #region Update Methods 66 #region Update Methods
67
70 /// <summary> 68 /// <summary>
71 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) 69 /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
72 /// </summary> 70 /// </summary>
@@ -104,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
104 #endregion 102 #endregion
105 103
106 #region Add/Remove Agent/Avatar 104 #region Add/Remove Agent/Avatar
105
107 /// <summary> 106 /// <summary>
108 /// 107 ///
109 /// </summary> 108 /// </summary>
@@ -126,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
126 /// <returns></returns> 125 /// <returns></returns>
127 public virtual RegionInfo RegionInfo 126 public virtual RegionInfo RegionInfo
128 { 127 {
129 get { return this.m_regInfo; } 128 get { return m_regInfo; }
130 } 129 }
131 130
132 public object SyncRoot 131 public object SyncRoot
@@ -140,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
140 } 139 }
141 140
142 #region Shutdown 141 #region Shutdown
142
143 /// <summary> 143 /// <summary>
144 /// Tidy before shutdown 144 /// Tidy before shutdown
145 /// </summary> 145 /// </summary>
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes
147 { 147 {
148 try 148 try
149 { 149 {
150 this.EventManager.TriggerShutdown(); 150 EventManager.TriggerShutdown();
151 } 151 }
152 catch (Exception e) 152 catch (Exception e)
153 { 153 {
@@ -156,7 +156,5 @@ namespace OpenSim.Region.Environment.Scenes
156 } 156 }
157 157
158 #endregion 158 #endregion
159
160
161 } 159 }
162} 160} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index a86a1bc..a5d8667 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -1,5 +1,6 @@
1using libsecondlife; 1using libsecondlife;
2using OpenSim.Framework.Interfaces; 2using OpenSim.Framework.Interfaces;
3using OpenSim.Region.Environment.Interfaces;
3 4
4namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
5{ 6{
@@ -9,41 +10,54 @@ namespace OpenSim.Region.Environment.Scenes
9 public class EventManager 10 public class EventManager
10 { 11 {
11 public delegate void OnFrameDelegate(); 12 public delegate void OnFrameDelegate();
13
12 public event OnFrameDelegate OnFrame; 14 public event OnFrameDelegate OnFrame;
13 15
14 public delegate void OnBackupDelegate(Interfaces.IRegionDataStore datastore); 16 public delegate void OnBackupDelegate(IRegionDataStore datastore);
17
15 public event OnBackupDelegate OnBackup; 18 public event OnBackupDelegate OnBackup;
16 19
17 public delegate void OnNewClientDelegate(IClientAPI client); 20 public delegate void OnNewClientDelegate(IClientAPI client);
21
18 public event OnNewClientDelegate OnNewClient; 22 public event OnNewClientDelegate OnNewClient;
19 23
20 public delegate void OnNewPresenceDelegate(ScenePresence presence); 24 public delegate void OnNewPresenceDelegate(ScenePresence presence);
25
21 public event OnNewPresenceDelegate OnNewPresence; 26 public event OnNewPresenceDelegate OnNewPresence;
22 27
23 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 28 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
29
24 public event OnRemovePresenceDelegate OnRemovePresence; 30 public event OnRemovePresenceDelegate OnRemovePresence;
25 31
26 public delegate void OnParcelPrimCountUpdateDelegate(); 32 public delegate void OnParcelPrimCountUpdateDelegate();
33
27 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; 34 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
28 35
29 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj); 36 public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
37
30 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; 38 public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
31 39
32 public delegate void OnScriptConsoleDelegate(string[] args); 40 public delegate void OnScriptConsoleDelegate(string[] args);
41
33 public event OnScriptConsoleDelegate OnScriptConsole; 42 public event OnScriptConsoleDelegate OnScriptConsole;
34 43
35 public delegate void OnShutdownDelegate(); 44 public delegate void OnShutdownDelegate();
45
36 public event OnShutdownDelegate OnShutdown; 46 public event OnShutdownDelegate OnShutdown;
37 47
38 public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); 48 public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
49
39 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); 50 public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
51
40 public event ObjectGrabDelegate OnObjectGrab; 52 public event ObjectGrabDelegate OnObjectGrab;
41 public event OnPermissionErrorDelegate OnPermissionError; 53 public event OnPermissionErrorDelegate OnPermissionError;
42 54
43 public delegate void NewRezScript(uint localID, LLUUID itemID, string script); 55 public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
56
44 public event NewRezScript OnRezScript; 57 public event NewRezScript OnRezScript;
45 58
46 public delegate void RemoveScript(uint localID, LLUUID itemID); 59 public delegate void RemoveScript(uint localID, LLUUID itemID);
60
47 public event RemoveScript OnRemoveScript; 61 public event RemoveScript OnRemoveScript;
48 62
49 public void TriggerPermissionError(LLUUID user, string reason) 63 public void TriggerPermissionError(LLUUID user, string reason)
@@ -86,7 +100,7 @@ namespace OpenSim.Region.Environment.Scenes
86 } 100 }
87 } 101 }
88 102
89 public void TriggerOnBackup(Interfaces.IRegionDataStore dstore) 103 public void TriggerOnBackup(IRegionDataStore dstore)
90 { 104 {
91 if (OnBackup != null) 105 if (OnBackup != null)
92 { 106 {
@@ -101,6 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
101 OnParcelPrimCountUpdate(); 115 OnParcelPrimCountUpdate();
102 } 116 }
103 } 117 }
118
104 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) 119 public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
105 { 120 {
106 if (OnParcelPrimCountAdd != null) 121 if (OnParcelPrimCountAdd != null)
@@ -137,4 +152,4 @@ namespace OpenSim.Region.Environment.Scenes
137 } 152 }
138 } 153 }
139 } 154 }
140} 155} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 5655e72..effd4b2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -1,20 +1,18 @@
1using System.Collections.Generic; 1using System;
2using System; 2using System.Collections.Generic;
3using OpenSim.Framework.Console; 3using OpenSim.Framework.Console;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5 5
6namespace OpenSim.Region.Environment.Scenes 6namespace OpenSim.Region.Environment.Scenes
7{ 7{
8 public class SceneManager 8 public class SceneManager
9 { 9 {
10 private readonly List<Scene> m_localScenes; 10 private readonly List<Scene> m_localScenes;
11 private Scene m_currentScene = null; 11 private Scene m_currentScene = null;
12
12 public Scene CurrentScene 13 public Scene CurrentScene
13 { 14 {
14 get 15 get { return m_currentScene; }
15 {
16 return m_currentScene;
17 }
18 } 16 }
19 17
20 private Scene CurrentOrFirstScene 18 private Scene CurrentOrFirstScene
@@ -83,18 +81,12 @@ namespace OpenSim.Region.Environment.Scenes
83 81
84 public void SendCommandToScripts(string[] cmdparams) 82 public void SendCommandToScripts(string[] cmdparams)
85 { 83 {
86 ForEach(delegate(Scene scene) 84 ForEach(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); });
87 {
88 scene.SendCommandToScripts(cmdparams);
89 });
90 } 85 }
91 86
92 public void BypassPermissions(bool bypassPermissions) 87 public void BypassPermissions(bool bypassPermissions)
93 { 88 {
94 ForEach(delegate(Scene scene) 89 ForEach(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
95 {
96 scene.PermissionsMngr.BypassPermissions = bypassPermissions;
97 });
98 } 90 }
99 91
100 private void ForEach(Action<Scene> func) 92 private void ForEach(Action<Scene> func)
@@ -111,18 +103,12 @@ namespace OpenSim.Region.Environment.Scenes
111 103
112 public void Backup() 104 public void Backup()
113 { 105 {
114 ForEach(delegate(Scene scene) 106 ForEach(delegate(Scene scene) { scene.Backup(); });
115 {
116 scene.Backup();
117 });
118 } 107 }
119 108
120 public void HandleAlertCommand(string[] cmdparams) 109 public void HandleAlertCommand(string[] cmdparams)
121 { 110 {
122 ForEach(delegate(Scene scene) 111 ForEach(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
123 {
124 scene.HandleAlertCommand(cmdparams);
125 });
126 } 112 }
127 113
128 public bool TrySetCurrentRegion(string regionName) 114 public bool TrySetCurrentRegion(string regionName)
@@ -161,8 +147,8 @@ namespace OpenSim.Region.Environment.Scenes
161 if (!scenePrescence.childAgent) 147 if (!scenePrescence.childAgent)
162 { 148 {
163 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 149 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
164 scenePrescence.Firstname, scenePrescence.Lastname, 150 scenePrescence.Firstname, scenePrescence.Lastname,
165 newDebug)); 151 newDebug));
166 152
167 scenePrescence.ControllingClient.SetDebug(newDebug); 153 scenePrescence.ControllingClient.SetDebug(newDebug);
168 } 154 }
@@ -219,18 +205,12 @@ namespace OpenSim.Region.Environment.Scenes
219 205
220 public void ForceClientUpdate() 206 public void ForceClientUpdate()
221 { 207 {
222 ForEach(delegate(Scene scene) 208 ForEach(delegate(Scene scene) { scene.ForceClientUpdate(); });
223 {
224 scene.ForceClientUpdate();
225 });
226 } 209 }
227 210
228 public void HandleEditCommand(string[] cmdparams) 211 public void HandleEditCommand(string[] cmdparams)
229 { 212 {
230 ForEach(delegate(Scene scene) 213 ForEach(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
231 {
232 scene.HandleEditCommand(cmdparams);
233 });
234 } 214 }
235 } 215 }
236} 216} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 99f1900..3182204 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1,17 +1,16 @@
1using System;
1using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO;
2using System.Text; 4using System.Text;
3using System.Xml; 5using System.Xml;
4using System.Xml.Serialization;
5using System.IO;
6using System;
7using Axiom.Math; 6using Axiom.Math;
8using libsecondlife; 7using libsecondlife;
9using libsecondlife.Packets; 8using libsecondlife.Packets;
9using OpenSim.Framework.Data;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Region.Physics.Manager;
13using OpenSim.Framework.Data;
14using OpenSim.Region.Environment.Interfaces; 12using OpenSim.Region.Environment.Interfaces;
13using OpenSim.Region.Physics.Manager;
15 14
16namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
17{ 16{
@@ -31,6 +30,7 @@ namespace OpenSim.Region.Environment.Scenes
31 public bool HasChanged = false; 30 public bool HasChanged = false;
32 31
33 #region Properties 32 #region Properties
33
34 /// <summary> 34 /// <summary>
35 /// 35 ///
36 /// </summary> 36 /// </summary>
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Scenes
54 54
55 public Dictionary<LLUUID, SceneObjectPart> Children 55 public Dictionary<LLUUID, SceneObjectPart> Children
56 { 56 {
57 get { return this.m_parts; } 57 get { return m_parts; }
58 set { m_parts = value; } 58 set { m_parts = value; }
59 } 59 }
60 60
61 public SceneObjectPart RootPart 61 public SceneObjectPart RootPart
62 { 62 {
63 get { return this.m_rootPart; } 63 get { return m_rootPart; }
64 set { m_rootPart = value; } 64 set { m_rootPart = value; }
65 } 65 }
66 66
@@ -70,9 +70,9 @@ namespace OpenSim.Region.Environment.Scenes
70 set 70 set
71 { 71 {
72 m_regionHandle = value; 72 m_regionHandle = value;
73 lock (this.m_parts) 73 lock (m_parts)
74 { 74 {
75 foreach (SceneObjectPart part in this.m_parts.Values) 75 foreach (SceneObjectPart part in m_parts.Values)
76 { 76 {
77 part.RegionHandle = m_regionHandle; 77 part.RegionHandle = m_regionHandle;
78 } 78 }
@@ -104,16 +104,18 @@ namespace OpenSim.Region.Environment.Scenes
104 val.Y = 0.4f; 104 val.Y = 0.4f;
105 } 105 }
106 106
107 lock (this.m_parts) 107 lock (m_parts)
108 { 108 {
109 foreach (SceneObjectPart part in this.m_parts.Values) 109 foreach (SceneObjectPart part in m_parts.Values)
110 { 110 {
111 part.GroupPosition = val; 111 part.GroupPosition = val;
112 } 112 }
113 } 113 }
114 if (m_rootPart.PhysActor != null) 114 if (m_rootPart.PhysActor != null)
115 { 115 {
116 m_rootPart.PhysActor.Position = new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, m_rootPart.GroupPosition.Z); 116 m_rootPart.PhysActor.Position =
117 new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
118 m_rootPart.GroupPosition.Z);
117 } 119 }
118 } 120 }
119 } 121 }
@@ -152,10 +154,7 @@ namespace OpenSim.Region.Environment.Scenes
152 154
153 protected virtual bool InSceneBackup 155 protected virtual bool InSceneBackup
154 { 156 {
155 get 157 get { return true; }
156 {
157 return true;
158 }
159 } 158 }
160 159
161 public bool IsSelected 160 public bool IsSelected
@@ -170,19 +169,22 @@ namespace OpenSim.Region.Environment.Scenes
170 get 169 get
171 { 170 {
172 if (m_scene != null) 171 if (m_scene != null)
173 { return m_scene.RegionInfo.SimUUID; } 172 {
173 return m_scene.RegionInfo.SimUUID;
174 }
174 return LLUUID.Zero; 175 return LLUUID.Zero;
175 } 176 }
176 } 177 }
178
177 #endregion 179 #endregion
178 180
179 #region Constructors 181 #region Constructors
182
180 /// <summary> 183 /// <summary>
181 /// 184 ///
182 /// </summary> 185 /// </summary>
183 public SceneObjectGroup() 186 public SceneObjectGroup()
184 { 187 {
185
186 } 188 }
187 189
188 /// <summary> 190 /// <summary>
@@ -198,7 +200,7 @@ namespace OpenSim.Region.Environment.Scenes
198 reader.Read(); 200 reader.Read();
199 reader.ReadStartElement("SceneObjectGroup"); 201 reader.ReadStartElement("SceneObjectGroup");
200 reader.ReadStartElement("RootPart"); 202 reader.ReadStartElement("RootPart");
201 this.m_rootPart = SceneObjectPart.FromXml(reader); 203 m_rootPart = SceneObjectPart.FromXml(reader);
202 reader.ReadEndElement(); 204 reader.ReadEndElement();
203 205
204 while (reader.Read()) 206 while (reader.Read())
@@ -211,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
211 reader.Read(); 213 reader.Read();
212 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 214 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
213 Part.LocalID = m_scene.PrimIDAllocate(); 215 Part.LocalID = m_scene.PrimIDAllocate();
214 this.AddPart(Part); 216 AddPart(Part);
215 Part.RegionHandle = m_regionHandle; 217 Part.RegionHandle = m_regionHandle;
216 } 218 }
217 break; 219 break;
@@ -221,23 +223,23 @@ namespace OpenSim.Region.Environment.Scenes
221 } 223 }
222 reader.Close(); 224 reader.Close();
223 sr.Close(); 225 sr.Close();
224 this.m_rootPart.SetParent(this); 226 m_rootPart.SetParent(this);
225 this.m_parts.Add(m_rootPart.UUID, m_rootPart); 227 m_parts.Add(m_rootPart.UUID, m_rootPart);
226 this.m_rootPart.LocalID = m_scene.PrimIDAllocate(); 228 m_rootPart.LocalID = m_scene.PrimIDAllocate();
227 this.m_rootPart.ParentID = 0; 229 m_rootPart.ParentID = 0;
228 this.m_rootPart.RegionHandle = m_regionHandle; 230 m_rootPart.RegionHandle = m_regionHandle;
229 this.UpdateParentIDs(); 231 UpdateParentIDs();
230 232
231 AttachToBackup(); 233 AttachToBackup();
232 234
233 this.ScheduleGroupForFullUpdate(); 235 ScheduleGroupForFullUpdate();
234 } 236 }
235 237
236 private void AttachToBackup() 238 private void AttachToBackup()
237 { 239 {
238 if (InSceneBackup) 240 if (InSceneBackup)
239 { 241 {
240 m_scene.EventManager.OnBackup += this.ProcessBackup; 242 m_scene.EventManager.OnBackup += ProcessBackup;
241 } 243 }
242 } 244 }
243 245
@@ -246,25 +248,27 @@ namespace OpenSim.Region.Environment.Scenes
246 /// </summary> 248 /// </summary>
247 public SceneObjectGroup(byte[] data) 249 public SceneObjectGroup(byte[] data)
248 { 250 {
249
250 } 251 }
251 252
252 /// <summary> 253 /// <summary>
253 /// 254 ///
254 /// </summary> 255 /// </summary>
255 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 256 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos,
257 PrimitiveBaseShape shape)
256 { 258 {
257 m_regionHandle = regionHandle; 259 m_regionHandle = regionHandle;
258 m_scene = scene; 260 m_scene = scene;
259 261
260 // this.Pos = pos; 262 // this.Pos = pos;
261 LLVector3 rootOffset = new LLVector3(0, 0, 0); 263 LLVector3 rootOffset = new LLVector3(0, 0, 0);
262 SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); 264 SceneObjectPart newPart =
263 this.m_parts.Add(newPart.UUID, newPart); 265 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
264 this.SetPartAsRoot(newPart); 266 m_parts.Add(newPart.UUID, newPart);
267 SetPartAsRoot(newPart);
265 268
266 AttachToBackup(); 269 AttachToBackup();
267 } 270 }
271
268 #endregion 272 #endregion
269 273
270 public string ToXmlString() 274 public string ToXmlString()
@@ -276,9 +280,9 @@ namespace OpenSim.Region.Environment.Scenes
276 m_rootPart.ToXml(writer); 280 m_rootPart.ToXml(writer);
277 writer.WriteEndElement(); 281 writer.WriteEndElement();
278 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); 282 writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
279 foreach (SceneObjectPart part in this.m_parts.Values) 283 foreach (SceneObjectPart part in m_parts.Values)
280 { 284 {
281 if (part.UUID != this.m_rootPart.UUID) 285 if (part.UUID != m_rootPart.UUID)
282 { 286 {
283 writer.WriteStartElement(String.Empty, "Part", String.Empty); 287 writer.WriteStartElement(String.Empty, "Part", String.Empty);
284 part.ToXml(writer); 288 part.ToXml(writer);
@@ -292,35 +296,36 @@ namespace OpenSim.Region.Environment.Scenes
292 } 296 }
293 297
294 #region Copying 298 #region Copying
299
295 /// <summary> 300 /// <summary>
296 /// 301 ///
297 /// </summary> 302 /// </summary>
298 /// <returns></returns> 303 /// <returns></returns>
299 public new SceneObjectGroup Copy() 304 public new SceneObjectGroup Copy()
300 { 305 {
301 SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); 306 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
302 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 307 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
303 dupe.m_parts.Clear(); 308 dupe.m_parts.Clear();
304 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 309 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
305 dupe.m_scene = m_scene; 310 dupe.m_scene = m_scene;
306 dupe.m_regionHandle = this.m_regionHandle; 311 dupe.m_regionHandle = m_regionHandle;
307 dupe.CopyRootPart(this.m_rootPart); 312 dupe.CopyRootPart(m_rootPart);
308 313
309 /// may need to create a new Physics actor. 314 /// may need to create a new Physics actor.
310 if (dupe.RootPart.PhysActor != null) 315 if (dupe.RootPart.PhysActor != null)
311 { 316 {
312 dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim( 317 dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim(
313 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), 318 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
314 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 319 dupe.RootPart.AbsolutePosition.Z),
315 new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 320 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
316 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); 321 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
317 322 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z));
318 } 323 }
319 324
320 List<SceneObjectPart> partList = new List<SceneObjectPart>(this.m_parts.Values); 325 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
321 foreach (SceneObjectPart part in partList) 326 foreach (SceneObjectPart part in partList)
322 { 327 {
323 if (part.UUID != this.m_rootPart.UUID) 328 if (part.UUID != m_rootPart.UUID)
324 { 329 {
325 dupe.CopyPart(part); 330 dupe.CopyPart(part);
326 } 331 }
@@ -328,7 +333,7 @@ namespace OpenSim.Region.Environment.Scenes
328 dupe.UpdateParentIDs(); 333 dupe.UpdateParentIDs();
329 334
330 dupe.AttachToBackup(); 335 dupe.AttachToBackup();
331 336
332 return dupe; 337 return dupe;
333 } 338 }
334 339
@@ -340,8 +345,8 @@ namespace OpenSim.Region.Environment.Scenes
340 { 345 {
341 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 346 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
342 newPart.SetParent(this); 347 newPart.SetParent(this);
343 this.m_parts.Add(newPart.UUID, newPart); 348 m_parts.Add(newPart.UUID, newPart);
344 this.SetPartAsRoot(newPart); 349 SetPartAsRoot(newPart);
345 } 350 }
346 351
347 /// <summary> 352 /// <summary>
@@ -352,18 +357,20 @@ namespace OpenSim.Region.Environment.Scenes
352 { 357 {
353 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); 358 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
354 newPart.SetParent(this); 359 newPart.SetParent(this);
355 this.m_parts.Add(newPart.UUID, newPart); 360 m_parts.Add(newPart.UUID, newPart);
356 this.SetPartAsNonRoot(newPart); 361 SetPartAsNonRoot(newPart);
357 } 362 }
363
358 #endregion 364 #endregion
359 365
360 #region Scheduling 366 #region Scheduling
367
361 /// <summary> 368 /// <summary>
362 /// 369 ///
363 /// </summary> 370 /// </summary>
364 public override void Update() 371 public override void Update()
365 { 372 {
366 foreach (SceneObjectPart part in this.m_parts.Values) 373 foreach (SceneObjectPart part in m_parts.Values)
367 { 374 {
368 part.SendScheduledUpdates(); 375 part.SendScheduledUpdates();
369 } 376 }
@@ -371,7 +378,7 @@ namespace OpenSim.Region.Environment.Scenes
371 378
372 public void ScheduleFullUpdateToAvatar(ScenePresence presence) 379 public void ScheduleFullUpdateToAvatar(ScenePresence presence)
373 { 380 {
374 foreach (SceneObjectPart part in this.m_parts.Values) 381 foreach (SceneObjectPart part in m_parts.Values)
375 { 382 {
376 part.AddFullUpdateToAvatar(presence); 383 part.AddFullUpdateToAvatar(presence);
377 } 384 }
@@ -379,7 +386,7 @@ namespace OpenSim.Region.Environment.Scenes
379 386
380 public void ScheduleTerseUpdateToAvatar(ScenePresence presence) 387 public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
381 { 388 {
382 foreach (SceneObjectPart part in this.m_parts.Values) 389 foreach (SceneObjectPart part in m_parts.Values)
383 { 390 {
384 part.AddTerseUpdateToAvatar(presence); 391 part.AddTerseUpdateToAvatar(presence);
385 } 392 }
@@ -391,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
391 public void ScheduleGroupForFullUpdate() 398 public void ScheduleGroupForFullUpdate()
392 { 399 {
393 HasChanged = true; 400 HasChanged = true;
394 foreach (SceneObjectPart part in this.m_parts.Values) 401 foreach (SceneObjectPart part in m_parts.Values)
395 { 402 {
396 part.ScheduleFullUpdate(); 403 part.ScheduleFullUpdate();
397 } 404 }
@@ -403,7 +410,7 @@ namespace OpenSim.Region.Environment.Scenes
403 public void ScheduleGroupForTerseUpdate() 410 public void ScheduleGroupForTerseUpdate()
404 { 411 {
405 HasChanged = true; 412 HasChanged = true;
406 foreach (SceneObjectPart part in this.m_parts.Values) 413 foreach (SceneObjectPart part in m_parts.Values)
407 { 414 {
408 part.ScheduleTerseUpdate(); 415 part.ScheduleTerseUpdate();
409 } 416 }
@@ -415,7 +422,7 @@ namespace OpenSim.Region.Environment.Scenes
415 public void SendGroupFullUpdate() 422 public void SendGroupFullUpdate()
416 { 423 {
417 HasChanged = true; 424 HasChanged = true;
418 foreach (SceneObjectPart part in this.m_parts.Values) 425 foreach (SceneObjectPart part in m_parts.Values)
419 { 426 {
420 part.SendFullUpdateToAllClients(); 427 part.SendFullUpdateToAllClients();
421 } 428 }
@@ -427,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes
427 public void SendGroupTerseUpdate() 434 public void SendGroupTerseUpdate()
428 { 435 {
429 HasChanged = true; 436 HasChanged = true;
430 foreach (SceneObjectPart part in this.m_parts.Values) 437 foreach (SceneObjectPart part in m_parts.Values)
431 { 438 {
432 part.SendTerseUpdateToAllClients(); 439 part.SendTerseUpdateToAllClients();
433 } 440 }
@@ -436,6 +443,7 @@ namespace OpenSim.Region.Environment.Scenes
436 #endregion 443 #endregion
437 444
438 #region SceneGroupPart Methods 445 #region SceneGroupPart Methods
446
439 /// <summary> 447 /// <summary>
440 /// 448 ///
441 /// </summary> 449 /// </summary>
@@ -444,9 +452,9 @@ namespace OpenSim.Region.Environment.Scenes
444 public SceneObjectPart GetChildPart(LLUUID primID) 452 public SceneObjectPart GetChildPart(LLUUID primID)
445 { 453 {
446 SceneObjectPart childPart = null; 454 SceneObjectPart childPart = null;
447 if (this.m_parts.ContainsKey(primID)) 455 if (m_parts.ContainsKey(primID))
448 { 456 {
449 childPart = this.m_parts[primID]; 457 childPart = m_parts[primID];
450 } 458 }
451 return childPart; 459 return childPart;
452 } 460 }
@@ -458,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes
458 /// <returns></returns> 466 /// <returns></returns>
459 public SceneObjectPart GetChildPart(uint localID) 467 public SceneObjectPart GetChildPart(uint localID)
460 { 468 {
461 foreach (SceneObjectPart part in this.m_parts.Values) 469 foreach (SceneObjectPart part in m_parts.Values)
462 { 470 {
463 if (part.LocalID == localID) 471 if (part.LocalID == localID)
464 { 472 {
@@ -477,9 +485,9 @@ namespace OpenSim.Region.Environment.Scenes
477 public bool HasChildPrim(LLUUID primID) 485 public bool HasChildPrim(LLUUID primID)
478 { 486 {
479 SceneObjectPart childPart = null; 487 SceneObjectPart childPart = null;
480 if (this.m_parts.ContainsKey(primID)) 488 if (m_parts.ContainsKey(primID))
481 { 489 {
482 childPart = this.m_parts[primID]; 490 childPart = m_parts[primID];
483 return true; 491 return true;
484 } 492 }
485 return false; 493 return false;
@@ -493,7 +501,7 @@ namespace OpenSim.Region.Environment.Scenes
493 /// <returns></returns> 501 /// <returns></returns>
494 public bool HasChildPrim(uint localID) 502 public bool HasChildPrim(uint localID)
495 { 503 {
496 foreach (SceneObjectPart part in this.m_parts.Values) 504 foreach (SceneObjectPart part in m_parts.Values)
497 { 505 {
498 if (part.LocalID == localID) 506 if (part.LocalID == localID)
499 { 507 {
@@ -502,9 +510,11 @@ namespace OpenSim.Region.Environment.Scenes
502 } 510 }
503 return false; 511 return false;
504 } 512 }
513
505 #endregion 514 #endregion
506 515
507 #region Packet Handlers 516 #region Packet Handlers
517
508 /// <summary> 518 /// <summary>
509 /// 519 ///
510 /// </summary> 520 /// </summary>
@@ -512,21 +522,28 @@ namespace OpenSim.Region.Environment.Scenes
512 public void LinkToGroup(SceneObjectGroup objectGroup) 522 public void LinkToGroup(SceneObjectGroup objectGroup)
513 { 523 {
514 SceneObjectPart linkPart = objectGroup.m_rootPart; 524 SceneObjectPart linkPart = objectGroup.m_rootPart;
515 Axiom.Math.Vector3 oldGroupPosition = new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); 525 Vector3 oldGroupPosition =
516 Axiom.Math.Quaternion oldRootRotation = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); 526 new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z);
527 Quaternion oldRootRotation =
528 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
529 linkPart.RotationOffset.Z);
517 530
518 linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; 531 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
519 linkPart.GroupPosition = this.AbsolutePosition; 532 linkPart.GroupPosition = AbsolutePosition;
520 533
521 Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); 534 Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z);
522 Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 535 Quaternion parentRot =
523 axPos = parentRot.Inverse() * axPos; 536 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
537 m_rootPart.RotationOffset.Z);
538 axPos = parentRot.Inverse()*axPos;
524 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 539 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
525 Quaternion oldRot = new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z); 540 Quaternion oldRot =
526 Quaternion newRot = parentRot.Inverse() * oldRot; 541 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
542 linkPart.RotationOffset.Z);
543 Quaternion newRot = parentRot.Inverse()*oldRot;
527 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 544 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
528 linkPart.ParentID = this.m_rootPart.LocalID; 545 linkPart.ParentID = m_rootPart.LocalID;
529 this.m_parts.Add(linkPart.UUID, linkPart); 546 m_parts.Add(linkPart.UUID, linkPart);
530 linkPart.SetParent(this); 547 linkPart.SetParent(this);
531 548
532 if (linkPart.PhysActor != null) 549 if (linkPart.PhysActor != null)
@@ -540,7 +557,7 @@ namespace OpenSim.Region.Environment.Scenes
540 { 557 {
541 if (part.UUID != objectGroup.m_rootPart.UUID) 558 if (part.UUID != objectGroup.m_rootPart.UUID)
542 { 559 {
543 this.LinkNonRootPart(part, oldGroupPosition, oldRootRotation); 560 LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
544 } 561 }
545 } 562 }
546 563
@@ -549,7 +566,7 @@ namespace OpenSim.Region.Environment.Scenes
549 m_scene.DeleteEntity(objectGroup.UUID); 566 m_scene.DeleteEntity(objectGroup.UUID);
550 567
551 objectGroup.DeleteParts(); 568 objectGroup.DeleteParts();
552 this.ScheduleGroupForFullUpdate(); 569 ScheduleGroupForFullUpdate();
553 } 570 }
554 571
555 private void DetachFromBackup(SceneObjectGroup objectGroup) 572 private void DetachFromBackup(SceneObjectGroup objectGroup)
@@ -561,26 +578,31 @@ namespace OpenSim.Region.Environment.Scenes
561 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) 578 private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
562 { 579 {
563 part.SetParent(this); 580 part.SetParent(this);
564 part.ParentID = this.m_rootPart.LocalID; 581 part.ParentID = m_rootPart.LocalID;
565 this.m_parts.Add(part.UUID, part); 582 m_parts.Add(part.UUID, part);
566 583
567 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 584 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
568 axiomOldPos = oldGroupRotation * axiomOldPos; 585 axiomOldPos = oldGroupRotation*axiomOldPos;
569 axiomOldPos += oldGroupPosition; 586 axiomOldPos += oldGroupPosition;
570 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); 587 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
571 part.OffsetPosition = oldAbsolutePosition - this.AbsolutePosition; 588 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
572 589
573 Quaternion axiomRootRotation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 590 Quaternion axiomRootRotation =
591 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
592 m_rootPart.RotationOffset.Z);
574 593
575 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 594 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
576 axiomPos = axiomRootRotation.Inverse() * axiomPos; 595 axiomPos = axiomRootRotation.Inverse()*axiomPos;
577 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); 596 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
578 597
579 Quaternion axiomPartRotation = new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z); 598 Quaternion axiomPartRotation =
599 new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
600 part.RotationOffset.Z);
580 601
581 axiomPartRotation = oldGroupRotation * axiomPartRotation; 602 axiomPartRotation = oldGroupRotation*axiomPartRotation;
582 axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation; 603 axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
583 part.RotationOffset = new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); 604 part.RotationOffset =
605 new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
584 } 606 }
585 607
586 /// <summary> 608 /// <summary>
@@ -591,8 +613,8 @@ namespace OpenSim.Region.Environment.Scenes
591 /// <param name="remoteClient"></param> 613 /// <param name="remoteClient"></param>
592 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 614 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
593 { 615 {
594 this.AbsolutePosition = pos; 616 AbsolutePosition = pos;
595 this.m_rootPart.SendTerseUpdateToAllClients(); 617 m_rootPart.SendTerseUpdateToAllClients();
596 } 618 }
597 619
598 /// <summary> 620 /// <summary>
@@ -605,25 +627,25 @@ namespace OpenSim.Region.Environment.Scenes
605 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 627 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
606 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 628 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
607 proper.ObjectData[0].ItemID = LLUUID.Zero; 629 proper.ObjectData[0].ItemID = LLUUID.Zero;
608 proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate; 630 proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate;
609 proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID; 631 proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
610 proper.ObjectData[0].FolderID = LLUUID.Zero; 632 proper.ObjectData[0].FolderID = LLUUID.Zero;
611 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 633 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
612 proper.ObjectData[0].GroupID = LLUUID.Zero; 634 proper.ObjectData[0].GroupID = LLUUID.Zero;
613 proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial; 635 proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
614 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; 636 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
615 proper.ObjectData[0].ObjectID = this.UUID; 637 proper.ObjectData[0].ObjectID = UUID;
616 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; 638 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
617 proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); 639 proper.ObjectData[0].TouchName = enc.GetBytes(m_rootPart.TouchName + "\0");
618 proper.ObjectData[0].TextureID = new byte[0]; 640 proper.ObjectData[0].TextureID = new byte[0];
619 proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); 641 proper.ObjectData[0].SitName = enc.GetBytes(m_rootPart.SitName + "\0");
620 proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); 642 proper.ObjectData[0].Name = enc.GetBytes(m_rootPart.Name + "\0");
621 proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); 643 proper.ObjectData[0].Description = enc.GetBytes(m_rootPart.Description + "\0");
622 proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; 644 proper.ObjectData[0].OwnerMask = m_rootPart.OwnerMask;
623 proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; 645 proper.ObjectData[0].NextOwnerMask = m_rootPart.NextOwnerMask;
624 proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask; 646 proper.ObjectData[0].GroupMask = m_rootPart.GroupMask;
625 proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask; 647 proper.ObjectData[0].EveryoneMask = m_rootPart.EveryoneMask;
626 proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask; 648 proper.ObjectData[0].BaseMask = m_rootPart.BaseMask;
627 649
628 client.OutPacket(proper); 650 client.OutPacket(proper);
629 } 651 }
@@ -635,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
635 public void SetPartName(string name, uint localID) 657 public void SetPartName(string name, uint localID)
636 { 658 {
637 name = name.Remove(name.Length - 1, 1); 659 name = name.Remove(name.Length - 1, 1);
638 SceneObjectPart part = this.GetChildPart(localID); 660 SceneObjectPart part = GetChildPart(localID);
639 if (part != null) 661 if (part != null)
640 { 662 {
641 part.Name = name; 663 part.Name = name;
@@ -644,7 +666,7 @@ namespace OpenSim.Region.Environment.Scenes
644 666
645 public void SetPartDescription(string des, uint localID) 667 public void SetPartDescription(string des, uint localID)
646 { 668 {
647 SceneObjectPart part = this.GetChildPart(localID); 669 SceneObjectPart part = GetChildPart(localID);
648 if (part != null) 670 if (part != null)
649 { 671 {
650 part.Description = des; 672 part.Description = des;
@@ -653,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
653 675
654 public void SetPartText(string text, uint localID) 676 public void SetPartText(string text, uint localID)
655 { 677 {
656 SceneObjectPart part = this.GetChildPart(localID); 678 SceneObjectPart part = GetChildPart(localID);
657 if (part != null) 679 if (part != null)
658 { 680 {
659 part.Text = text; 681 part.Text = text;
@@ -662,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
662 684
663 public void SetPartText(string text, LLUUID partID) 685 public void SetPartText(string text, LLUUID partID)
664 { 686 {
665 SceneObjectPart part = this.GetChildPart(partID); 687 SceneObjectPart part = GetChildPart(partID);
666 if (part != null) 688 if (part != null)
667 { 689 {
668 part.Text = text; 690 part.Text = text;
@@ -671,7 +693,7 @@ namespace OpenSim.Region.Environment.Scenes
671 693
672 public string GetPartName(uint localID) 694 public string GetPartName(uint localID)
673 { 695 {
674 SceneObjectPart part = this.GetChildPart(localID); 696 SceneObjectPart part = GetChildPart(localID);
675 if (part != null) 697 if (part != null)
676 { 698 {
677 return part.Name; 699 return part.Name;
@@ -681,7 +703,7 @@ namespace OpenSim.Region.Environment.Scenes
681 703
682 public string GetPartDescription(uint localID) 704 public string GetPartDescription(uint localID)
683 { 705 {
684 SceneObjectPart part = this.GetChildPart(localID); 706 SceneObjectPart part = GetChildPart(localID);
685 if (part != null) 707 if (part != null)
686 { 708 {
687 return part.Description; 709 return part.Description;
@@ -696,7 +718,7 @@ namespace OpenSim.Region.Environment.Scenes
696 /// <param name="localID"></param> 718 /// <param name="localID"></param>
697 public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) 719 public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID)
698 { 720 {
699 SceneObjectPart part = this.GetChildPart(localID); 721 SceneObjectPart part = GetChildPart(localID);
700 if (part != null) 722 if (part != null)
701 { 723 {
702 return part.GetInventoryFileName(remoteClient, localID); 724 return part.GetInventoryFileName(remoteClient, localID);
@@ -706,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes
706 728
707 public string RequestInventoryFile(uint localID, IXfer xferManager) 729 public string RequestInventoryFile(uint localID, IXfer xferManager)
708 { 730 {
709 SceneObjectPart part = this.GetChildPart(localID); 731 SceneObjectPart part = GetChildPart(localID);
710 if (part != null) 732 if (part != null)
711 { 733 {
712 part.RequestInventoryFile(xferManager); 734 part.RequestInventoryFile(xferManager);
@@ -716,7 +738,7 @@ namespace OpenSim.Region.Environment.Scenes
716 738
717 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) 739 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
718 { 740 {
719 SceneObjectPart part = this.GetChildPart(localID); 741 SceneObjectPart part = GetChildPart(localID);
720 if (part != null) 742 if (part != null)
721 { 743 {
722 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); 744 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@@ -732,14 +754,13 @@ namespace OpenSim.Region.Environment.Scenes
732 return true; 754 return true;
733 } 755 }
734 return false; 756 return false;
735
736 } 757 }
737 758
738 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) 759 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
739 { 760 {
740 if (copyItemID != LLUUID.Zero) 761 if (copyItemID != LLUUID.Zero)
741 { 762 {
742 SceneObjectPart part = this.GetChildPart(localID); 763 SceneObjectPart part = GetChildPart(localID);
743 if (part != null) 764 if (part != null)
744 { 765 {
745 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); 766 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
@@ -764,7 +785,7 @@ namespace OpenSim.Region.Environment.Scenes
764 785
765 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 786 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
766 { 787 {
767 SceneObjectPart part = this.GetChildPart(localID); 788 SceneObjectPart part = GetChildPart(localID);
768 if (part != null) 789 if (part != null)
769 { 790 {
770 return part.RemoveInventoryItem(remoteClient, localID, itemID); 791 return part.RemoveInventoryItem(remoteClient, localID, itemID);
@@ -781,7 +802,7 @@ namespace OpenSim.Region.Environment.Scenes
781 /// <param name="data"></param> 802 /// <param name="data"></param>
782 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) 803 public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
783 { 804 {
784 SceneObjectPart part = this.GetChildPart(localID); 805 SceneObjectPart part = GetChildPart(localID);
785 if (part != null) 806 if (part != null)
786 { 807 {
787 part.UpdateExtraParam(type, inUse, data); 808 part.UpdateExtraParam(type, inUse, data);
@@ -795,30 +816,34 @@ namespace OpenSim.Region.Environment.Scenes
795 /// <param name="textureEntry"></param> 816 /// <param name="textureEntry"></param>
796 public void UpdateTextureEntry(uint localID, byte[] textureEntry) 817 public void UpdateTextureEntry(uint localID, byte[] textureEntry)
797 { 818 {
798 SceneObjectPart part = this.GetChildPart(localID); 819 SceneObjectPart part = GetChildPart(localID);
799 if (part != null) 820 if (part != null)
800 { 821 {
801 part.UpdateTextureEntry(textureEntry); 822 part.UpdateTextureEntry(textureEntry);
802 } 823 }
803 } 824 }
825
804 #endregion 826 #endregion
805 827
806 #region Shape 828 #region Shape
829
807 /// <summary> 830 /// <summary>
808 /// 831 ///
809 /// </summary> 832 /// </summary>
810 /// <param name="shapeBlock"></param> 833 /// <param name="shapeBlock"></param>
811 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) 834 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
812 { 835 {
813 SceneObjectPart part = this.GetChildPart(localID); 836 SceneObjectPart part = GetChildPart(localID);
814 if (part != null) 837 if (part != null)
815 { 838 {
816 part.UpdateShape(shapeBlock); 839 part.UpdateShape(shapeBlock);
817 } 840 }
818 } 841 }
842
819 #endregion 843 #endregion
820 844
821 #region Resize 845 #region Resize
846
822 /// <summary> 847 /// <summary>
823 /// 848 ///
824 /// </summary> 849 /// </summary>
@@ -826,30 +851,33 @@ namespace OpenSim.Region.Environment.Scenes
826 /// <param name="localID"></param> 851 /// <param name="localID"></param>
827 public void Resize(LLVector3 scale, uint localID) 852 public void Resize(LLVector3 scale, uint localID)
828 { 853 {
829 SceneObjectPart part = this.GetChildPart(localID); 854 SceneObjectPart part = GetChildPart(localID);
830 if (part != null) 855 if (part != null)
831 { 856 {
832 part.Resize(scale); 857 part.Resize(scale);
833 if (part.UUID == this.m_rootPart.UUID) 858 if (part.UUID == m_rootPart.UUID)
834 { 859 {
835 if (m_rootPart.PhysActor != null) 860 if (m_rootPart.PhysActor != null)
836 { 861 {
837 m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); 862 m_rootPart.PhysActor.Size =
863 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
838 } 864 }
839 } 865 }
840 } 866 }
841 } 867 }
868
842 #endregion 869 #endregion
843 870
844 #region Position 871 #region Position
872
845 /// <summary> 873 /// <summary>
846 /// 874 ///
847 /// </summary> 875 /// </summary>
848 /// <param name="pos"></param> 876 /// <param name="pos"></param>
849 public void UpdateGroupPosition(LLVector3 pos) 877 public void UpdateGroupPosition(LLVector3 pos)
850 { 878 {
851 this.AbsolutePosition = pos; 879 AbsolutePosition = pos;
852 this.ScheduleGroupForTerseUpdate(); 880 ScheduleGroupForTerseUpdate();
853 } 881 }
854 882
855 /// <summary> 883 /// <summary>
@@ -859,12 +887,12 @@ namespace OpenSim.Region.Environment.Scenes
859 /// <param name="localID"></param> 887 /// <param name="localID"></param>
860 public void UpdateSinglePosition(LLVector3 pos, uint localID) 888 public void UpdateSinglePosition(LLVector3 pos, uint localID)
861 { 889 {
862 SceneObjectPart part = this.GetChildPart(localID); 890 SceneObjectPart part = GetChildPart(localID);
863 if (part != null) 891 if (part != null)
864 { 892 {
865 if (part.UUID == this.m_rootPart.UUID) 893 if (part.UUID == m_rootPart.UUID)
866 { 894 {
867 this.UpdateRootPosition(pos); 895 UpdateRootPosition(pos);
868 } 896 }
869 else 897 else
870 { 898 {
@@ -880,40 +908,49 @@ namespace OpenSim.Region.Environment.Scenes
880 private void UpdateRootPosition(LLVector3 pos) 908 private void UpdateRootPosition(LLVector3 pos)
881 { 909 {
882 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 910 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
883 LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z); 911 LLVector3 oldPos =
912 new LLVector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
913 AbsolutePosition.Y + m_rootPart.OffsetPosition.Y,
914 AbsolutePosition.Z + m_rootPart.OffsetPosition.Z);
884 LLVector3 diff = oldPos - newPos; 915 LLVector3 diff = oldPos - newPos;
885 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 916 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
886 Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 917 Quaternion partRotation =
887 axDiff = partRotation.Inverse() * axDiff; 918 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
919 m_rootPart.RotationOffset.Z);
920 axDiff = partRotation.Inverse()*axDiff;
888 diff.X = axDiff.x; 921 diff.X = axDiff.x;
889 diff.Y = axDiff.y; 922 diff.Y = axDiff.y;
890 diff.Z = axDiff.z; 923 diff.Z = axDiff.z;
891 924
892 foreach (SceneObjectPart obPart in this.m_parts.Values) 925 foreach (SceneObjectPart obPart in m_parts.Values)
893 { 926 {
894 if (obPart.UUID != this.m_rootPart.UUID) 927 if (obPart.UUID != m_rootPart.UUID)
895 { 928 {
896 obPart.OffsetPosition = obPart.OffsetPosition + diff; 929 obPart.OffsetPosition = obPart.OffsetPosition + diff;
897 } 930 }
898 } 931 }
899 this.AbsolutePosition = newPos; 932 AbsolutePosition = newPos;
900 this.ScheduleGroupForTerseUpdate(); 933 ScheduleGroupForTerseUpdate();
901 } 934 }
935
902 #endregion 936 #endregion
903 937
904 #region Rotation 938 #region Rotation
939
905 /// <summary> 940 /// <summary>
906 /// 941 ///
907 /// </summary> 942 /// </summary>
908 /// <param name="rot"></param> 943 /// <param name="rot"></param>
909 public void UpdateGroupRotation(LLQuaternion rot) 944 public void UpdateGroupRotation(LLQuaternion rot)
910 { 945 {
911 this.m_rootPart.UpdateRotation(rot); 946 m_rootPart.UpdateRotation(rot);
912 if (m_rootPart.PhysActor != null) 947 if (m_rootPart.PhysActor != null)
913 { 948 {
914 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 949 m_rootPart.PhysActor.Orientation =
950 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
951 m_rootPart.RotationOffset.Z);
915 } 952 }
916 this.ScheduleGroupForTerseUpdate(); 953 ScheduleGroupForTerseUpdate();
917 } 954 }
918 955
919 /// <summary> 956 /// <summary>
@@ -923,13 +960,15 @@ namespace OpenSim.Region.Environment.Scenes
923 /// <param name="rot"></param> 960 /// <param name="rot"></param>
924 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) 961 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
925 { 962 {
926 this.m_rootPart.UpdateRotation(rot); 963 m_rootPart.UpdateRotation(rot);
927 if (m_rootPart.PhysActor != null) 964 if (m_rootPart.PhysActor != null)
928 { 965 {
929 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 966 m_rootPart.PhysActor.Orientation =
967 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
968 m_rootPart.RotationOffset.Z);
930 } 969 }
931 this.AbsolutePosition = pos; 970 AbsolutePosition = pos;
932 this.ScheduleGroupForTerseUpdate(); 971 ScheduleGroupForTerseUpdate();
933 } 972 }
934 973
935 /// <summary> 974 /// <summary>
@@ -939,12 +978,12 @@ namespace OpenSim.Region.Environment.Scenes
939 /// <param name="localID"></param> 978 /// <param name="localID"></param>
940 public void UpdateSingleRotation(LLQuaternion rot, uint localID) 979 public void UpdateSingleRotation(LLQuaternion rot, uint localID)
941 { 980 {
942 SceneObjectPart part = this.GetChildPart(localID); 981 SceneObjectPart part = GetChildPart(localID);
943 if (part != null) 982 if (part != null)
944 { 983 {
945 if (part.UUID == this.m_rootPart.UUID) 984 if (part.UUID == m_rootPart.UUID)
946 { 985 {
947 this.UpdateRootRotation(rot); 986 UpdateRootRotation(rot);
948 } 987 }
949 else 988 else
950 { 989 {
@@ -959,40 +998,48 @@ namespace OpenSim.Region.Environment.Scenes
959 /// <param name="rot"></param> 998 /// <param name="rot"></param>
960 private void UpdateRootRotation(LLQuaternion rot) 999 private void UpdateRootRotation(LLQuaternion rot)
961 { 1000 {
962 Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); 1001 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
963 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); 1002 Quaternion oldParentRot =
1003 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1004 m_rootPart.RotationOffset.Z);
964 1005
965 this.m_rootPart.UpdateRotation(rot); 1006 m_rootPart.UpdateRotation(rot);
966 if (m_rootPart.PhysActor != null) 1007 if (m_rootPart.PhysActor != null)
967 { 1008 {
968 m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); 1009 m_rootPart.PhysActor.Orientation =
1010 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1011 m_rootPart.RotationOffset.Z);
969 } 1012 }
970 1013
971 foreach (SceneObjectPart prim in this.m_parts.Values) 1014 foreach (SceneObjectPart prim in m_parts.Values)
972 { 1015 {
973 if (prim.UUID != this.m_rootPart.UUID) 1016 if (prim.UUID != m_rootPart.UUID)
974 { 1017 {
975 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 1018 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
976 axPos = oldParentRot * axPos; 1019 axPos = oldParentRot*axPos;
977 axPos = axRot.Inverse() * axPos; 1020 axPos = axRot.Inverse()*axPos;
978 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 1021 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
979 Axiom.Math.Quaternion primsRot = new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z); 1022 Quaternion primsRot =
980 Axiom.Math.Quaternion newRot = oldParentRot * primsRot; 1023 new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
981 newRot = axRot.Inverse() * newRot; 1024 prim.RotationOffset.Z);
1025 Quaternion newRot = oldParentRot*primsRot;
1026 newRot = axRot.Inverse()*newRot;
982 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 1027 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
983 prim.ScheduleTerseUpdate(); 1028 prim.ScheduleTerseUpdate();
984 } 1029 }
985 } 1030 }
986 this.m_rootPart.ScheduleTerseUpdate(); 1031 m_rootPart.ScheduleTerseUpdate();
987 } 1032 }
1033
988 #endregion 1034 #endregion
1035
989 /// <summary> 1036 /// <summary>
990 /// 1037 ///
991 /// </summary> 1038 /// </summary>
992 /// <param name="part"></param> 1039 /// <param name="part"></param>
993 private void SetPartAsRoot(SceneObjectPart part) 1040 private void SetPartAsRoot(SceneObjectPart part)
994 { 1041 {
995 this.m_rootPart = part; 1042 m_rootPart = part;
996 } 1043 }
997 1044
998 /// <summary> 1045 /// <summary>
@@ -1001,7 +1048,7 @@ namespace OpenSim.Region.Environment.Scenes
1001 /// <param name="part"></param> 1048 /// <param name="part"></param>
1002 private void SetPartAsNonRoot(SceneObjectPart part) 1049 private void SetPartAsNonRoot(SceneObjectPart part)
1003 { 1050 {
1004 part.ParentID = this.m_rootPart.LocalID; 1051 part.ParentID = m_rootPart.LocalID;
1005 } 1052 }
1006 1053
1007 /// <summary> 1054 /// <summary>
@@ -1014,6 +1061,7 @@ namespace OpenSim.Region.Environment.Scenes
1014 } 1061 }
1015 1062
1016 #region Events 1063 #region Events
1064
1017 /// <summary> 1065 /// <summary>
1018 /// 1066 ///
1019 /// </summary> 1067 /// </summary>
@@ -1021,7 +1069,7 @@ namespace OpenSim.Region.Environment.Scenes
1021 { 1069 {
1022 if (OnPrimCountTainted != null) 1070 if (OnPrimCountTainted != null)
1023 { 1071 {
1024 this.OnPrimCountTainted(); 1072 OnPrimCountTainted();
1025 } 1073 }
1026 } 1074 }
1027 1075
@@ -1029,7 +1077,7 @@ namespace OpenSim.Region.Environment.Scenes
1029 /// Processes backup 1077 /// Processes backup
1030 /// </summary> 1078 /// </summary>
1031 /// <param name="datastore"></param> 1079 /// <param name="datastore"></param>
1032 public void ProcessBackup(OpenSim.Region.Environment.Interfaces.IRegionDataStore datastore) 1080 public void ProcessBackup(IRegionDataStore datastore)
1033 { 1081 {
1034 if (HasChanged) 1082 if (HasChanged)
1035 { 1083 {
@@ -1037,16 +1085,18 @@ namespace OpenSim.Region.Environment.Scenes
1037 HasChanged = false; 1085 HasChanged = false;
1038 } 1086 }
1039 } 1087 }
1088
1040 #endregion 1089 #endregion
1041 1090
1042 #region Client Updating 1091 #region Client Updating
1092
1043 public void SendFullUpdateToClient(IClientAPI remoteClient) 1093 public void SendFullUpdateToClient(IClientAPI remoteClient)
1044 { 1094 {
1045 lock (this.m_parts) 1095 lock (m_parts)
1046 { 1096 {
1047 foreach (SceneObjectPart part in this.m_parts.Values) 1097 foreach (SceneObjectPart part in m_parts.Values)
1048 { 1098 {
1049 this.SendPartFullUpdate(remoteClient, part); 1099 SendPartFullUpdate(remoteClient, part);
1050 } 1100 }
1051 } 1101 }
1052 } 1102 }
@@ -1084,6 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes
1084 part.SendTerseUpdateToClient(remoteClient); 1134 part.SendTerseUpdateToClient(remoteClient);
1085 } 1135 }
1086 } 1136 }
1137
1087 #endregion 1138 #endregion
1088 1139
1089 public override void UpdateMovement() 1140 public override void UpdateMovement()
@@ -1114,7 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes
1114 public void AddPart(SceneObjectPart part) 1165 public void AddPart(SceneObjectPart part)
1115 { 1166 {
1116 part.SetParent(this); 1167 part.SetParent(this);
1117 this.m_parts.Add(part.UUID, part); 1168 m_parts.Add(part.UUID, part);
1118 } 1169 }
1119 1170
1120 /// <summary> 1171 /// <summary>
@@ -1122,18 +1173,18 @@ namespace OpenSim.Region.Environment.Scenes
1122 /// </summary> 1173 /// </summary>
1123 public void UpdateParentIDs() 1174 public void UpdateParentIDs()
1124 { 1175 {
1125 foreach (SceneObjectPart part in this.m_parts.Values) 1176 foreach (SceneObjectPart part in m_parts.Values)
1126 { 1177 {
1127 if (part.UUID != this.m_rootPart.UUID) 1178 if (part.UUID != m_rootPart.UUID)
1128 { 1179 {
1129 part.ParentID = this.m_rootPart.LocalID; 1180 part.ParentID = m_rootPart.LocalID;
1130 } 1181 }
1131 } 1182 }
1132 } 1183 }
1133 1184
1134 public void RegenerateFullIDs() 1185 public void RegenerateFullIDs()
1135 { 1186 {
1136 foreach (SceneObjectPart part in this.m_parts.Values) 1187 foreach (SceneObjectPart part in m_parts.Values)
1137 { 1188 {
1138 part.UUID = LLUUID.Random(); 1189 part.UUID = LLUUID.Random();
1139 } 1190 }
@@ -1141,7 +1192,7 @@ namespace OpenSim.Region.Environment.Scenes
1141 1192
1142 public LLUUID GetPartsFullID(uint localID) 1193 public LLUUID GetPartsFullID(uint localID)
1143 { 1194 {
1144 SceneObjectPart part = this.GetChildPart(localID); 1195 SceneObjectPart part = GetChildPart(localID);
1145 if (part != null) 1196 if (part != null)
1146 { 1197 {
1147 return part.UUID; 1198 return part.UUID;
@@ -1175,26 +1226,25 @@ namespace OpenSim.Region.Environment.Scenes
1175 1226
1176 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 1227 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
1177 { 1228 {
1178
1179 } 1229 }
1180 1230
1181 public void DeleteGroup() 1231 public void DeleteGroup()
1182 { 1232 {
1183 DetachFromBackup( this ); 1233 DetachFromBackup(this);
1184 foreach (SceneObjectPart part in this.m_parts.Values) 1234 foreach (SceneObjectPart part in m_parts.Values)
1185 { 1235 {
1186 List<ScenePresence> avatars = this.RequestSceneAvatars(); 1236 List<ScenePresence> avatars = RequestSceneAvatars();
1187 for (int i = 0; i < avatars.Count; i++) 1237 for (int i = 0; i < avatars.Count; i++)
1188 { 1238 {
1189 avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID); 1239 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID);
1190 } 1240 }
1191 } 1241 }
1192 } 1242 }
1193 1243
1194 public void DeleteParts() 1244 public void DeleteParts()
1195 { 1245 {
1196 this.m_rootPart = null; 1246 m_rootPart = null;
1197 this.m_parts.Clear(); 1247 m_parts.Clear();
1198 } 1248 }
1199 1249
1200 public override void SetText(string text, Vector3 color, double alpha) 1250 public override void SetText(string text, Vector3 color, double alpha)
@@ -1202,4 +1252,4 @@ namespace OpenSim.Region.Environment.Scenes
1202 Text = text; 1252 Text = text;
1203 } 1253 }
1204 } 1254 }
1205} 1255} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index abb69f4..deacd18 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1,23 +1,19 @@
1using System;
1using System.Collections.Generic; 2using System.Collections.Generic;
2using System.Text;
3using System.Xml; 3using System.Xml;
4using System.Xml.Serialization; 4using System.Xml.Serialization;
5using System.IO;
6using System;
7using Axiom.Math; 5using Axiom.Math;
8using libsecondlife; 6using libsecondlife;
9using libsecondlife.Packets; 7using libsecondlife.Packets;
10using OpenSim.Framework.Interfaces; 8using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
12using OpenSim.Framework.Utilities; 10using OpenSim.Framework.Utilities;
11using OpenSim.Region.Environment.Interfaces;
13using OpenSim.Region.Environment.Scenes.Scripting; 12using OpenSim.Region.Environment.Scenes.Scripting;
14using OpenSim.Framework;
15using OpenSim.Region.Physics.Manager; 13using OpenSim.Region.Physics.Manager;
16using OpenSim.Region.Environment.Interfaces;
17 14
18namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
19{ 16{
20
21 public class SceneObjectPart : IScriptHost 17 public class SceneObjectPart : IScriptHost
22 { 18 {
23 private const uint FULL_MASK_PERMISSIONS = 2147483647; 19 private const uint FULL_MASK_PERMISSIONS = 2147483647;
@@ -25,8 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
25 private string m_inventoryFileName = ""; 21 private string m_inventoryFileName = "";
26 private LLUUID m_folderID = LLUUID.Zero; 22 private LLUUID m_folderID = LLUUID.Zero;
27 23
28 [XmlIgnore] 24 [XmlIgnore] public PhysicsActor PhysActor = null;
29 public PhysicsActor PhysActor = null;
30 25
31 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 26 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
32 27
@@ -57,19 +52,25 @@ namespace OpenSim.Region.Environment.Scenes
57 #region Properties 52 #region Properties
58 53
59 public LLUUID CreatorID; 54 public LLUUID CreatorID;
60 public LLUUID ObjectCreator { get { return CreatorID; } } 55
56 public LLUUID ObjectCreator
57 {
58 get { return CreatorID; }
59 }
61 60
62 /// <summary> 61 /// <summary>
63 /// Serial count for inventory file , used to tell if inventory has changed 62 /// Serial count for inventory file , used to tell if inventory has changed
64 /// no need for this to be part of Database backup 63 /// no need for this to be part of Database backup
65 /// </summary> 64 /// </summary>
66 protected uint m_inventorySerial = 0; 65 protected uint m_inventorySerial = 0;
66
67 public uint InventorySerial 67 public uint InventorySerial
68 { 68 {
69 get { return m_inventorySerial; } 69 get { return m_inventorySerial; }
70 } 70 }
71 71
72 protected LLUUID m_uuid; 72 protected LLUUID m_uuid;
73
73 public LLUUID UUID 74 public LLUUID UUID
74 { 75 {
75 get { return m_uuid; } 76 get { return m_uuid; }
@@ -77,6 +78,7 @@ namespace OpenSim.Region.Environment.Scenes
77 } 78 }
78 79
79 protected uint m_localID; 80 protected uint m_localID;
81
80 public uint LocalID 82 public uint LocalID
81 { 83 {
82 get { return m_localID; } 84 get { return m_localID; }
@@ -84,6 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
84 } 86 }
85 87
86 protected string m_name; 88 protected string m_name;
89
87 public virtual string Name 90 public virtual string Name
88 { 91 {
89 get { return m_name; } 92 get { return m_name; }
@@ -91,20 +94,23 @@ namespace OpenSim.Region.Environment.Scenes
91 } 94 }
92 95
93 protected LLObject.ObjectFlags m_flags; 96 protected LLObject.ObjectFlags m_flags;
97
94 public uint ObjectFlags 98 public uint ObjectFlags
95 { 99 {
96 get { return (uint)m_flags; } 100 get { return (uint) m_flags; }
97 set { m_flags = (LLObject.ObjectFlags)value; } 101 set { m_flags = (LLObject.ObjectFlags) value; }
98 } 102 }
99 103
100 protected LLObject.MaterialType m_material; 104 protected LLObject.MaterialType m_material;
105
101 public byte Material 106 public byte Material
102 { 107 {
103 get { return (byte)m_material; } 108 get { return (byte) m_material; }
104 set { m_material = (LLObject.MaterialType)value; } 109 set { m_material = (LLObject.MaterialType) value; }
105 } 110 }
106 111
107 protected ulong m_regionHandle; 112 protected ulong m_regionHandle;
113
108 public ulong RegionHandle 114 public ulong RegionHandle
109 { 115 {
110 get { return m_regionHandle; } 116 get { return m_regionHandle; }
@@ -113,6 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
113 119
114 //unkown if this will be kept, added as a way of removing the group position from the group class 120 //unkown if this will be kept, added as a way of removing the group position from the group class
115 protected LLVector3 m_groupPosition; 121 protected LLVector3 m_groupPosition;
122
116 public LLVector3 GroupPosition 123 public LLVector3 GroupPosition
117 { 124 {
118 get { return m_groupPosition; } 125 get { return m_groupPosition; }
@@ -120,6 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
120 } 127 }
121 128
122 protected LLVector3 m_offsetPosition; 129 protected LLVector3 m_offsetPosition;
130
123 public LLVector3 OffsetPosition 131 public LLVector3 OffsetPosition
124 { 132 {
125 get { return m_offsetPosition; } 133 get { return m_offsetPosition; }
@@ -132,6 +140,7 @@ namespace OpenSim.Region.Environment.Scenes
132 } 140 }
133 141
134 protected LLQuaternion m_rotationOffset; 142 protected LLQuaternion m_rotationOffset;
143
135 public LLQuaternion RotationOffset 144 public LLQuaternion RotationOffset
136 { 145 {
137 get { return m_rotationOffset; } 146 get { return m_rotationOffset; }
@@ -139,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes
139 } 148 }
140 149
141 protected LLVector3 m_velocity; 150 protected LLVector3 m_velocity;
151
142 /// <summary></summary> 152 /// <summary></summary>
143 public LLVector3 Velocity 153 public LLVector3 Velocity
144 { 154 {
@@ -147,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes
147 } 157 }
148 158
149 protected LLVector3 m_angularVelocity; 159 protected LLVector3 m_angularVelocity;
160
150 /// <summary></summary> 161 /// <summary></summary>
151 public LLVector3 AngularVelocity 162 public LLVector3 AngularVelocity
152 { 163 {
@@ -155,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
155 } 166 }
156 167
157 protected LLVector3 m_acceleration; 168 protected LLVector3 m_acceleration;
169
158 /// <summary></summary> 170 /// <summary></summary>
159 public LLVector3 Acceleration 171 public LLVector3 Acceleration
160 { 172 {
@@ -163,13 +175,15 @@ namespace OpenSim.Region.Environment.Scenes
163 } 175 }
164 176
165 private string m_description = ""; 177 private string m_description = "";
178
166 public string Description 179 public string Description
167 { 180 {
168 get { return this.m_description; } 181 get { return m_description; }
169 set { this.m_description = value; } 182 set { m_description = value; }
170 } 183 }
171 184
172 private string m_text = ""; 185 private string m_text = "";
186
173 public string Text 187 public string Text
174 { 188 {
175 get { return m_text; } 189 get { return m_text; }
@@ -181,6 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
181 } 195 }
182 196
183 private string m_sitName = ""; 197 private string m_sitName = "";
198
184 public string SitName 199 public string SitName
185 { 200 {
186 get { return m_sitName; } 201 get { return m_sitName; }
@@ -188,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
188 } 203 }
189 204
190 private string m_touchName = ""; 205 private string m_touchName = "";
206
191 public string TouchName 207 public string TouchName
192 { 208 {
193 get { return m_touchName; } 209 get { return m_touchName; }
@@ -195,17 +211,19 @@ namespace OpenSim.Region.Environment.Scenes
195 } 211 }
196 212
197 protected PrimitiveBaseShape m_shape; 213 protected PrimitiveBaseShape m_shape;
214
198 public PrimitiveBaseShape Shape 215 public PrimitiveBaseShape Shape
199 { 216 {
200 get { return this.m_shape; } 217 get { return m_shape; }
201 set { m_shape = value; } 218 set { m_shape = value; }
202 } 219 }
203 220
204 public LLVector3 Scale 221 public LLVector3 Scale
205 { 222 {
206 set { this.m_shape.Scale = value; } 223 set { m_shape.Scale = value; }
207 get { return this.m_shape.Scale; } 224 get { return m_shape.Scale; }
208 } 225 }
226
209 #endregion 227 #endregion
210 228
211 public LLUUID ObjectOwner 229 public LLUUID ObjectOwner
@@ -215,16 +233,16 @@ namespace OpenSim.Region.Environment.Scenes
215 233
216 public SceneObjectGroup ParentGroup 234 public SceneObjectGroup ParentGroup
217 { 235 {
218 get { return m_parentGroup; } 236 get { return m_parentGroup; }
219 } 237 }
220 238
221 #region Constructors 239 #region Constructors
240
222 /// <summary> 241 /// <summary>
223 /// 242 ///
224 /// </summary> 243 /// </summary>
225 public SceneObjectPart() 244 public SceneObjectPart()
226 { 245 {
227
228 } 246 }
229 247
230 /// <summary> 248 /// <summary>
@@ -236,43 +254,44 @@ namespace OpenSim.Region.Environment.Scenes
236 /// <param name="localID"></param> 254 /// <param name="localID"></param>
237 /// <param name="shape"></param> 255 /// <param name="shape"></param>
238 /// <param name="position"></param> 256 /// <param name="position"></param>
239 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) 257 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
240 { 258 PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition)
241 this.m_name = "Primitive"; 259 {
242 this.m_regionHandle = regionHandle; 260 m_name = "Primitive";
243 this.m_parentGroup = parent; 261 m_regionHandle = regionHandle;
244 262 m_parentGroup = parent;
245 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 263
246 this.OwnerID = ownerID; 264 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
247 this.CreatorID = this.OwnerID; 265 OwnerID = ownerID;
248 this.LastOwnerID = LLUUID.Zero; 266 CreatorID = OwnerID;
249 this.UUID = LLUUID.Random(); 267 LastOwnerID = LLUUID.Zero;
250 this.LocalID = (uint)(localID); 268 UUID = LLUUID.Random();
251 this.Shape = shape; 269 LocalID = (uint) (localID);
252 270 Shape = shape;
253 this.GroupPosition = groupPosition; 271
254 this.OffsetPosition = offsetPosition; 272 GroupPosition = groupPosition;
255 this.RotationOffset = LLQuaternion.Identity; 273 OffsetPosition = offsetPosition;
256 this.Velocity = new LLVector3(0, 0, 0); 274 RotationOffset = LLQuaternion.Identity;
257 this.AngularVelocity = new LLVector3(0, 0, 0); 275 Velocity = new LLVector3(0, 0, 0);
258 this.Acceleration = new LLVector3(0, 0, 0); 276 AngularVelocity = new LLVector3(0, 0, 0);
259 277 Acceleration = new LLVector3(0, 0, 0);
278
260 m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); 279 m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
261 m_folderID = LLUUID.Random(); 280 m_folderID = LLUUID.Random();
262 281
263 m_flags = 0; 282 m_flags = 0;
264 m_flags |= LLObject.ObjectFlags.ObjectModify | 283 m_flags |= LLObject.ObjectFlags.ObjectModify |
265 LLObject.ObjectFlags.ObjectCopy | 284 LLObject.ObjectFlags.ObjectCopy |
266 LLObject.ObjectFlags.ObjectYouOwner | 285 LLObject.ObjectFlags.ObjectYouOwner |
267 LLObject.ObjectFlags.Touch | 286 LLObject.ObjectFlags.Touch |
268 LLObject.ObjectFlags.ObjectMove | 287 LLObject.ObjectFlags.ObjectMove |
269 LLObject.ObjectFlags.AllowInventoryDrop | 288 LLObject.ObjectFlags.AllowInventoryDrop |
270 LLObject.ObjectFlags.ObjectTransfer | 289 LLObject.ObjectFlags.ObjectTransfer |
271 LLObject.ObjectFlags.ObjectOwnerModify; 290 LLObject.ObjectFlags.ObjectOwnerModify;
272 291
273 ScheduleFullUpdate(); 292 ScheduleFullUpdate();
274 } 293 }
275 294
276 /// <summary> 295 /// <summary>
277 /// Re/create a SceneObjectPart (prim) 296 /// Re/create a SceneObjectPart (prim)
278 /// currently not used, and maybe won't be 297 /// currently not used, and maybe won't be
@@ -283,23 +302,26 @@ namespace OpenSim.Region.Environment.Scenes
283 /// <param name="localID"></param> 302 /// <param name="localID"></param>
284 /// <param name="shape"></param> 303 /// <param name="shape"></param>
285 /// <param name="position"></param> 304 /// <param name="position"></param>
286 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID, LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, LLVector3 position, LLQuaternion rotation, uint flags) 305 public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, int creationDate, LLUUID ownerID,
306 LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape,
307 LLVector3 position, LLQuaternion rotation, uint flags)
287 { 308 {
288 this.m_regionHandle = regionHandle; 309 m_regionHandle = regionHandle;
289 this.m_parentGroup = parent; 310 m_parentGroup = parent;
290 311
291 this.CreationDate = creationDate; 312 CreationDate = creationDate;
292 this.OwnerID = ownerID; 313 OwnerID = ownerID;
293 this.CreatorID = creatorID; 314 CreatorID = creatorID;
294 this.LastOwnerID = lastOwnerID; 315 LastOwnerID = lastOwnerID;
295 this.UUID = LLUUID.Random(); 316 UUID = LLUUID.Random();
296 this.LocalID = (uint)(localID); 317 LocalID = (uint) (localID);
297 this.Shape = shape; 318 Shape = shape;
298 319
299 this.OffsetPosition = position; 320 OffsetPosition = position;
300 this.RotationOffset = rotation; 321 RotationOffset = rotation;
301 this.ObjectFlags = flags; 322 ObjectFlags = flags;
302 } 323 }
324
303 #endregion 325 #endregion
304 326
305 /// <summary> 327 /// <summary>
@@ -309,8 +331,8 @@ namespace OpenSim.Region.Environment.Scenes
309 /// <returns></returns> 331 /// <returns></returns>
310 public static SceneObjectPart FromXml(XmlReader xmlReader) 332 public static SceneObjectPart FromXml(XmlReader xmlReader)
311 { 333 {
312 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 334 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
313 return (SceneObjectPart)serializer.Deserialize(xmlReader); 335 return (SceneObjectPart) serializer.Deserialize(xmlReader);
314 } 336 }
315 337
316 /// <summary> 338 /// <summary>
@@ -319,7 +341,7 @@ namespace OpenSim.Region.Environment.Scenes
319 /// <param name="xmlWriter"></param> 341 /// <param name="xmlWriter"></param>
320 public void ToXml(XmlWriter xmlWriter) 342 public void ToXml(XmlWriter xmlWriter)
321 { 343 {
322 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 344 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
323 serializer.Serialize(xmlWriter, this); 345 serializer.Serialize(xmlWriter, this);
324 } 346 }
325 347
@@ -329,7 +351,6 @@ namespace OpenSim.Region.Environment.Scenes
329 public void SetParent(SceneObjectGroup parent) 351 public void SetParent(SceneObjectGroup parent)
330 { 352 {
331 m_parentGroup = parent; 353 m_parentGroup = parent;
332
333 } 354 }
334 355
335 public LLUUID GetRootPartUUID() 356 public LLUUID GetRootPartUUID()
@@ -342,34 +363,38 @@ namespace OpenSim.Region.Environment.Scenes
342 } 363 }
343 364
344 #region Copying 365 #region Copying
366
345 /// <summary> 367 /// <summary>
346 /// 368 ///
347 /// </summary> 369 /// </summary>
348 /// <returns></returns> 370 /// <returns></returns>
349 public SceneObjectPart Copy(uint localID) 371 public SceneObjectPart Copy(uint localID)
350 { 372 {
351 SceneObjectPart dupe = (SceneObjectPart)this.MemberwiseClone(); 373 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
352 dupe.m_shape = m_shape.Copy(); 374 dupe.m_shape = m_shape.Copy();
353 dupe.m_regionHandle = m_regionHandle; 375 dupe.m_regionHandle = m_regionHandle;
354 dupe.UUID = LLUUID.Random(); 376 dupe.UUID = LLUUID.Random();
355 dupe.LocalID = localID; 377 dupe.LocalID = localID;
356 dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); 378 dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z);
357 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); 379 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
358 dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); 380 dupe.RotationOffset =
381 new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
359 dupe.Velocity = new LLVector3(0, 0, 0); 382 dupe.Velocity = new LLVector3(0, 0, 0);
360 dupe.Acceleration = new LLVector3(0, 0, 0); 383 dupe.Acceleration = new LLVector3(0, 0, 0);
361 dupe.AngularVelocity = new LLVector3(0, 0, 0); 384 dupe.AngularVelocity = new LLVector3(0, 0, 0);
362 dupe.ObjectFlags = this.ObjectFlags; 385 dupe.ObjectFlags = ObjectFlags;
363 386
364 byte[] extraP = new byte[this.Shape.ExtraParams.Length]; 387 byte[] extraP = new byte[Shape.ExtraParams.Length];
365 Array.Copy(this.Shape.ExtraParams, extraP, extraP.Length); 388 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
366 dupe.Shape.ExtraParams = extraP; 389 dupe.Shape.ExtraParams = extraP;
367 390
368 return dupe; 391 return dupe;
369 } 392 }
393
370 #endregion 394 #endregion
371 395
372 #region Update Scheduling 396 #region Update Scheduling
397
373 /// <summary> 398 /// <summary>
374 /// 399 ///
375 /// </summary> 400 /// </summary>
@@ -387,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
387 { 412 {
388 m_parentGroup.HasChanged = true; 413 m_parentGroup.HasChanged = true;
389 } 414 }
390 this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch(); 415 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
391 m_updateFlag = 2; 416 m_updateFlag = 2;
392 } 417 }
393 418
@@ -402,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes
402 { 427 {
403 m_parentGroup.HasChanged = true; 428 m_parentGroup.HasChanged = true;
404 } 429 }
405 this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 430 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
406 m_updateFlag = 1; 431 m_updateFlag = 1;
407 } 432 }
408 } 433 }
@@ -426,56 +451,60 @@ namespace OpenSim.Region.Environment.Scenes
426 } 451 }
427 } 452 }
428 } 453 }
454
429 #endregion 455 #endregion
430 456
431 #region Shape 457 #region Shape
458
432 /// <summary> 459 /// <summary>
433 /// 460 ///
434 /// </summary> 461 /// </summary>
435 /// <param name="shapeBlock"></param> 462 /// <param name="shapeBlock"></param>
436 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 463 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
437 { 464 {
438 this.m_shape.PathBegin = shapeBlock.PathBegin; 465 m_shape.PathBegin = shapeBlock.PathBegin;
439 this.m_shape.PathEnd = shapeBlock.PathEnd; 466 m_shape.PathEnd = shapeBlock.PathEnd;
440 this.m_shape.PathScaleX = shapeBlock.PathScaleX; 467 m_shape.PathScaleX = shapeBlock.PathScaleX;
441 this.m_shape.PathScaleY = shapeBlock.PathScaleY; 468 m_shape.PathScaleY = shapeBlock.PathScaleY;
442 this.m_shape.PathShearX = shapeBlock.PathShearX; 469 m_shape.PathShearX = shapeBlock.PathShearX;
443 this.m_shape.PathShearY = shapeBlock.PathShearY; 470 m_shape.PathShearY = shapeBlock.PathShearY;
444 this.m_shape.PathSkew = shapeBlock.PathSkew; 471 m_shape.PathSkew = shapeBlock.PathSkew;
445 this.m_shape.ProfileBegin = shapeBlock.ProfileBegin; 472 m_shape.ProfileBegin = shapeBlock.ProfileBegin;
446 this.m_shape.ProfileEnd = shapeBlock.ProfileEnd; 473 m_shape.ProfileEnd = shapeBlock.ProfileEnd;
447 this.m_shape.PathCurve = shapeBlock.PathCurve; 474 m_shape.PathCurve = shapeBlock.PathCurve;
448 this.m_shape.ProfileCurve = shapeBlock.ProfileCurve; 475 m_shape.ProfileCurve = shapeBlock.ProfileCurve;
449 this.m_shape.ProfileHollow = shapeBlock.ProfileHollow; 476 m_shape.ProfileHollow = shapeBlock.ProfileHollow;
450 this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; 477 m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
451 this.m_shape.PathRevolutions = shapeBlock.PathRevolutions; 478 m_shape.PathRevolutions = shapeBlock.PathRevolutions;
452 this.m_shape.PathTaperX = shapeBlock.PathTaperX; 479 m_shape.PathTaperX = shapeBlock.PathTaperX;
453 this.m_shape.PathTaperY = shapeBlock.PathTaperY; 480 m_shape.PathTaperY = shapeBlock.PathTaperY;
454 this.m_shape.PathTwist = shapeBlock.PathTwist; 481 m_shape.PathTwist = shapeBlock.PathTwist;
455 this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; 482 m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
456 ScheduleFullUpdate(); 483 ScheduleFullUpdate();
457 } 484 }
485
458 #endregion 486 #endregion
459 487
460 #region Inventory 488 #region Inventory
489
461 public void AddInventoryItem(TaskInventoryItem item) 490 public void AddInventoryItem(TaskInventoryItem item)
462 { 491 {
463 item.parent_id = m_folderID; 492 item.parent_id = m_folderID;
464 item.creation_date = 1000; 493 item.creation_date = 1000;
465 item.ParentPartID = this.UUID; 494 item.ParentPartID = UUID;
466 this.TaskInventory.Add(item.item_id, item); 495 TaskInventory.Add(item.item_id, item);
467 this.m_inventorySerial++; 496 m_inventorySerial++;
468 } 497 }
469 498
470 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 499 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
471 { 500 {
472 if (localID == this.LocalID) 501 if (localID == LocalID)
473 { 502 {
474 if (this.TaskInventory.ContainsKey(itemID)) 503 if (TaskInventory.ContainsKey(itemID))
475 { 504 {
476 string type = TaskInventory[itemID].inv_type; 505 string type = TaskInventory[itemID].inv_type;
477 this.TaskInventory.Remove(itemID); 506 TaskInventory.Remove(itemID);
478 this.m_inventorySerial++; 507 m_inventorySerial++;
479 if (type == "lsltext") 508 if (type == "lsltext")
480 { 509 {
481 return 10; 510 return 10;
@@ -496,16 +525,17 @@ namespace OpenSim.Region.Environment.Scenes
496 /// <param name="localID"></param> 525 /// <param name="localID"></param>
497 public bool GetInventoryFileName(IClientAPI client, uint localID) 526 public bool GetInventoryFileName(IClientAPI client, uint localID)
498 { 527 {
499 if (localID == this.m_localID) 528 if (localID == m_localID)
500 { 529 {
501 if (this.m_inventorySerial > 0) 530 if (m_inventorySerial > 0)
502 { 531 {
503 client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName)); 532 client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
533 Helpers.StringToField(m_inventoryFileName));
504 return true; 534 return true;
505 } 535 }
506 else 536 else
507 { 537 {
508 client.SendTaskInventory(this.m_uuid, 0, new byte[0]); 538 client.SendTaskInventory(m_uuid, 0, new byte[0]);
509 return false; 539 return false;
510 } 540 }
511 } 541 }
@@ -515,8 +545,8 @@ namespace OpenSim.Region.Environment.Scenes
515 public string RequestInventoryFile(IXfer xferManager) 545 public string RequestInventoryFile(IXfer xferManager)
516 { 546 {
517 byte[] fileData = new byte[0]; 547 byte[] fileData = new byte[0];
518 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID); 548 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
519 foreach (TaskInventoryItem item in this.TaskInventory.Values) 549 foreach (TaskInventoryItem item in TaskInventory.Values)
520 { 550 {
521 invString.AddItemStart(); 551 invString.AddItemStart();
522 invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated()); 552 invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated());
@@ -550,49 +580,56 @@ namespace OpenSim.Region.Environment.Scenes
550 } 580 }
551 return ""; 581 return "";
552 } 582 }
583
553 #endregion 584 #endregion
554 585
555 #region ExtraParams 586 #region ExtraParams
587
556 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 588 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
557 { 589 {
558 this.m_shape.ExtraParams = new byte[data.Length + 7]; 590 m_shape.ExtraParams = new byte[data.Length + 7];
559 int i = 0; 591 int i = 0;
560 uint length = (uint)data.Length; 592 uint length = (uint) data.Length;
561 this.m_shape.ExtraParams[i++] = 1; 593 m_shape.ExtraParams[i++] = 1;
562 this.m_shape.ExtraParams[i++] = (byte)(type % 256); 594 m_shape.ExtraParams[i++] = (byte) (type%256);
563 this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); 595 m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
564 596
565 this.m_shape.ExtraParams[i++] = (byte)(length % 256); 597 m_shape.ExtraParams[i++] = (byte) (length%256);
566 this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); 598 m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
567 this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); 599 m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
568 this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); 600 m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
569 Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); 601 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
570
571 this.ScheduleFullUpdate();
572 602
603 ScheduleFullUpdate();
573 } 604 }
605
574 #endregion 606 #endregion
575 607
576 #region Texture 608 #region Texture
609
577 /// <summary> 610 /// <summary>
578 /// 611 ///
579 /// </summary> 612 /// </summary>
580 /// <param name="textureEntry"></param> 613 /// <param name="textureEntry"></param>
581 public void UpdateTextureEntry(byte[] textureEntry) 614 public void UpdateTextureEntry(byte[] textureEntry)
582 { 615 {
583 this.m_shape.TextureEntry = textureEntry; 616 m_shape.TextureEntry = textureEntry;
584 ScheduleFullUpdate(); 617 ScheduleFullUpdate();
585 } 618 }
619
586 #endregion 620 #endregion
587 621
588 #region ParticleSystem 622 #region ParticleSystem
589 public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) 623
624 public void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
590 { 625 {
591 this.m_particleSystem = pSystem.GetBytes(); 626 m_particleSystem = pSystem.GetBytes();
592 } 627 }
628
593 #endregion 629 #endregion
594 630
595 #region Position 631 #region Position
632
596 /// <summary> 633 /// <summary>
597 /// 634 ///
598 /// </summary> 635 /// </summary>
@@ -600,46 +637,52 @@ namespace OpenSim.Region.Environment.Scenes
600 public void UpdateOffSet(LLVector3 pos) 637 public void UpdateOffSet(LLVector3 pos)
601 { 638 {
602 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 639 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
603 this.OffsetPosition = newPos; 640 OffsetPosition = newPos;
604 ScheduleTerseUpdate(); 641 ScheduleTerseUpdate();
605 } 642 }
606 643
607 public void UpdateGroupPosition(LLVector3 pos) 644 public void UpdateGroupPosition(LLVector3 pos)
608 { 645 {
609 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 646 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
610 this.GroupPosition = newPos; 647 GroupPosition = newPos;
611 ScheduleTerseUpdate(); 648 ScheduleTerseUpdate();
612 } 649 }
650
613 #endregion 651 #endregion
614 652
615 #region rotation 653 #region rotation
654
616 public void UpdateRotation(LLQuaternion rot) 655 public void UpdateRotation(LLQuaternion rot)
617 { 656 {
618 this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); 657 RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
619 ScheduleTerseUpdate(); 658 ScheduleTerseUpdate();
620 } 659 }
660
621 #endregion 661 #endregion
622 662
623 #region Resizing/Scale 663 #region Resizing/Scale
664
624 /// <summary> 665 /// <summary>
625 /// 666 ///
626 /// </summary> 667 /// </summary>
627 /// <param name="scale"></param> 668 /// <param name="scale"></param>
628 public void Resize(LLVector3 scale) 669 public void Resize(LLVector3 scale)
629 { 670 {
630 this.m_shape.Scale = scale; 671 m_shape.Scale = scale;
631 ScheduleFullUpdate(); 672 ScheduleFullUpdate();
632 } 673 }
674
633 #endregion 675 #endregion
634 676
635 #region Client Update Methods 677 #region Client Update Methods
678
636 public void AddFullUpdateToAllAvatars() 679 public void AddFullUpdateToAllAvatars()
637 { 680 {
638 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 681 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
639 for (int i = 0; i < avatars.Count; i++) 682 for (int i = 0; i < avatars.Count; i++)
640 { 683 {
641 avatars[i].AddFullPart(this); 684 avatars[i].AddFullPart(this);
642 // avatars[i].QueuePartForUpdate(this); 685 // avatars[i].QueuePartForUpdate(this);
643 } 686 }
644 } 687 }
645 688
@@ -654,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
654 /// </summary> 697 /// </summary>
655 public void SendFullUpdateToAllClients() 698 public void SendFullUpdateToAllClients()
656 { 699 {
657 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 700 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
658 for (int i = 0; i < avatars.Count; i++) 701 for (int i = 0; i < avatars.Count; i++)
659 { 702 {
660 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); 703 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
@@ -691,26 +734,26 @@ namespace OpenSim.Region.Environment.Scenes
691 LLQuaternion lRot; 734 LLQuaternion lRot;
692 lRot = RotationOffset; 735 lRot = RotationOffset;
693 736
694 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID, 737 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, ObjectFlags, m_uuid,
695 m_text, ParentID, this.m_particleSystem, lRot); 738 OwnerID,
739 m_text, ParentID, m_particleSystem, lRot);
696 } 740 }
697 741
698 /// Terse updates 742 /// Terse updates
699
700 public void AddTerseUpdateToAllAvatars() 743 public void AddTerseUpdateToAllAvatars()
701 { 744 {
702 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 745 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
703 for (int i = 0; i < avatars.Count; i++) 746 for (int i = 0; i < avatars.Count; i++)
704 { 747 {
705 avatars[i].AddTersePart(this); 748 avatars[i].AddTersePart(this);
706 // avatars[i].QueuePartForUpdate(this); 749 // avatars[i].QueuePartForUpdate(this);
707 } 750 }
708 } 751 }
709 752
710 public void AddTerseUpdateToAvatar(ScenePresence presence) 753 public void AddTerseUpdateToAvatar(ScenePresence presence)
711 { 754 {
712 presence.AddTersePart(this); 755 presence.AddTersePart(this);
713 // presence.QueuePartForUpdate(this); 756 // presence.QueuePartForUpdate(this);
714 } 757 }
715 758
716 /// <summary> 759 /// <summary>
@@ -718,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
718 /// </summary> 761 /// </summary>
719 public void SendTerseUpdateToAllClients() 762 public void SendTerseUpdateToAllClients()
720 { 763 {
721 List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); 764 List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
722 for (int i = 0; i < avatars.Count; i++) 765 for (int i = 0; i < avatars.Count; i++)
723 { 766 {
724 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); 767 m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
@@ -741,8 +784,8 @@ namespace OpenSim.Region.Environment.Scenes
741 public void SendTerseUpdateToClient(IClientAPI remoteClient) 784 public void SendTerseUpdateToClient(IClientAPI remoteClient)
742 { 785 {
743 LLVector3 lPos; 786 LLVector3 lPos;
744 lPos = this.OffsetPosition; 787 lPos = OffsetPosition;
745 LLQuaternion mRot = this.RotationOffset; 788 LLQuaternion mRot = RotationOffset;
746 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 789 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
747 } 790 }
748 791
@@ -753,9 +796,10 @@ namespace OpenSim.Region.Environment.Scenes
753 /// <param name="lPos"></param> 796 /// <param name="lPos"></param>
754 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 797 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
755 { 798 {
756 LLQuaternion mRot = this.RotationOffset; 799 LLQuaternion mRot = RotationOffset;
757 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 800 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
758 } 801 }
802
759 #endregion 803 #endregion
760 804
761 public virtual void UpdateMovement() 805 public virtual void UpdateMovement()
@@ -778,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes
778 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID) 822 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
779 { 823 {
780 BuildString += "\tinv_object\t0\n\t{\n"; 824 BuildString += "\tinv_object\t0\n\t{\n";
781 this.AddNameValueLine("obj_id", folderID.ToStringHyphenated()); 825 AddNameValueLine("obj_id", folderID.ToStringHyphenated());
782 this.AddNameValueLine("parent_id", parentID.ToStringHyphenated()); 826 AddNameValueLine("parent_id", parentID.ToStringHyphenated());
783 this.AddNameValueLine("type", "category"); 827 AddNameValueLine("type", "category");
784 this.AddNameValueLine("name", "Contents"); 828 AddNameValueLine("name", "Contents");
785 this.AddSectionEnd(); 829 AddSectionEnd();
786 } 830 }
787 831
788 public void AddItemStart() 832 public void AddItemStart()
@@ -831,7 +875,7 @@ namespace OpenSim.Region.Environment.Scenes
831 "", 875 "",
832 "", 876 "",
833 "", 877 "",
834 "", 878 "",
835 "", 879 "",
836 "lsltext", 880 "lsltext",
837 "" 881 ""
@@ -865,5 +909,4 @@ namespace OpenSim.Region.Environment.Scenes
865 } 909 }
866 } 910 }
867 } 911 }
868} 912} \ No newline at end of file
869
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index 8c8cebe..e8f29c8 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Environment.Scenes
35 { 35 {
36 public class AvatarAnimations 36 public class AvatarAnimations
37 { 37 {
38
39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); 38 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); 39 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
41 40
@@ -52,12 +51,10 @@ namespace OpenSim.Region.Environment.Scenes
52 doc.Load(reader); 51 doc.Load(reader);
53 foreach (XmlNode nod in doc.DocumentElement.ChildNodes) 52 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
54 { 53 {
55
56 if (nod.Attributes["name"] != null) 54 if (nod.Attributes["name"] != null)
57 { 55 {
58 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); 56 AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
59 } 57 }
60
61 } 58 }
62 59
63 reader.Close(); 60 reader.Close();
@@ -71,4 +68,4 @@ namespace OpenSim.Region.Environment.Scenes
71 } 68 }
72 } 69 }
73 } 70 }
74} 71} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
index efe613f..605e8a1 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs
@@ -37,7 +37,6 @@ namespace OpenSim.Region.Environment.Scenes
37 { 37 {
38 public Avatar() 38 public Avatar()
39 { 39 {
40
41 } 40 }
42 41
43 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 42 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@@ -61,7 +60,6 @@ namespace OpenSim.Region.Environment.Scenes
61 { 60 {
62 public ChildAgent() 61 public ChildAgent()
63 { 62 {
64
65 } 63 }
66 64
67 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 65 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
@@ -81,5 +79,4 @@ namespace OpenSim.Region.Environment.Scenes
81 } 79 }
82 } 80 }
83 } 81 }
84 82} \ No newline at end of file
85}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 6d51fbc..64c6eaa 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -27,7 +27,6 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
31using Axiom.Math; 30using Axiom.Math;
32using libsecondlife; 31using libsecondlife;
33using libsecondlife.Packets; 32using libsecondlife.Packets;
@@ -72,7 +71,8 @@ namespace OpenSim.Region.Environment.Scenes
72 private IScenePresenceBody m_body; 71 private IScenePresenceBody m_body;
73 72
74 private Vector3[] Dir_Vectors = new Vector3[6]; 73 private Vector3[] Dir_Vectors = new Vector3[6];
75 private libsecondlife.LLVector3 lastPhysPos = new libsecondlife.LLVector3(); 74 private LLVector3 lastPhysPos = new LLVector3();
75
76 private enum Dir_ControlFlags 76 private enum Dir_ControlFlags
77 { 77 {
78 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, 78 DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
@@ -82,48 +82,39 @@ namespace OpenSim.Region.Environment.Scenes
82 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, 82 DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
83 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG 83 DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
84 } 84 }
85
85 /// <summary> 86 /// <summary>
86 /// Position at which a significant movement was made 87 /// Position at which a significant movement was made
87 /// </summary> 88 /// </summary>
88 private LLVector3 posLastSignificantMove = new LLVector3(); 89 private LLVector3 posLastSignificantMove = new LLVector3();
89 90
90 public delegate void SignificantClientMovement(IClientAPI remote_client); 91 public delegate void SignificantClientMovement(IClientAPI remote_client);
92
91 public event SignificantClientMovement OnSignificantClientMovement; 93 public event SignificantClientMovement OnSignificantClientMovement;
92 94
93 //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); 95 //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
94 96
95 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); 97 // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>();
96 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); 98 // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>();
97 99
98 private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); 100 private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
99 private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); 101 private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
100 102
101 #region Properties 103 #region Properties
104
102 /// <summary> 105 /// <summary>
103 /// 106 ///
104 /// </summary> 107 /// </summary>
105 public PhysicsActor PhysActor 108 public PhysicsActor PhysActor
106 { 109 {
107 set 110 set { _physActor = value; }
108 { 111 get { return _physActor; }
109 this._physActor = value;
110 }
111 get
112 {
113 return _physActor;
114 }
115 } 112 }
116 113
117 public bool Updated 114 public bool Updated
118 { 115 {
119 set 116 set { updateflag = value; }
120 { 117 get { return updateflag; }
121 this.updateflag = value;
122 }
123 get
124 {
125 return this.updateflag;
126 }
127 } 118 }
128 119
129 public ulong RegionHandle 120 public ulong RegionHandle
@@ -132,12 +123,14 @@ namespace OpenSim.Region.Environment.Scenes
132 } 123 }
133 124
134 private string m_firstname; 125 private string m_firstname;
126
135 public string Firstname 127 public string Firstname
136 { 128 {
137 get { return m_firstname; } 129 get { return m_firstname; }
138 } 130 }
139 131
140 private string m_lastname; 132 private string m_lastname;
133
141 public string Lastname 134 public string Lastname
142 { 135 {
143 get { return m_lastname; } 136 get { return m_lastname; }
@@ -146,6 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
146 #endregion 139 #endregion
147 140
148 #region Constructor(s) 141 #region Constructor(s)
142
149 /// <summary> 143 /// <summary>
150 /// 144 ///
151 /// </summary> 145 /// </summary>
@@ -155,19 +149,18 @@ namespace OpenSim.Region.Environment.Scenes
155 /// <param name="regionDat"></param> 149 /// <param name="regionDat"></param>
156 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo) 150 public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
157 { 151 {
158
159 m_scene = world; 152 m_scene = world;
160 this.m_uuid = theClient.AgentId; 153 m_uuid = theClient.AgentId;
161 154
162 m_regionInfo = reginfo; 155 m_regionInfo = reginfo;
163 m_regionHandle = reginfo.RegionHandle; 156 m_regionHandle = reginfo.RegionHandle;
164 MainLog.Instance.Verbose("Avatar.cs "); 157 MainLog.Instance.Verbose("Avatar.cs ");
165 ControllingClient = theClient; 158 ControllingClient = theClient;
166 this.m_firstname = ControllingClient.FirstName; 159 m_firstname = ControllingClient.FirstName;
167 this.m_lastname = ControllingClient.LastName; 160 m_lastname = ControllingClient.LastName;
168 m_localId = m_scene.NextLocalId; 161 m_localId = m_scene.NextLocalId;
169 AbsolutePosition = ControllingClient.StartPos; 162 AbsolutePosition = ControllingClient.StartPos;
170 163
171 visualParams = new byte[218]; 164 visualParams = new byte[218];
172 for (int i = 0; i < 218; i++) 165 for (int i = 0; i < 218; i++)
173 { 166 {
@@ -175,37 +168,37 @@ namespace OpenSim.Region.Environment.Scenes
175 } 168 }
176 169
177 Wearables = AvatarWearable.DefaultWearables; 170 Wearables = AvatarWearable.DefaultWearables;
178 Animations = new ScenePresence.AvatarAnimations(); 171 Animations = new AvatarAnimations();
179 Animations.LoadAnims(); 172 Animations.LoadAnims();
180 173
181 //register for events 174 //register for events
182 ControllingClient.OnRequestWearables += this.SendOurAppearance; 175 ControllingClient.OnRequestWearables += SendOurAppearance;
183 ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 176 ControllingClient.OnSetAppearance += new SetAppearance(SetAppearance);
184 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; 177 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
185 ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; 178 ControllingClient.OnCompleteMovementToRegion += SendInitialData;
186 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; 179 ControllingClient.OnAgentUpdate += HandleAgentUpdate;
187 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 180 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
188 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 181 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
189 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 182 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
190 183
191 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD 184 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
192 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK 185 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
193 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT 186 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
194 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT 187 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT
195 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP 188 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
196 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 189 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
197 190
198 this.m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); 191 m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length);
199 192
200 //temporary until we move some code into the body classes 193 //temporary until we move some code into the body classes
201 this.m_body = new ChildAgent(); 194 m_body = new ChildAgent();
202 195
203 if (newAvatar) 196 if (newAvatar)
204 { 197 {
205 //do we need to use newAvatar? not sure so have added this to kill the compile warning 198 //do we need to use newAvatar? not sure so have added this to kill the compile warning
206 } 199 }
207
208 } 200 }
201
209 #endregion 202 #endregion
210 203
211 public void AddTersePart(SceneObjectPart part) 204 public void AddTersePart(SceneObjectPart part)
@@ -228,10 +221,10 @@ namespace OpenSim.Region.Environment.Scenes
228 while (terse) 221 while (terse)
229 { 222 {
230 SceneObjectPart part = m_tersePartUpdates.Dequeue(); 223 SceneObjectPart part = m_tersePartUpdates.Dequeue();
231 part.SendTerseUpdate(this.ControllingClient); 224 part.SendTerseUpdate(ControllingClient);
232 terseCount++; 225 terseCount++;
233 226
234 if ((m_tersePartUpdates.Count < 1) |(terseCount > 30)) 227 if ((m_tersePartUpdates.Count < 1) | (terseCount > 30))
235 { 228 {
236 terse = false; 229 terse = false;
237 } 230 }
@@ -245,31 +238,30 @@ namespace OpenSim.Region.Environment.Scenes
245 while (full) 238 while (full)
246 { 239 {
247 SceneObjectPart part = m_fullPartUpdates.Dequeue(); 240 SceneObjectPart part = m_fullPartUpdates.Dequeue();
248 part.SendFullUpdate(this.ControllingClient); 241 part.SendFullUpdate(ControllingClient);
249 fullCount++; 242 fullCount++;
250 if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) 243 if ((m_fullPartUpdates.Count < 1) | (fullCount > 40))
251 { 244 {
252 full = false; 245 full = false;
253 } 246 }
254
255 } 247 }
256 } 248 }
257 } 249 }
258 250
259 #region Status Methods 251 #region Status Methods
252
260 /// <summary> 253 /// <summary>
261 /// Not Used, most likely can be deleted 254 /// Not Used, most likely can be deleted
262 /// </summary> 255 /// </summary>
263 /// <param name="status"></param> 256 /// <param name="status"></param>
264 public void ChildStatusChange(bool status) 257 public void ChildStatusChange(bool status)
265 { 258 {
266 this.childAgent = status; 259 childAgent = status;
267 260
268 if (this.childAgent == true) 261 if (childAgent == true)
269 { 262 {
270 this.Velocity = new LLVector3(0, 0, 0); 263 Velocity = new LLVector3(0, 0, 0);
271 this.AbsolutePosition = new LLVector3(128, 128, 70); 264 AbsolutePosition = new LLVector3(128, 128, 70);
272
273 } 265 }
274 } 266 }
275 267
@@ -280,17 +272,17 @@ namespace OpenSim.Region.Environment.Scenes
280 public void MakeAvatar(LLVector3 pos, bool isFlying) 272 public void MakeAvatar(LLVector3 pos, bool isFlying)
281 { 273 {
282 //this.childAvatar = false; 274 //this.childAvatar = false;
283 this.AbsolutePosition = pos; 275 AbsolutePosition = pos;
284 this._physActor.Flying = isFlying; 276 _physActor.Flying = isFlying;
285 this.newAvatar = true; 277 newAvatar = true;
286 this.childAgent = false; 278 childAgent = false;
287 this.m_scene.SendAllSceneObjectsToClient(this); 279 m_scene.SendAllSceneObjectsToClient(this);
288 } 280 }
289 281
290 protected void MakeChildAgent() 282 protected void MakeChildAgent()
291 { 283 {
292 this.Velocity = new LLVector3(0, 0, 0); 284 Velocity = new LLVector3(0, 0, 0);
293 this.childAgent = true; 285 childAgent = true;
294 //this.Pos = new LLVector3(128, 128, 70); 286 //this.Pos = new LLVector3(128, 128, 70);
295 } 287 }
296 288
@@ -300,8 +292,8 @@ namespace OpenSim.Region.Environment.Scenes
300 /// <param name="pos"></param> 292 /// <param name="pos"></param>
301 public void Teleport(LLVector3 pos) 293 public void Teleport(LLVector3 pos)
302 { 294 {
303 this.AbsolutePosition = pos; 295 AbsolutePosition = pos;
304 this.SendTerseUpdateToALLClients(); 296 SendTerseUpdateToALLClients();
305 } 297 }
306 298
307 /// <summary> 299 /// <summary>
@@ -309,11 +301,12 @@ namespace OpenSim.Region.Environment.Scenes
309 /// </summary> 301 /// </summary>
310 public void StopMovement() 302 public void StopMovement()
311 { 303 {
312
313 } 304 }
305
314 #endregion 306 #endregion
315 307
316 #region Event Handlers 308 #region Event Handlers
309
317 /// <summary> 310 /// <summary>
318 /// 311 ///
319 /// </summary> 312 /// </summary>
@@ -322,14 +315,14 @@ namespace OpenSim.Region.Environment.Scenes
322 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) 315 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
323 { 316 {
324 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); 317 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
325 this.m_textureEntry = textureEnt; 318 m_textureEntry = textureEnt;
326 319
327 for (int i = 0; i < visualParam.Length; i++) 320 for (int i = 0; i < visualParam.Length; i++)
328 { 321 {
329 this.visualParams[i] = visualParam[i].ParamValue; 322 visualParams[i] = visualParam[i].ParamValue;
330 } 323 }
331 324
332 this.SendArrearanceToAllOtherAgents(); 325 SendArrearanceToAllOtherAgents();
333 } 326 }
334 327
335 /// <summary> 328 /// <summary>
@@ -337,16 +330,16 @@ namespace OpenSim.Region.Environment.Scenes
337 /// </summary> 330 /// </summary>
338 public void CompleteMovement() 331 public void CompleteMovement()
339 { 332 {
340 LLVector3 look = this.Velocity; 333 LLVector3 look = Velocity;
341 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 334 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
342 { 335 {
343 look = new LLVector3(0.99f, 0.042f, 0); 336 look = new LLVector3(0.99f, 0.042f, 0);
344 } 337 }
345 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 338 ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
346 if (this.childAgent) 339 if (childAgent)
347 { 340 {
348 this.childAgent = false; 341 childAgent = false;
349 342
350 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 343 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
351 } 344 }
352 } 345 }
@@ -363,47 +356,45 @@ namespace OpenSim.Region.Environment.Scenes
363 bool DCFlagKeyPressed = false; 356 bool DCFlagKeyPressed = false;
364 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 357 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
365 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 358 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
366 bool oldflying = this.PhysActor.Flying; 359 bool oldflying = PhysActor.Flying;
367 this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 360 PhysActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
368 if (this.PhysActor.Flying != oldflying) 361 if (PhysActor.Flying != oldflying)
369 { 362 {
370 update_movementflag = true; 363 update_movementflag = true;
371 } 364 }
372 365
373 if (q != this.bodyRot) 366 if (q != bodyRot)
374 { 367 {
375 this.bodyRot = q; 368 bodyRot = q;
376 update_rotation = true; 369 update_rotation = true;
377 } 370 }
378 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 371 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
379 { 372 {
380 if ((flags & (uint)DCF) != 0) 373 if ((flags & (uint) DCF) != 0)
381 { 374 {
382 DCFlagKeyPressed = true; 375 DCFlagKeyPressed = true;
383 agent_control_v3 += Dir_Vectors[i]; 376 agent_control_v3 += Dir_Vectors[i];
384 if ((movementflag & (uint)DCF) == 0) 377 if ((movementflag & (uint) DCF) == 0)
385 { 378 {
386 movementflag += (byte)(uint)DCF; 379 movementflag += (byte) (uint) DCF;
387 update_movementflag = true; 380 update_movementflag = true;
388 } 381 }
389 } 382 }
390 else 383 else
391 { 384 {
392 if ((movementflag & (uint)DCF) != 0) 385 if ((movementflag & (uint) DCF) != 0)
393 { 386 {
394 movementflag -= (byte)(uint)DCF; 387 movementflag -= (byte) (uint) DCF;
395 update_movementflag = true; 388 update_movementflag = true;
396
397 } 389 }
398 } 390 }
399 i++; 391 i++;
400 } 392 }
401 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 393 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
402 { 394 {
403 this.AddNewMovement(agent_control_v3, q); 395 AddNewMovement(agent_control_v3, q);
404 } 396 }
405 UpdateMovementAnimations(update_movementflag); 397 UpdateMovementAnimations(update_movementflag);
406
407 } 398 }
408 399
409 protected void UpdateMovementAnimations(bool update_movementflag) 400 protected void UpdateMovementAnimations(bool update_movementflag)
@@ -412,49 +403,48 @@ namespace OpenSim.Region.Environment.Scenes
412 { 403 {
413 if (movementflag != 0) 404 if (movementflag != 0)
414 { 405 {
415 if (this._physActor.Flying) 406 if (_physActor.Flying)
416 { 407 {
417 this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1); 408 SendAnimPack(Animations.AnimsLLUUID["FLY"], 1);
418 } 409 }
419 else 410 else
420 { 411 {
421 this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); 412 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
422 } 413 }
423 } 414 }
424 else 415 else
425 { 416 {
426 this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); 417 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
427 } 418 }
428 } 419 }
429
430 } 420 }
431 421
432 422
433 protected void AddNewMovement(Vector3 vec, Quaternion rotation) 423 protected void AddNewMovement(Vector3 vec, Quaternion rotation)
434 { 424 {
435 NewForce newVelocity = new NewForce(); 425 NewForce newVelocity = new NewForce();
436 Vector3 direc = rotation * vec; 426 Vector3 direc = rotation*vec;
437 direc.Normalize(); 427 direc.Normalize();
438 428
439 direc = direc * ((0.03f) * 128f); 429 direc = direc*((0.03f)*128f);
440 if (this._physActor.Flying) 430 if (_physActor.Flying)
441 direc *= 4; 431 direc *= 4;
442 432
443 newVelocity.X = direc.x; 433 newVelocity.X = direc.x;
444 newVelocity.Y = direc.y; 434 newVelocity.Y = direc.y;
445 newVelocity.Z = direc.z; 435 newVelocity.Z = direc.z;
446 this.forcesList.Add(newVelocity); 436 forcesList.Add(newVelocity);
447 } 437 }
448 438
449 #endregion 439 #endregion
450 440
451 #region Overridden Methods 441 #region Overridden Methods
442
452 /// <summary> 443 /// <summary>
453 /// 444 ///
454 /// </summary> 445 /// </summary>
455 public override void LandRenegerated() 446 public override void LandRenegerated()
456 { 447 {
457
458 } 448 }
459 449
460 /// <summary> 450 /// <summary>
@@ -462,63 +452,65 @@ namespace OpenSim.Region.Environment.Scenes
462 /// </summary> 452 /// </summary>
463 public override void Update() 453 public override void Update()
464 { 454 {
465 this.SendPrimUpdates(); 455 SendPrimUpdates();
466 456
467 if (this.newCoarseLocations) { 457 if (newCoarseLocations)
468 this.SendCoarseLocations(); 458 {
469 this.newCoarseLocations = false; 459 SendCoarseLocations();
460 newCoarseLocations = false;
470 } 461 }
471 462
472 if (this.childAgent == false) 463 if (childAgent == false)
473 { 464 {
474
475 /// check for user movement 'forces' (ie commands to move) 465 /// check for user movement 'forces' (ie commands to move)
476 if (this.newForce) 466 if (newForce)
477 { 467 {
478 this.SendTerseUpdateToALLClients(); 468 SendTerseUpdateToALLClients();
479 _updateCount = 0; 469 _updateCount = 0;
480 } 470 }
481 471
482 /// check for scripted movement (?) 472 /// check for scripted movement (?)
483 else if (movementflag != 0) 473 else if (movementflag != 0)
484 { 474 {
485 _updateCount++; 475 _updateCount++;
486 if (_updateCount > 3) 476 if (_updateCount > 3)
487 { 477 {
488 this.SendTerseUpdateToALLClients(); 478 SendTerseUpdateToALLClients();
489 _updateCount = 0; 479 _updateCount = 0;
490 } 480 }
491 } 481 }
492 482
493 /// check for physics-related movement 483 /// check for physics-related movement
494 else if (this.lastPhysPos.GetDistanceTo(this.AbsolutePosition) > 0.02 ) 484 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
495 { 485 {
496 this.SendTerseUpdateToALLClients(); 486 SendTerseUpdateToALLClients();
497 _updateCount = 0; 487 _updateCount = 0;
498 this.lastPhysPos = this.AbsolutePosition; 488 lastPhysPos = AbsolutePosition;
499 } 489 }
500 this.CheckForSignificantMovement(); 490 CheckForSignificantMovement();
501 this.CheckForBorderCrossing(); 491 CheckForBorderCrossing();
502
503 } 492 }
504 } 493 }
494
505 #endregion 495 #endregion
506 496
507 #region Update Client(s) 497 #region Update Client(s)
498
508 /// <summary> 499 /// <summary>
509 /// 500 ///
510 /// </summary> 501 /// </summary>
511 /// <param name="RemoteClient"></param> 502 /// <param name="RemoteClient"></param>
512 public void SendTerseUpdateToClient(IClientAPI RemoteClient) 503 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
513 { 504 {
514 LLVector3 pos = this.AbsolutePosition; 505 LLVector3 pos = AbsolutePosition;
515 LLVector3 vel = this.Velocity; 506 LLVector3 vel = Velocity;
516 LLQuaternion rot; 507 LLQuaternion rot;
517 rot.X = this.bodyRot.x; 508 rot.X = bodyRot.x;
518 rot.Y = this.bodyRot.y; 509 rot.Y = bodyRot.y;
519 rot.Z = this.bodyRot.z; 510 rot.Z = bodyRot.z;
520 rot.W = this.bodyRot.w; 511 rot.W = bodyRot.w;
521 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z), rot); 512 RemoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z),
513 new LLVector3(vel.X, vel.Y, vel.Z), rot);
522 } 514 }
523 515
524 /// <summary> 516 /// <summary>
@@ -526,42 +518,44 @@ namespace OpenSim.Region.Environment.Scenes
526 /// </summary> 518 /// </summary>
527 public void SendTerseUpdateToALLClients() 519 public void SendTerseUpdateToALLClients()
528 { 520 {
529 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 521 List<ScenePresence> avatars = m_scene.RequestAvatarList();
530 for (int i = 0; i < avatars.Count; i++) 522 for (int i = 0; i < avatars.Count; i++)
531 { 523 {
532 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 524 SendTerseUpdateToClient(avatars[i].ControllingClient);
533 } 525 }
534 } 526 }
535 527
536 528
537 public void SendCoarseLocations() 529 public void SendCoarseLocations()
538 { 530 {
539 List<LLVector3> CoarseLocations = new List<LLVector3>(); 531 List<LLVector3> CoarseLocations = new List<LLVector3>();
540 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 532 List<ScenePresence> avatars = m_scene.RequestAvatarList();
541 for (int i = 0; i < avatars.Count; i++) 533 for (int i = 0; i < avatars.Count; i++)
542 { 534 {
543 if (avatars[i] != this && (!avatars[i].childAgent) ) { 535 if (avatars[i] != this && (!avatars[i].childAgent))
544 CoarseLocations.Add(avatars[i].AbsolutePosition); 536 {
545 } 537 CoarseLocations.Add(avatars[i].AbsolutePosition);
538 }
546 } 539 }
547 this.ControllingClient.SendCoarseLocationUpdate(CoarseLocations); 540 ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
548 } 541 }
549 542
550 public void CoarseLocationChange(ScenePresence avatar) 543 public void CoarseLocationChange(ScenePresence avatar)
551 { 544 {
552 newCoarseLocations = true; 545 newCoarseLocations = true;
553 } 546 }
554 547
555 private void NotifyMyCoarseLocationChange() 548 private void NotifyMyCoarseLocationChange()
556 { 549 {
557 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 550 List<ScenePresence> avatars = m_scene.RequestAvatarList();
558 for (int i = 0; i < avatars.Count; i++) { 551 for (int i = 0; i < avatars.Count; i++)
559 if (avatars[i] != this) { 552 {
560 avatars[i].CoarseLocationChange(this); 553 if (avatars[i] != this)
561 } 554 {
555 avatars[i].CoarseLocationChange(this);
556 }
562 } 557 }
563 558 }
564 }
565 559
566 560
567 /// <summary> 561 /// <summary>
@@ -570,16 +564,17 @@ namespace OpenSim.Region.Environment.Scenes
570 /// <param name="remoteAvatar"></param> 564 /// <param name="remoteAvatar"></param>
571 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 565 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
572 { 566 {
573 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); 567 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
568 LocalId, AbsolutePosition, m_textureEntry.ToBytes());
574 } 569 }
575 570
576 public void SendFullUpdateToALLClients() 571 public void SendFullUpdateToALLClients()
577 { 572 {
578 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 573 List<ScenePresence> avatars = m_scene.RequestAvatarList();
579 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 574 foreach (ScenePresence avatar in m_scene.RequestAvatarList())
580 { 575 {
581 this.SendFullUpdateToOtherClient(avatar); 576 SendFullUpdateToOtherClient(avatar);
582 if (avatar.LocalId != this.LocalId) 577 if (avatar.LocalId != LocalId)
583 { 578 {
584 if (!avatar.childAgent) 579 if (!avatar.childAgent)
585 { 580 {
@@ -595,15 +590,16 @@ namespace OpenSim.Region.Environment.Scenes
595 /// </summary> 590 /// </summary>
596 public void SendInitialData() 591 public void SendInitialData()
597 { 592 {
598 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); 593 ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
599 if (!this.childAgent) 594 AbsolutePosition, m_textureEntry.ToBytes());
595 if (!childAgent)
600 { 596 {
601 this.m_scene.InformClientOfNeighbours(this.ControllingClient); 597 m_scene.InformClientOfNeighbours(ControllingClient);
602 this.newAvatar = false; 598 newAvatar = false;
603 } 599 }
604 600
605 this.SendFullUpdateToALLClients(); 601 SendFullUpdateToALLClients();
606 this.SendArrearanceToAllOtherAgents(); 602 SendArrearanceToAllOtherAgents();
607 } 603 }
608 604
609 /// <summary> 605 /// <summary>
@@ -612,13 +608,13 @@ namespace OpenSim.Region.Environment.Scenes
612 /// <param name="OurClient"></param> 608 /// <param name="OurClient"></param>
613 public void SendOurAppearance(IClientAPI OurClient) 609 public void SendOurAppearance(IClientAPI OurClient)
614 { 610 {
615 this.ControllingClient.SendWearables(this.Wearables); 611 ControllingClient.SendWearables(Wearables);
616 612
617 //this.SendFullUpdateToALLClients(); 613 //this.SendFullUpdateToALLClients();
618 //this.SendArrearanceToAllOtherAgents(); 614 //this.SendArrearanceToAllOtherAgents();
619 615
620 this.m_scene.SendAllSceneObjectsToClient(this); 616 m_scene.SendAllSceneObjectsToClient(this);
621 this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); 617 ControllingClient.SendViewerTime(m_scene.TimePhase);
622 618
623 //Please don't remove the following code (at least not yet), just leave it commented out 619 //Please don't remove the following code (at least not yet), just leave it commented out
624 //gives the user god powers, should help with debuging things in the future 620 //gives the user god powers, should help with debuging things in the future
@@ -636,10 +632,10 @@ namespace OpenSim.Region.Environment.Scenes
636 /// </summary> 632 /// </summary>
637 public void SendArrearanceToAllOtherAgents() 633 public void SendArrearanceToAllOtherAgents()
638 { 634 {
639 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 635 List<ScenePresence> avatars = m_scene.RequestAvatarList();
640 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 636 foreach (ScenePresence avatar in m_scene.RequestAvatarList())
641 { 637 {
642 this.SendAppearanceToOtherAgent(avatar); 638 SendAppearanceToOtherAgent(avatar);
643 } 639 }
644 } 640 }
645 641
@@ -649,7 +645,8 @@ namespace OpenSim.Region.Environment.Scenes
649 /// <param name="avatarInfo"></param> 645 /// <param name="avatarInfo"></param>
650 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 646 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
651 { 647 {
652 avatarInfo.ControllingClient.SendAppearance(this.ControllingClient.AgentId, this.visualParams, this.m_textureEntry.ToBytes()); 648 avatarInfo.ControllingClient.SendAppearance(ControllingClient.AgentId, visualParams,
649 m_textureEntry.ToBytes());
653 } 650 }
654 651
655 /// <summary> 652 /// <summary>
@@ -659,12 +656,12 @@ namespace OpenSim.Region.Environment.Scenes
659 /// <param name="seq"></param> 656 /// <param name="seq"></param>
660 public void SendAnimPack(LLUUID animID, int seq) 657 public void SendAnimPack(LLUUID animID, int seq)
661 { 658 {
662 this.current_anim = animID; 659 current_anim = animID;
663 this.anim_seq = seq; 660 anim_seq = seq;
664 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 661 List<ScenePresence> avatars = m_scene.RequestAvatarList();
665 for (int i = 0; i < avatars.Count; i++) 662 for (int i = 0; i < avatars.Count; i++)
666 { 663 {
667 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 664 avatars[i].ControllingClient.SendAnimation(animID, seq, ControllingClient.AgentId);
668 } 665 }
669 } 666 }
670 667
@@ -673,48 +670,51 @@ namespace OpenSim.Region.Environment.Scenes
673 /// </summary> 670 /// </summary>
674 public void SendAnimPack() 671 public void SendAnimPack()
675 { 672 {
676 this.SendAnimPack(this.current_anim, this.anim_seq); 673 SendAnimPack(current_anim, anim_seq);
677 } 674 }
675
678 #endregion 676 #endregion
679 677
680 #region Significant Movement Method 678 #region Significant Movement Method
681 679
682 protected void CheckForSignificantMovement() 680 protected void CheckForSignificantMovement()
683 { 681 {
684 if (libsecondlife.Helpers.VecDist(this.AbsolutePosition, this.posLastSignificantMove) > 2.0) 682 if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0)
685 { 683 {
686 this.posLastSignificantMove = this.AbsolutePosition; 684 posLastSignificantMove = AbsolutePosition;
687 if (OnSignificantClientMovement != null) 685 if (OnSignificantClientMovement != null)
688 { 686 {
689 OnSignificantClientMovement(this.ControllingClient); 687 OnSignificantClientMovement(ControllingClient);
690 NotifyMyCoarseLocationChange(); 688 NotifyMyCoarseLocationChange();
691 } 689 }
692 } 690 }
693 } 691 }
692
694 #endregion 693 #endregion
695 694
696 #region Border Crossing Methods 695 #region Border Crossing Methods
696
697 /// <summary> 697 /// <summary>
698 /// 698 ///
699 /// </summary> 699 /// </summary>
700 protected void CheckForBorderCrossing() 700 protected void CheckForBorderCrossing()
701 { 701 {
702 LLVector3 pos2 = this.AbsolutePosition; 702 LLVector3 pos2 = AbsolutePosition;
703 LLVector3 vel = this.Velocity; 703 LLVector3 vel = Velocity;
704 704
705 float timeStep = 0.1f; 705 float timeStep = 0.1f;
706 pos2.X = pos2.X + (vel.X * timeStep); 706 pos2.X = pos2.X + (vel.X*timeStep);
707 pos2.Y = pos2.Y + (vel.Y * timeStep); 707 pos2.Y = pos2.Y + (vel.Y*timeStep);
708 pos2.Z = pos2.Z + (vel.Z * timeStep); 708 pos2.Z = pos2.Z + (vel.Z*timeStep);
709 709
710 if ((pos2.X < 0) || (pos2.X > 256)) 710 if ((pos2.X < 0) || (pos2.X > 256))
711 { 711 {
712 this.CrossToNewRegion(); 712 CrossToNewRegion();
713 } 713 }
714 714
715 if ((pos2.Y < 0) || (pos2.Y > 256)) 715 if ((pos2.Y < 0) || (pos2.Y > 256))
716 { 716 {
717 this.CrossToNewRegion(); 717 CrossToNewRegion();
718 } 718 }
719 } 719 }
720 720
@@ -723,10 +723,10 @@ namespace OpenSim.Region.Environment.Scenes
723 /// </summary> 723 /// </summary>
724 protected void CrossToNewRegion() 724 protected void CrossToNewRegion()
725 { 725 {
726 LLVector3 pos = this.AbsolutePosition; 726 LLVector3 pos = AbsolutePosition;
727 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); 727 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
728 uint neighbourx = this.m_regionInfo.RegionLocX; 728 uint neighbourx = m_regionInfo.RegionLocX;
729 uint neighboury = this.m_regionInfo.RegionLocY; 729 uint neighboury = m_regionInfo.RegionLocY;
730 730
731 if (pos.X < 1.7F) 731 if (pos.X < 1.7F)
732 { 732 {
@@ -749,24 +749,28 @@ namespace OpenSim.Region.Environment.Scenes
749 newpos.Y = 0.1F; 749 newpos.Y = 0.1F;
750 } 750 }
751 751
752 LLVector3 vel = this.m_velocity; 752 LLVector3 vel = m_velocity;
753 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 753 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
754 RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 754 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
755 if (neighbourRegion != null) 755 if (neighbourRegion != null)
756 { 756 {
757 bool res = this.m_scene.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); 757 bool res =
758 m_scene.InformNeighbourOfCrossing(neighbourHandle, ControllingClient.AgentId, newpos,
759 _physActor.Flying);
758 if (res) 760 if (res)
759 { 761 {
760 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible 762 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible
761 AgentCircuitData circuitdata = this.ControllingClient.RequestClientInfo(); 763 AgentCircuitData circuitdata = ControllingClient.RequestClientInfo();
762 string capsPath = Util.GetCapsURL(this.ControllingClient.AgentId); 764 string capsPath = Util.GetCapsURL(ControllingClient.AgentId);
763 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath); 765 ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
764 this.MakeChildAgent(); 766 capsPath);
765 this.m_scene.SendKillObject(this.m_localId); 767 MakeChildAgent();
766 this.NotifyMyCoarseLocationChange(); 768 m_scene.SendKillObject(m_localId);
769 NotifyMyCoarseLocationChange();
767 } 770 }
768 } 771 }
769 } 772 }
773
770 #endregion 774 #endregion
771 775
772 /// <summary> 776 /// <summary>
@@ -774,7 +778,6 @@ namespace OpenSim.Region.Environment.Scenes
774 /// </summary> 778 /// </summary>
775 public static void LoadAnims() 779 public static void LoadAnims()
776 { 780 {
777
778 } 781 }
779 782
780 /// <summary> 783 /// <summary>
@@ -783,21 +786,21 @@ namespace OpenSim.Region.Environment.Scenes
783 public override void UpdateMovement() 786 public override void UpdateMovement()
784 { 787 {
785 newForce = false; 788 newForce = false;
786 lock (this.forcesList) 789 lock (forcesList)
787 { 790 {
788 if (this.forcesList.Count > 0) 791 if (forcesList.Count > 0)
789 { 792 {
790 for (int i = 0; i < this.forcesList.Count; i++) 793 for (int i = 0; i < forcesList.Count; i++)
791 { 794 {
792 NewForce force = this.forcesList[i]; 795 NewForce force = forcesList[i];
793 796
794 this.updateflag = true; 797 updateflag = true;
795 this.Velocity = new LLVector3(force.X, force.Y, force.Z); 798 Velocity = new LLVector3(force.X, force.Y, force.Z);
796 this.newForce = true; 799 newForce = true;
797 } 800 }
798 for (int i = 0; i < this.forcesList.Count; i++) 801 for (int i = 0; i < forcesList.Count; i++)
799 { 802 {
800 this.forcesList.RemoveAt(0); 803 forcesList.RemoveAt(0);
801 } 804 }
802 } 805 }
803 } 806 }
@@ -824,7 +827,6 @@ namespace OpenSim.Region.Environment.Scenes
824 827
825 public NewForce() 828 public NewForce()
826 { 829 {
827
828 } 830 }
829 } 831 }
830 832
@@ -833,5 +835,4 @@ namespace OpenSim.Region.Environment.Scenes
833 throw new Exception("The method or operation is not implemented."); 835 throw new Exception("The method or operation is not implemented.");
834 } 836 }
835 } 837 }
836 838} \ No newline at end of file
837}
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
index 7cf9cb7..dbd43be 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
@@ -1,20 +1,18 @@
1using System; 1using Axiom.Math;
2using System.Collections.Generic; 2using libsecondlife;
3using System.Text; 3
4using libsecondlife;
5
6namespace OpenSim.Region.Environment.Scenes.Scripting 4namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 5{
8 public interface IScriptHost 6 public interface IScriptHost
9 { 7 {
10 string Name { get; set;} 8 string Name { get; set; }
11 string SitName{ get; set;} 9 string SitName { get; set; }
12 string TouchName { get; set;} 10 string TouchName { get; set; }
13 string Description { get; set; } 11 string Description { get; set; }
14 LLUUID UUID { get; } 12 LLUUID UUID { get; }
15 LLUUID ObjectOwner { get;} 13 LLUUID ObjectOwner { get; }
16 LLUUID ObjectCreator { get; } 14 LLUUID ObjectCreator { get; }
17 LLVector3 AbsolutePosition { get; } 15 LLVector3 AbsolutePosition { get; }
18 void SetText(string text, Axiom.Math.Vector3 color, double alpha); 16 void SetText(string text, Vector3 color, double alpha);
19 } 17 }
20} 18} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
index 875e4cb..6876cfb 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
@@ -1,14 +1,13 @@
1using System; 1using System;
2using System.Collections.Generic; 2using Axiom.Math;
3using System.Text; 3using libsecondlife;
4using libsecondlife; 4
5
6namespace OpenSim.Region.Environment.Scenes.Scripting 5namespace OpenSim.Region.Environment.Scenes.Scripting
7{ 6{
8 public class NullScriptHost : IScriptHost 7 public class NullScriptHost : IScriptHost
9 { 8 {
10 9 private LLVector3 m_pos = new LLVector3(128, 128, 30);
11 LLVector3 m_pos = new LLVector3( 128, 128, 30 ); 10
12 public string Name 11 public string Name
13 { 12 {
14 get { return "Object"; } 13 get { return "Object"; }
@@ -39,18 +38,23 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
39 } 38 }
40 39
41 public LLUUID ObjectOwner 40 public LLUUID ObjectOwner
42 { get { return LLUUID.Zero; } } 41 {
42 get { return LLUUID.Zero; }
43 }
43 44
44 public LLUUID ObjectCreator { get { return LLUUID.Zero; } } 45 public LLUUID ObjectCreator
46 {
47 get { return LLUUID.Zero; }
48 }
45 49
46 public LLVector3 AbsolutePosition 50 public LLVector3 AbsolutePosition
47 { 51 {
48 get { return m_pos; } 52 get { return m_pos; }
49 } 53 }
50 54
51 public void SetText(string text, Axiom.Math.Vector3 color, double alpha) 55 public void SetText(string text, Vector3 color, double alpha)
52 { 56 {
53 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); 57 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
54 } 58 }
55 } 59 }
56} 60} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
index 5e8ff87..06bedaf 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
@@ -26,18 +26,16 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using OpenSim.Framework.Console;
30using System.Collections.Generic; 30
31using System.Text; 31//TODO: WHERE TO PLACE THIS?
32using OpenSim.Region.Environment.Scenes.Scripting; 32
33
34//TODO: WHERE TO PLACE THIS?
35namespace OpenSim.Region.Environment.Scenes.Scripting 33namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 34{
37 public interface ScriptEngineInterface 35 public interface ScriptEngineInterface
38 { 36 {
39 void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); 37 void InitializeEngine(Scene Sceneworld, LogBase logger);
40 void Shutdown(); 38 void Shutdown();
41// void StartScript(string ScriptID, IScriptHost ObjectID); 39// void StartScript(string ScriptID, IScriptHost ObjectID);
42 } 40 }
43} 41} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
index 83bd0ab..5355388 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
@@ -26,18 +26,18 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.IO;
31using System.IO; 31using System.Reflection;
32using System.Text; 32using OpenSim.Framework.Console;
33using System.Reflection; 33
34
35namespace OpenSim.Region.Environment.Scenes.Scripting 34namespace OpenSim.Region.Environment.Scenes.Scripting
36{ 35{
37 public class ScriptEngineLoader 36 public class ScriptEngineLoader
38 { 37 {
39 private OpenSim.Framework.Console.LogBase m_log; 38 private LogBase m_log;
40 public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) 39
40 public ScriptEngineLoader(LogBase logger)
41 { 41 {
42 m_log = logger; 42 m_log = logger;
43 } 43 }
@@ -47,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
47 ScriptEngineInterface ret = null; 47 ScriptEngineInterface ret = null;
48 try 48 try
49 { 49 {
50 ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), 50 ret =
51 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); 51 LoadAndInitAssembly(
52 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
53 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
52 } 54 }
53 catch (Exception e) 55 catch (Exception e)
54 { 56 {
55 m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); 57 m_log.Error("ScriptEngine",
58 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
59 e.StackTrace.ToString());
56 } 60 }
57 return ret; 61 return ret;
58 } 62 }
@@ -107,18 +111,14 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
107 ScriptEngineInterface ret; 111 ScriptEngineInterface ret;
108 //try 112 //try
109 //{ 113 //{
110 ret = (ScriptEngineInterface)Activator.CreateInstance(t); 114 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
111 //} 115 //}
112 //catch (Exception e) 116 //catch (Exception e)
113 //{ 117 //{
114 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); 118 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
115 //} 119 //}
116 120
117 return ret; 121 return ret;
118 122 }
119
120 }
121
122
123 } 123 }
124} 124} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs
index a478827..92e6523 100644
--- a/OpenSim/Region/Environment/StorageManager.cs
+++ b/OpenSim/Region/Environment/StorageManager.cs
@@ -1,15 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Framework;
6using OpenSim.Framework.Communications;
7using OpenSim.Framework.Servers;
8using OpenSim.Region.Capabilities;
9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces;
11
12using System.Reflection; 2using System.Reflection;
3using OpenSim.Framework.Console;
4using OpenSim.Region.Environment.Interfaces;
13 5
14namespace OpenSim.Region.Environment 6namespace OpenSim.Region.Environment
15{ 7{
@@ -19,10 +11,7 @@ namespace OpenSim.Region.Environment
19 11
20 public IRegionDataStore DataStore 12 public IRegionDataStore DataStore
21 { 13 {
22 get 14 get { return m_dataStore; }
23 {
24 return m_dataStore;
25 }
26 } 15 }
27 16
28 public StorageManager(IRegionDataStore storage) 17 public StorageManager(IRegionDataStore storage)
@@ -32,7 +21,7 @@ namespace OpenSim.Region.Environment
32 21
33 public StorageManager(string dllName, string dataStoreFile, string dataStoreDB) 22 public StorageManager(string dllName, string dataStoreFile, string dataStoreDB)
34 { 23 {
35 OpenSim.Framework.Console.MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName); 24 MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName);
36 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 25 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
37 26
38 foreach (Type pluginType in pluginAssembly.GetTypes()) 27 foreach (Type pluginType in pluginAssembly.GetTypes())
@@ -43,12 +32,13 @@ namespace OpenSim.Region.Environment
43 32
44 if (typeInterface != null) 33 if (typeInterface != null)
45 { 34 {
46 IRegionDataStore plug = (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 35 IRegionDataStore plug =
36 (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
47 plug.Initialise(dataStoreFile, dataStoreDB); 37 plug.Initialise(dataStoreFile, dataStoreDB);
48 38
49 m_dataStore = plug; 39 m_dataStore = plug;
50 40
51 OpenSim.Framework.Console.MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface"); 41 MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface");
52 } 42 }
53 43
54 typeInterface = null; 44 typeInterface = null;
@@ -60,4 +50,4 @@ namespace OpenSim.Region.Environment
60 //TODO: Add checking and warning to make sure it initialised. 50 //TODO: Add checking and warning to make sure it initialised.
61 } 51 }
62 } 52 }
63} 53} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index 3b4dd9a..0b815ba 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -1,8 +1,6 @@
1using System; 1using System.Collections.Generic;
2using System.Collections.Generic; 2using OpenSim.Region.Environment.Scenes;
3using System.Text; 3
4using OpenSim.Region.Environment.Scenes;
5
6namespace OpenSim.Region.Environment.Types 4namespace OpenSim.Region.Environment.Types
7{ 5{
8 public class BasicQuadTreeNode 6 public class BasicQuadTreeNode
@@ -36,9 +34,9 @@ namespace OpenSim.Region.Environment.Types
36 } 34 }
37 else 35 else
38 { 36 {
39 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 37 if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
40 { 38 {
41 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 39 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
42 { 40 {
43 m_childNodes[0].AddObject(obj); 41 m_childNodes[0].AddObject(obj);
44 } 42 }
@@ -49,7 +47,7 @@ namespace OpenSim.Region.Environment.Types
49 } 47 }
50 else 48 else
51 { 49 {
52 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 50 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
53 { 51 {
54 m_childNodes[1].AddObject(obj); 52 m_childNodes[1].AddObject(obj);
55 } 53 }
@@ -66,10 +64,17 @@ namespace OpenSim.Region.Environment.Types
66 if (m_childNodes == null) 64 if (m_childNodes == null)
67 { 65 {
68 m_childNodes = new BasicQuadTreeNode[4]; 66 m_childNodes = new BasicQuadTreeNode[4];
69 m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); 67 m_childNodes[0] =
70 m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); 68 new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2));
71 m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); 69 m_childNodes[1] =
72 m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); 70 new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2),
71 (short) (m_height/2));
72 m_childNodes[2] =
73 new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2),
74 (short) (m_height/2));
75 m_childNodes[3] =
76 new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)),
77 (short) (m_width/2), (short) (m_height/2));
73 } 78 }
74 else 79 else
75 { 80 {
@@ -88,9 +93,9 @@ namespace OpenSim.Region.Environment.Types
88 } 93 }
89 else 94 else
90 { 95 {
91 if (x < (m_leftX + (m_width / 2))) 96 if (x < (m_leftX + (m_width/2)))
92 { 97 {
93 if (y < (m_leftY + (m_height / 2))) 98 if (y < (m_leftY + (m_height/2)))
94 { 99 {
95 return m_childNodes[0].GetObjectsFrom(x, y); 100 return m_childNodes[0].GetObjectsFrom(x, y);
96 } 101 }
@@ -101,7 +106,7 @@ namespace OpenSim.Region.Environment.Types
101 } 106 }
102 else 107 else
103 { 108 {
104 if (y < (m_leftY + (m_height / 2))) 109 if (y < (m_leftY + (m_height/2)))
105 { 110 {
106 return m_childNodes[1].GetObjectsFrom(x, y); 111 return m_childNodes[1].GetObjectsFrom(x, y);
107 } 112 }
@@ -127,7 +132,8 @@ namespace OpenSim.Region.Environment.Types
127 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 132 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
128 foreach (SceneObjectGroup group in m_objects) 133 foreach (SceneObjectGroup group in m_objects)
129 { 134 {
130 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 135 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
136 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
131 { 137 {
132 //still in bounds 138 //still in bounds
133 } 139 }
@@ -151,9 +157,10 @@ namespace OpenSim.Region.Environment.Types
151 157
152 public void PassUp(SceneObjectGroup group) 158 public void PassUp(SceneObjectGroup group)
153 { 159 {
154 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 160 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
161 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
155 { 162 {
156 this.AddObject(group); 163 AddObject(group);
157 } 164 }
158 else 165 else
159 { 166 {
@@ -164,4 +171,4 @@ namespace OpenSim.Region.Environment.Types
164 } 171 }
165 } 172 }
166 } 173 }
167} 174} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index 3b7c182..6e26aaf 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -1,9 +1,7 @@
1using System; 1using System.Collections.Generic;
2using System.Collections.Generic; 2using libsecondlife;
3using System.Text; 3using OpenSim.Region.Environment.Scenes;
4using OpenSim.Region.Environment.Scenes; 4
5using libsecondlife;
6
7namespace OpenSim.Region.Environment.Types 5namespace OpenSim.Region.Environment.Types
8{ 6{
9 public class UpdateQueue 7 public class UpdateQueue
@@ -48,7 +46,6 @@ namespace OpenSim.Region.Environment.Types
48 } 46 }
49 47
50 return part; 48 return part;
51 } 49 }
52
53 } 50 }
54} 51} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index ac5ac89..61541e8 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -25,22 +25,21 @@
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.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.ExtensionsScriptModule.CSharp;
33using OpenSim.Region.ExtensionsScriptModule.CSharp; 33using OpenSim.Region.ExtensionsScriptModule.JScript;
34using OpenSim.Region.ExtensionsScriptModule.JScript; 34using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
35using OpenSim.Region.ExtensionsScriptModule.JVMEngine; 35
36
37namespace OpenSim.Region.ExtensionsScriptModule 36namespace OpenSim.Region.ExtensionsScriptModule
38{ 37{
39 public class ScriptManager : IRegionModule 38 public class ScriptManager : IRegionModule, IExtensionScriptModule
40 { 39 {
41 List<IScript> scripts = new List<IScript>(); 40 readonly List<IScript> scripts = new List<IScript>();
42 Scene m_scene; 41 Scene m_scene;
43 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 42 readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
44 43
45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 44 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
46 { 45 {
@@ -65,15 +64,17 @@ namespace OpenSim.Region.ExtensionsScriptModule
65 64
66 JavaEngine javaCompiler = new JavaEngine(); 65 JavaEngine javaCompiler = new JavaEngine();
67 compilers.Add(javaCompiler.FileExt(), javaCompiler); 66 compilers.Add(javaCompiler.FileExt(), javaCompiler);
68 } 67 }
68
69 public delegate TResult ModuleAPIMethod1<TResult, TParam0>(TParam0 param0);
70 public delegate TResult ModuleAPIMethod2<TResult, TParam0, TParam1>(TParam0 param0, TParam1 param1);
69 71
70 public void Initialise(Scene scene) 72 public void Initialise(Scene scene)
71 { 73 {
72 System.Console.WriteLine("Initialising Extensions Scripting Module"); 74 System.Console.WriteLine("Initialising Extensions Scripting Module");
73 m_scene = scene; 75 m_scene = scene;
74 76
75 m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); 77 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
76 m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript));
77 } 78 }
78 79
79 public void PostInitialise() 80 public void PostInitialise()
@@ -133,6 +134,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
133 134
134 return true; 135 return true;
135 } 136 }
137 }
138
139 public interface IExtensionScriptModule
140 {
141 bool Compile(string filename);
142 bool AddPreCompiledScript(IScript script);
136 } 143 }
137 144
138 interface IScriptCompiler 145 interface IScriptCompiler