aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Environment
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs28
-rw-r--r--OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs5
-rw-r--r--OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionModule.cs4
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISimChat.cs7
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrain.cs3
-rw-r--r--OpenSim/Region/Environment/Interfaces/IWorldComm.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXMLRPC.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXfer.cs2
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs3
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs1
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs266
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs30
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/LoadImageURLModule.cs33
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs49
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs146
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs65
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs7
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs197
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs44
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs83
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs2
-rw-r--r--OpenSim/Region/Environment/StorageManager.cs2
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs45
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs2
48 files changed, 623 insertions, 638 deletions
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 41d14f0..9e32b35 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -30,12 +30,10 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
37 36
38
39namespace OpenSim.Region.Environment 37namespace OpenSim.Region.Environment
40{ 38{
41 /// <summary> 39 /// <summary>
@@ -216,14 +214,14 @@ namespace OpenSim.Region.Environment
216 214
217 int tempMaxAgents = 215 int tempMaxAgents =
218 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); 216 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
219 m_regInfo.EstateSettings.maxAgents = (byte)tempMaxAgents; 217 m_regInfo.EstateSettings.maxAgents = (byte) tempMaxAgents;
220 218
221 float tempObjectBonusFactor = 219 float tempObjectBonusFactor =
222 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 220 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
223 m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor; 221 m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor;
224 222
225 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); 223 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
226 m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; 224 m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel;
227 225
228 226
229 if (convertParamStringToBool(packet.ParamList[7].Parameter)) 227 if (convertParamStringToBool(packet.ParamList[7].Parameter))
@@ -250,13 +248,13 @@ namespace OpenSim.Region.Environment
250 } 248 }
251 else 249 else
252 { 250 {
253 float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 251 float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
254 float TerrainRaiseLimit = 252 float TerrainRaiseLimit =
255 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 253 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
256 float TerrainLowerLimit = 254 float TerrainLowerLimit =
257 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 255 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
258 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); 256 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
259 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 257 float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
260 258
261 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); 259 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
262 260
@@ -273,8 +271,8 @@ namespace OpenSim.Region.Environment
273 if (splitField.Length == 3) 271 if (splitField.Length == 3)
274 { 272 {
275 Int16 corner = Convert.ToInt16(splitField[0]); 273 Int16 corner = Convert.ToInt16(splitField[0]);
276 float lowValue = (float)Convert.ToDecimal(splitField[1]); 274 float lowValue = (float) Convert.ToDecimal(splitField[1]);
277 float highValue = (float)Convert.ToDecimal(splitField[2]); 275 float highValue = (float) Convert.ToDecimal(splitField[2]);
278 276
279 setEstateTextureRange(corner, lowValue, highValue); 277 setEstateTextureRange(corner, lowValue, highValue);
280 } 278 }
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Environment
343 { 341 {
344 m_scene.Broadcast( 342 m_scene.Broadcast(
345 sendRegionHandshake 343 sendRegionHandshake
346 ); 344 );
347 } 345 }
348 346
349 public void sendRegionInfoPacket(IClientAPI remote_client) 347 public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -363,8 +361,8 @@ namespace OpenSim.Region.Environment
363 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter; 361 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter;
364 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX; 362 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX;
365 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY; 363 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY;
366 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.EstateSettings.regionFlags; 364 regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.EstateSettings.regionFlags;
367 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.EstateSettings.simAccess; 365 regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.EstateSettings.simAccess;
368 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); 366 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
369 regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour; 367 regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour;
370 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit; 368 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit;
diff --git a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
index 90c3730..e7ce957 100644
--- a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
@@ -1,6 +1,3 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife; 1using libsecondlife;
5using OpenSim.Framework; 2using OpenSim.Framework;
6 3
@@ -10,4 +7,4 @@ namespace OpenSim.Region.Environment.Interfaces
10 { 7 {
11 bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams); 8 bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams);
12 } 9 }
13} 10} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
index 8a31d87..daecf86 100644
--- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
@@ -53,4 +53,4 @@ namespace OpenSim.Region.Environment.Interfaces
53 bool AsyncConvertUrl(LLUUID id, string url, string extraParams); 53 bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
54 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); 54 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
55 } 55 }
56} 56} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index 19cf131..0357139 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -34,4 +34,4 @@ namespace OpenSim.Region.Environment.Interfaces
34 { 34 {
35 LLUUID MakeHttpRequest(string url, string type, string body); 35 LLUUID MakeHttpRequest(string url, string type, string body);
36 } 36 }
37} 37} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
index 808b94a..e5d0b26 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
@@ -26,8 +26,8 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Scenes;
30using Nini.Config; 29using Nini.Config;
30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
33{ 33{
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces
39 string Name { get; } 39 string Name { get; }
40 bool IsSharedModule { get; } 40 bool IsSharedModule { get; }
41 } 41 }
42} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
index 7dc3e0b..fb491cc 100644
--- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
@@ -26,12 +26,13 @@
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using System;
30using OpenSim.Framework;
30 31
31namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
32{ 33{
33 public interface ISimChat 34 public interface ISimChat
34 { 35 {
35 void SimChat(System.Object sender, OpenSim.Framework.ChatFromViewerArgs e); 36 void SimChat(Object sender, ChatFromViewerArgs e);
36 } 37 }
37} 38} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
index 77ec2dd..9171d09 100644
--- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces;
30using OpenSim.Framework; 29using OpenSim.Framework;
31 30
32namespace OpenSim.Region.Environment.Interfaces 31namespace OpenSim.Region.Environment.Interfaces
@@ -72,4 +71,4 @@ namespace OpenSim.Region.Environment.Interfaces
72 void ExportImage(string filename, string gradientmap); 71 void ExportImage(string filename, string gradientmap);
73 byte[] ExportJpegImage(string gradientmap); 72 byte[] ExportJpegImage(string gradientmap);
74 } 73 }
75} 74} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
index 9d8c259..27b5466 100644
--- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
@@ -40,4 +40,4 @@ namespace OpenSim.Region.Environment.Interfaces
40 void ListenControl(int handle, int active); 40 void ListenControl(int handle, int active);
41 void ListenRemove(int handle); 41 void ListenRemove(int handle);
42 } 42 }
43} 43} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
index d888a36..6786b8c 100644
--- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces
39 RPCRequestInfo GetNextRequest(); 39 RPCRequestInfo GetNextRequest();
40 void RemoteDataReply(string channel, string message_id, string sdata, int idata); 40 void RemoteDataReply(string channel, string message_id, string sdata, int idata);
41 } 41 }
42} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs
index 3cbd549..5e5ff1b 100644
--- a/OpenSim/Region/Environment/Interfaces/IXfer.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs
@@ -32,4 +32,4 @@ namespace OpenSim.Region.Environment.Interfaces
32 { 32 {
33 bool AddNewFile(string fileName, byte[] data); 33 bool AddNewFile(string fileName, byte[] data);
34 } 34 }
35} 35} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 3962e5f..e9837c0 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -30,7 +30,6 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
36 35
@@ -652,4 +651,4 @@ namespace OpenSim.Region.Environment.LandManagement
652 } 651 }
653 652
654 #endregion 653 #endregion
655} 654} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index ae89d85..785aafa 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
35 34
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index c0dd52a..cb72638 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -27,15 +27,14 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
31using System.Collections.Generic; 30using System.Collections.Generic;
32using System.IO; 31using System.IO;
33using System.Reflection; 32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Modules; 36using OpenSim.Region.Environment.Modules;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38using Nini.Config;
39 38
40namespace OpenSim.Region.Environment 39namespace OpenSim.Region.Environment
41{ 40{
@@ -58,8 +57,8 @@ namespace OpenSim.Region.Environment
58 { 57 {
59 get 58 get
60 { 59 {
61 IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ]; 60 IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count];
62 m_loadedSharedModules.Values.CopyTo( regionModules, 0 ); 61 m_loadedSharedModules.Values.CopyTo(regionModules, 0);
63 return regionModules; 62 return regionModules;
64 } 63 }
65 } 64 }
@@ -132,7 +131,7 @@ namespace OpenSim.Region.Environment
132 131
133 if (modules.Length > 0) 132 if (modules.Length > 0)
134 { 133 {
135 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName ); 134 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName);
136 foreach (IRegionModule module in modules) 135 foreach (IRegionModule module in modules)
137 { 136 {
138 if (!module.IsSharedModule) 137 if (!module.IsSharedModule)
@@ -179,16 +178,16 @@ namespace OpenSim.Region.Environment
179 List<IRegionModule> modules = new List<IRegionModule>(); 178 List<IRegionModule> modules = new List<IRegionModule>();
180 179
181 Assembly pluginAssembly; 180 Assembly pluginAssembly;
182 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly )) 181 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly))
183 { 182 {
184 try 183 try
185 { 184 {
186 pluginAssembly = Assembly.LoadFrom(dllName); 185 pluginAssembly = Assembly.LoadFrom(dllName);
187 LoadedAssemblys.Add(dllName, pluginAssembly); 186 LoadedAssemblys.Add(dllName, pluginAssembly);
188 } 187 }
189 catch( BadImageFormatException e ) 188 catch (BadImageFormatException e)
190 { 189 {
191 m_log.Verbose( "MODULES", "The file [{0}] is not a module assembly.", e.FileName ); 190 m_log.Verbose("MODULES", "The file [{0}] is not a module assembly.", e.FileName);
192 } 191 }
193 } 192 }
194 193
@@ -201,7 +200,7 @@ namespace OpenSim.Region.Environment
201 { 200 {
202 if (!pluginType.IsAbstract) 201 if (!pluginType.IsAbstract)
203 { 202 {
204 if( pluginType.GetInterface("IRegionModule") != null ) 203 if (pluginType.GetInterface("IRegionModule") != null)
205 { 204 {
206 modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); 205 modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
207 } 206 }
@@ -231,4 +230,4 @@ namespace OpenSim.Region.Environment
231 LoadedAssemblys.Clear(); 230 LoadedAssemblys.Clear();
232 } 231 }
233 } 232 }
234} 233} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index e414713..54d5ad8 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -26,11 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces; 29using Nini.Config;
30using OpenSim.Framework;
30using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework;
33using Nini.Config;
34 33
35namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
36{ 35{
@@ -70,4 +69,4 @@ namespace OpenSim.Region.Environment.Modules
70 { 69 {
71 } 70 }
72 } 71 }
73} 72} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 456d838..4bb0638 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -1,6 +1,3 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife; 1using libsecondlife;
5using Nini.Config; 2using Nini.Config;
6using OpenSim.Framework; 3using OpenSim.Framework;
@@ -11,7 +8,8 @@ namespace OpenSim.Region.Environment.Modules
11{ 8{
12 public class AvatarFactoryModule : IAvatarFactory 9 public class AvatarFactoryModule : IAvatarFactory
13 { 10 {
14 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams) 11 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
12 out byte[] visualParams)
15 { 13 {
16 GetDefaultAvatarAppearance(out wearables, out visualParams); 14 GetDefaultAvatarAppearance(out wearables, out visualParams);
17 return true; 15 return true;
@@ -51,7 +49,4 @@ namespace OpenSim.Region.Environment.Modules
51 wearables = AvatarWearable.DefaultWearables; 49 wearables = AvatarWearable.DefaultWearables;
52 } 50 }
53 } 51 }
54 52} \ No newline at end of file
55
56
57}
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 802655f..1b7e2a4 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -27,11 +27,10 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using Nini.Config;
31using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
33using OpenSim.Framework;
34using Nini.Config;
35 34
36namespace OpenSim.Region.Environment.Modules 35namespace OpenSim.Region.Environment.Modules
37{ 36{
@@ -92,4 +91,4 @@ namespace OpenSim.Region.Environment.Modules
92 partner); 91 partner);
93 } 92 }
94 } 93 }
95} 94} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index bdb8ee5..9d4187a 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -27,13 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net.Sockets; 32using System.Net.Sockets;
32using System.Threading;
33using System.Collections.Generic;
34using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using System.Threading;
35using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework.Interfaces; 36using Nini.Config;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
@@ -54,18 +54,22 @@ namespace OpenSim.Region.Environment.Modules
54 54
55 public ChatModule() 55 public ChatModule()
56 { 56 {
57 m_log = OpenSim.Framework.Console.MainLog.Instance; 57 m_log = MainLog.Instance;
58 } 58 }
59 59
60 public void Initialise(Scene scene, Nini.Config.IConfigSource config) 60 public void Initialise(Scene scene, IConfigSource config)
61 { 61 {
62 // wrap this in a try block so that defaults will work if 62 // wrap this in a try block so that defaults will work if
63 // the config file doesn't specify otherwise. 63 // the config file doesn't specify otherwise.
64 try { 64 try
65 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); 65 {
66 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
66 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); 67 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
67 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); 68 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
68 } catch (Exception e) {} 69 }
70 catch (Exception e)
71 {
72 }
69 73
70 if (!m_scenes.Contains(scene)) 74 if (!m_scenes.Contains(scene))
71 { 75 {
@@ -73,20 +77,20 @@ namespace OpenSim.Region.Environment.Modules
73 scene.EventManager.OnNewClient += NewClient; 77 scene.EventManager.OnNewClient += NewClient;
74 scene.RegisterModuleInterface<ISimChat>(this); 78 scene.RegisterModuleInterface<ISimChat>(this);
75 } 79 }
76 80
77 // setup IRC Relay 81 // setup IRC Relay
78 m_irc = new IRCChatModule(config); 82 m_irc = new IRCChatModule(config);
79 } 83 }
80 84
81 public void PostInitialise() 85 public void PostInitialise()
82 { 86 {
83 87 if (m_irc.Enabled)
84 if (m_irc.Enabled) { 88 {
85 m_irc.Connect(m_scenes); 89 m_irc.Connect(m_scenes);
86 } 90 }
87 } 91 }
88 92
89 public void Close() 93 public void Close()
90 { 94 {
91 m_irc.Close(); 95 m_irc.Close();
92 } 96 }
@@ -111,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules
111 ScenePresence avatar = null; 115 ScenePresence avatar = null;
112 116
113 //TODO: Move ForEachScenePresence and others into IScene. 117 //TODO: Move ForEachScenePresence and others into IScene.
114 Scene scene = (Scene)e.Scene; 118 Scene scene = (Scene) e.Scene;
115 119
116 //TODO: Remove the need for this check 120 //TODO: Remove the need for this check
117 if (scene == null) 121 if (scene == null)
@@ -119,10 +123,12 @@ namespace OpenSim.Region.Environment.Modules
119 123
120 // Filled in since it's easier than rewriting right now. 124 // Filled in since it's easier than rewriting right now.
121 LLVector3 fromPos = e.Position; 125 LLVector3 fromPos = e.Position;
122 LLVector3 fromRegionPos = e.Position + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); 126 LLVector3 fromRegionPos = e.Position +
127 new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256,
128 0);
123 string fromName = e.From; 129 string fromName = e.From;
124 string message = e.Message; 130 string message = e.Message;
125 byte type = (byte)e.Type; 131 byte type = (byte) e.Type;
126 LLUUID fromAgentID = LLUUID.Zero; 132 LLUUID fromAgentID = LLUUID.Zero;
127 133
128 if (e.Sender != null) 134 if (e.Sender != null)
@@ -133,7 +139,8 @@ namespace OpenSim.Region.Environment.Modules
133 if (avatar != null) 139 if (avatar != null)
134 { 140 {
135 fromPos = avatar.AbsolutePosition; 141 fromPos = avatar.AbsolutePosition;
136 fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); 142 fromRegionPos = fromPos +
143 new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, 0);
137 fromName = avatar.Firstname + " " + avatar.Lastname; 144 fromName = avatar.Firstname + " " + avatar.Lastname;
138 fromAgentID = e.Sender.AgentId; 145 fromAgentID = e.Sender.AgentId;
139 avatar = null; 146 avatar = null;
@@ -159,75 +166,84 @@ namespace OpenSim.Region.Environment.Modules
159 break; 166 break;
160 } 167 }
161 168
162 m_log.Verbose("CHAT", fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + e.Message); 169 m_log.Verbose("CHAT",
163 170 fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
164 if (m_irc.Connected) 171 e.Message);
165 { 172
166 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); 173 if (m_irc.Connected)
167 } 174 {
168 175 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
169 if (e.Channel == 0) 176 }
170 { 177
171 foreach (Scene m_scene in m_scenes) 178 if (e.Channel == 0)
172 { 179 {
173 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 180 foreach (Scene m_scene in m_scenes)
174 { 181 {
175 int dis = -100000; 182 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
176 183 {
177 LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); 184 int dis = -100000;
178 dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); 185
179 186 LLVector3 avatarRegionPos = presence.AbsolutePosition +
180 switch (e.Type) 187 new LLVector3(
181 { 188 scene.RegionInfo.RegionLocX*256,
182 case ChatTypeEnum.Whisper: 189 scene.RegionInfo.RegionLocY*256,
183 if (dis < m_whisperdistance) 190 0);
184 { 191 dis =
185 //should change so the message is sent through the avatar rather than direct to the ClientView 192 Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos));
186 presence.ControllingClient.SendChatMessage(message, 193
187 type, 194 switch (e.Type)
188 fromPos, 195 {
189 fromName, 196 case ChatTypeEnum.Whisper:
190 fromAgentID); 197 if (dis < m_whisperdistance)
191 } 198 {
192 break; 199 //should change so the message is sent through the avatar rather than direct to the ClientView
193 case ChatTypeEnum.Say: 200 presence.ControllingClient.SendChatMessage(message,
194 if (dis < m_saydistance) 201 type,
195 { 202 fromPos,
196 //Console.WriteLine("sending chat"); 203 fromName,
197 presence.ControllingClient.SendChatMessage(message, 204 fromAgentID);
198 type, 205 }
199 fromPos, 206 break;
200 fromName, 207 case ChatTypeEnum.Say:
201 fromAgentID); 208 if (dis < m_saydistance)
202 } 209 {
203 break; 210 //Console.WriteLine("sending chat");
204 case ChatTypeEnum.Shout: 211 presence.ControllingClient.SendChatMessage(message,
205 if (dis < m_shoutdistance) 212 type,
206 { 213 fromPos,
207 presence.ControllingClient.SendChatMessage(message, 214 fromName,
208 type, 215 fromAgentID);
209 fromPos, 216 }
210 fromName, 217 break;
211 fromAgentID); 218 case ChatTypeEnum.Shout:
212 } 219 if (dis < m_shoutdistance)
213 break; 220 {
214 221 presence.ControllingClient.SendChatMessage(message,
215 case ChatTypeEnum.Broadcast: 222 type,
216 presence.ControllingClient.SendChatMessage(message, type, 223 fromPos,
217 fromPos, 224 fromName,
218 fromName, 225 fromAgentID);
219 fromAgentID); 226 }
220 break; 227 break;
221 default: 228
222 break; 229 case ChatTypeEnum.Broadcast:
223 } 230 presence.ControllingClient.SendChatMessage(message,
224 }); 231 type,
232 fromPos,
233 fromName,
234 fromAgentID);
235 break;
236 default:
237 break;
238 }
239 });
225 } 240 }
226 } 241 }
227 } 242 }
228 } 243 }
229 244
230 class IRCChatModule { 245 internal class IRCChatModule
246 {
231 private string m_server = null; 247 private string m_server = null;
232 private int m_port = 6668; 248 private int m_port = 6668;
233 private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 249 private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
@@ -238,7 +254,7 @@ namespace OpenSim.Region.Environment.Modules
238 private TcpClient m_tcp; 254 private TcpClient m_tcp;
239 private StreamWriter m_writer; 255 private StreamWriter m_writer;
240 private StreamReader m_reader; 256 private StreamReader m_reader;
241 257
242 private Thread pingSender; 258 private Thread pingSender;
243 private Thread listener; 259 private Thread listener;
244 260
@@ -248,29 +264,36 @@ namespace OpenSim.Region.Environment.Modules
248 private List<Scene> m_scenes = null; 264 private List<Scene> m_scenes = null;
249 private LogBase m_log; 265 private LogBase m_log;
250 266
251 public IRCChatModule(Nini.Config.IConfigSource config) { 267 public IRCChatModule(IConfigSource config)
268 {
252 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 269 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
253 m_tcp = null; 270 m_tcp = null;
254 m_writer = null; 271 m_writer = null;
255 m_reader = null; 272 m_reader = null;
256 273
257 try { 274 try
275 {
258 m_server = config.Configs["IRC"].GetString("server"); 276 m_server = config.Configs["IRC"].GetString("server");
259 m_nick = config.Configs["IRC"].GetString("nick"); 277 m_nick = config.Configs["IRC"].GetString("nick");
260 m_channel = config.Configs["IRC"].GetString("channel"); 278 m_channel = config.Configs["IRC"].GetString("channel");
261 m_port = config.Configs["IRC"].GetInt("port", m_port); 279 m_port = config.Configs["IRC"].GetInt("port", m_port);
262 m_user = config.Configs["IRC"].GetString("username", m_user); 280 m_user = config.Configs["IRC"].GetString("username", m_user);
263 if (m_server != null && m_nick != null && m_channel != null) { 281 if (m_server != null && m_nick != null && m_channel != null)
282 {
264 m_enabled = true; 283 m_enabled = true;
265 } 284 }
266 } catch (Exception e) { 285 }
286 catch (Exception e)
287 {
267 Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); 288 Console.WriteLine("No IRC config information, skipping IRC bridge configuration");
268 } 289 }
269 m_log = OpenSim.Framework.Console.MainLog.Instance; 290 m_log = MainLog.Instance;
270 } 291 }
271 292
272 public bool Connect(List<Scene> scenes) { 293 public bool Connect(List<Scene> scenes)
273 try { 294 {
295 try
296 {
274 m_scenes = scenes; 297 m_scenes = scenes;
275 298
276 m_tcp = new TcpClient(m_server, m_port); 299 m_tcp = new TcpClient(m_server, m_port);
@@ -279,13 +302,13 @@ namespace OpenSim.Region.Environment.Modules
279 m_log.Verbose("IRC", "Connected to " + m_server); 302 m_log.Verbose("IRC", "Connected to " + m_server);
280 m_reader = new StreamReader(m_stream); 303 m_reader = new StreamReader(m_stream);
281 m_writer = new StreamWriter(m_stream); 304 m_writer = new StreamWriter(m_stream);
282 305
283 pingSender = new Thread(new ThreadStart(this.PingRun)); 306 pingSender = new Thread(new ThreadStart(PingRun));
284 pingSender.Start(); 307 pingSender.Start();
285 308
286 listener = new Thread(new ThreadStart(this.ListenerRun)); 309 listener = new Thread(new ThreadStart(ListenerRun));
287 listener.Start(); 310 listener.Start();
288 311
289 m_writer.WriteLine(m_user); 312 m_writer.WriteLine(m_user);
290 m_writer.Flush(); 313 m_writer.Flush();
291 m_writer.WriteLine("NICK " + m_nick); 314 m_writer.WriteLine("NICK " + m_nick);
@@ -294,50 +317,61 @@ namespace OpenSim.Region.Environment.Modules
294 m_writer.Flush(); 317 m_writer.Flush();
295 m_log.Verbose("IRC", "Connection fully established"); 318 m_log.Verbose("IRC", "Connection fully established");
296 m_connected = true; 319 m_connected = true;
297 } catch (Exception e) { 320 }
321 catch (Exception e)
322 {
298 Console.WriteLine(e.ToString()); 323 Console.WriteLine(e.ToString());
299 } 324 }
300 return m_connected; 325 return m_connected;
301 } 326 }
302 327
303 public bool Enabled 328 public bool Enabled
304 { 329 {
305 get { return m_enabled; } 330 get { return m_enabled; }
306 } 331 }
307 332
308 public bool Connected 333 public bool Connected
309 { 334 {
310 get { return m_connected; } 335 get { return m_connected; }
311 } 336 }
312 337
313 public void PrivMsg(string from, string region, string msg) { 338 public void PrivMsg(string from, string region, string msg)
314 try { 339 {
340 try
341 {
315 m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); 342 m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg);
316 m_writer.Flush(); 343 m_writer.Flush();
317 } catch (IOException) { 344 }
318 m_log.Error("IRC","Disconnected from IRC server."); 345 catch (IOException)
346 {
347 m_log.Error("IRC", "Disconnected from IRC server.");
319 listener.Abort(); 348 listener.Abort();
320 pingSender.Abort(); 349 pingSender.Abort();
321 m_connected = false; 350 m_connected = false;
322 } 351 }
323 } 352 }
324 353
325 private Dictionary<string, string> ExtractMsg(string input) { 354 private Dictionary<string, string> ExtractMsg(string input)
355 {
326 Dictionary<string, string> result = null; 356 Dictionary<string, string> result = null;
327 string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; 357 string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
328 Regex RE = new Regex(regex, RegexOptions.Multiline); 358 Regex RE = new Regex(regex, RegexOptions.Multiline);
329 MatchCollection matches = RE.Matches(input); 359 MatchCollection matches = RE.Matches(input);
330 // Get some direct matches $1 $4 is a 360 // Get some direct matches $1 $4 is a
331 if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) { 361 if ((matches.Count == 1) && (matches[0].Groups.Count == 5))
362 {
332 result = new Dictionary<string, string>(); 363 result = new Dictionary<string, string>();
333 result.Add("nick", matches[0].Groups[1].Value); 364 result.Add("nick", matches[0].Groups[1].Value);
334 result.Add("user", matches[0].Groups[2].Value); 365 result.Add("user", matches[0].Groups[2].Value);
335 result.Add("channel", matches[0].Groups[3].Value); 366 result.Add("channel", matches[0].Groups[3].Value);
336 result.Add("msg", matches[0].Groups[4].Value); 367 result.Add("msg", matches[0].Groups[4].Value);
337 } else { 368 }
369 else
370 {
338 m_log.Verbose("IRC", "Number of matches: " + matches.Count); 371 m_log.Verbose("IRC", "Number of matches: " + matches.Count);
339 if (matches.Count > 0) { 372 if (matches.Count > 0)
340 m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); 373 {
374 m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count);
341 } 375 }
342 } 376 }
343 return result; 377 return result;
@@ -365,19 +399,20 @@ namespace OpenSim.Region.Environment.Modules
365 if (inputLine.Contains(m_channel)) 399 if (inputLine.Contains(m_channel))
366 { 400 {
367 Dictionary<string, string> data = ExtractMsg(inputLine); 401 Dictionary<string, string> data = ExtractMsg(inputLine);
368 if (data != null ) 402 if (data != null)
369 { 403 {
370 foreach (Scene m_scene in m_scenes) 404 foreach (Scene m_scene in m_scenes)
371 { 405 {
372 m_scene.ForEachScenePresence(delegate(ScenePresence avatar) 406 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
373 {
374 if (!avatar.IsChildAgent)
375 { 407 {
376 avatar.ControllingClient.SendChatMessage( 408 if (!avatar.IsChildAgent)
377 Helpers.StringToField(data["msg"]), 255, pos, data["nick"], 409 {
378 LLUUID.Zero); 410 avatar.ControllingClient.SendChatMessage(
379 } 411 Helpers.StringToField(data["msg"]), 255,
380 }); 412 pos, data["nick"],
413 LLUUID.Zero);
414 }
415 });
381 } 416 }
382 } 417 }
383 } 418 }
@@ -387,7 +422,8 @@ namespace OpenSim.Region.Environment.Modules
387 } 422 }
388 423
389 424
390 public void Close() { 425 public void Close()
426 {
391 listener.Abort(); 427 listener.Abort();
392 pingSender.Abort(); 428 pingSender.Abort();
393 m_writer.Close(); 429 m_writer.Close();
@@ -395,4 +431,4 @@ namespace OpenSim.Region.Environment.Modules
395 m_tcp.Close(); 431 m_tcp.Close();
396 } 432 }
397 } 433 }
398} 434} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index 7c852dc..2bc3db8 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -29,10 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using Nini.Config;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using Nini.Config;
36 36
37namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
38{ 38{
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules
99 if (RenderPlugins.ContainsKey(contentType)) 99 if (RenderPlugins.ContainsKey(contentType))
100 { 100 {
101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
102 102
103 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 103 DynamicTextureUpdater updater = new DynamicTextureUpdater();
104 updater.SimUUID = simID; 104 updater.SimUUID = simID;
105 updater.PrimID = primID; 105 updater.PrimID = primID;
@@ -187,4 +187,4 @@ namespace OpenSim.Region.Environment.Modules
187 } 187 }
188 } 188 }
189 } 189 }
190} 190} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
index 00ea07a..046a46c 100644
--- a/OpenSim/Region/Environment/Modules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/EmailModule.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class EmailModule 31 internal class EmailModule
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 9144bee..d9f09f7 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 150f294..50e9a39 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 9ac1d76..2ad027a 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -27,11 +27,12 @@
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife;
31using Nini.Config;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Console;
33using OpenSim.Framework;
34using Nini.Config;
35 36
36namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
37{ 38{
@@ -42,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules
42 43
43 public InstantMessageModule() 44 public InstantMessageModule()
44 { 45 {
45 m_log = OpenSim.Framework.Console.MainLog.Instance; 46 m_log = MainLog.Instance;
46 } 47 }
47 48
48 public void Initialise(Scene scene, IConfigSource config) 49 public void Initialise(Scene scene, IConfigSource config)
@@ -50,33 +51,34 @@ namespace OpenSim.Region.Environment.Modules
50 if (!m_scenes.Contains(scene)) 51 if (!m_scenes.Contains(scene))
51 { 52 {
52 m_scenes.Add(scene); 53 m_scenes.Add(scene);
53 scene.EventManager.OnNewClient += OnNewClient; 54 scene.EventManager.OnNewClient += OnNewClient;
54 } 55 }
55 } 56 }
56 57
57 void OnNewClient(OpenSim.Framework.IClientAPI client) 58 private void OnNewClient(IClientAPI client)
58 { 59 {
59 client.OnInstantMessage += OnInstantMessage; 60 client.OnInstantMessage += OnInstantMessage;
60 } 61 }
61 62
62 void OnInstantMessage(libsecondlife.LLUUID fromAgentID, 63 private void OnInstantMessage(LLUUID fromAgentID,
63 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, 64 LLUUID fromAgentSession, LLUUID toAgentID,
64 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, 65 LLUUID imSessionID, uint timestamp, string fromAgentName,
65 string message, byte dialog) 66 string message, byte dialog)
66 { 67 {
67 // TODO: Remove after debugging. Privacy implications. 68 // TODO: Remove after debugging. Privacy implications.
68 m_log.Verbose("IM",fromAgentName + ": " + message); 69 m_log.Verbose("IM", fromAgentName + ": " + message);
69 70
70 foreach (Scene m_scene in m_scenes) 71 foreach (Scene m_scene in m_scenes)
71 { 72 {
72 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 73 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
73 { 74 {
74 // Local Message 75 // Local Message
75 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; 76 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID];
76 if (!user.IsChildAgent) 77 if (!user.IsChildAgent)
77 { 78 {
78 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 79 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
79 toAgentID, imSessionID, fromAgentName, dialog, timestamp); 80 toAgentID, imSessionID, fromAgentName, dialog,
81 timestamp);
80 } 82 }
81 // Message sent 83 // Message sent
82 return; 84 return;
@@ -104,4 +106,4 @@ namespace OpenSim.Region.Environment.Modules
104 get { return true; } 106 get { return true; }
105 } 107 }
106 } 108 }
107} 109} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index 3f8cd6e..e2ad0d5 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
index 8b8b386..9d10fc3 100644
--- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
@@ -1,18 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.IO;
6using System.Drawing; 2using System.Drawing;
3using System.IO;
4using System.Net;
7using libsecondlife; 5using libsecondlife;
6using Nini.Config;
8using OpenJPEGNet; 7using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
11using Nini.Config; 9using OpenSim.Region.Environment.Scenes;
12 10
13namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
14{ 12{
15 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender 13 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
16 { 14 {
17 private string m_name = "LoadImageURL"; 15 private string m_name = "LoadImageURL";
18 private IDynamicTextureManager m_textureManager; 16 private IDynamicTextureManager m_textureManager;
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules
85 private void MakeHttpRequest(string url, LLUUID requestID) 83 private void MakeHttpRequest(string url, LLUUID requestID)
86 { 84 {
87 WebRequest request = HttpWebRequest.Create(url); 85 WebRequest request = HttpWebRequest.Create(url);
88 RequestState state = new RequestState((HttpWebRequest)request, requestID); 86 RequestState state = new RequestState((HttpWebRequest) request, requestID);
89 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 87 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
90 88
91 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 89 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
92 state.TimeOfRequest = (int)t.TotalSeconds; 90 state.TimeOfRequest = (int) t.TotalSeconds;
93 } 91 }
94 92
95 private void HttpRequestReturn(IAsyncResult result) 93 private void HttpRequestReturn(IAsyncResult result)
96 { 94 {
97 RequestState state = (RequestState)result.AsyncState; 95 RequestState state = (RequestState) result.AsyncState;
98 WebRequest request = (WebRequest)state.Request; 96 WebRequest request = (WebRequest) state.Request;
99 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 97 HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
100 if (response.StatusCode == HttpStatusCode.OK) 98 if (response.StatusCode == HttpStatusCode.OK)
101 { 99 {
102 Bitmap image = new Bitmap(response.GetResponseStream()); 100 Bitmap image = new Bitmap(response.GetResponseStream());
103 Bitmap resize = new Bitmap(image, new Size(512, 512)); 101 Bitmap resize = new Bitmap(image, new Size(512, 512));
104 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 102 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
105 103
106 m_textureManager.ReturnData(state.RequestID, imageJ2000); 104 m_textureManager.ReturnData(state.RequestID, imageJ2000);
107 } 105 }
108 } 106 }
109 107
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules
119 RequestID = requestID; 117 RequestID = requestID;
120 } 118 }
121 } 119 }
122
123 } 120 }
124} 121} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index 9412089..5ac0b39 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class ScriptsHttpRequests 31 internal class ScriptsHttpRequests
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
index d22a722..77f8db2 100644
--- a/OpenSim/Region/Environment/Modules/TeleportModule.cs
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class TeleportModule 31 internal class TeleportModule
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 5eeeca6..66c499b 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -27,14 +27,12 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31using libsecondlife; 30using libsecondlife;
32using libsecondlife.Packets; 31using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces; 32using Nini.Config;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
37using Nini.Config;
38 36
39namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
40{ 38{
@@ -42,17 +40,19 @@ namespace OpenSim.Region.Environment.Modules
42 { 40 {
43 private Scene m_scene; 41 private Scene m_scene;
44 private List<Scene> m_scenes = new List<Scene>(); 42 private List<Scene> m_scenes = new List<Scene>();
45 private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); 43
44 private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests =
45 new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>();
46 46
47 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); 47 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>();
48 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); 48 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>();
49 // private Thread m_thread; 49 // private Thread m_thread;
50 50
51 public TextureDownloadModule() 51 public TextureDownloadModule()
52 { 52 {
53 // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); 53 // m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
54 // m_thread.IsBackground = true; 54 // m_thread.IsBackground = true;
55 // m_thread.Start(); 55 // m_thread.Start();
56 } 56 }
57 57
58 public void Initialise(Scene scene, IConfigSource config) 58 public void Initialise(Scene scene, IConfigSource config)
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
85 85
86 public void NewClient(IClientAPI client) 86 public void NewClient(IClientAPI client)
87 { 87 {
88 /* lock (ClientRequests) 88 /* lock (ClientRequests)
89 { 89 {
90 if (!ClientRequests.ContainsKey(client.AgentId)) 90 if (!ClientRequests.ContainsKey(client.AgentId))
91 { 91 {
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules
120 120
121 public void TextureRequest(Object sender, TextureRequestArgs e) 121 public void TextureRequest(Object sender, TextureRequestArgs e)
122 { 122 {
123 IClientAPI client = (IClientAPI)sender; 123 IClientAPI client = (IClientAPI) sender;
124 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) 124 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID))
125 { 125 {
126 lock (ClientRequests) 126 lock (ClientRequests)
@@ -136,15 +136,15 @@ namespace OpenSim.Region.Environment.Modules
136 { 136 {
137 while (true) 137 while (true)
138 { 138 {
139 TextureSender sender = this.QueueSenders.Dequeue(); 139 TextureSender sender = QueueSenders.Dequeue();
140 bool finished = sender.SendTexture(); 140 bool finished = sender.SendTexture();
141 if (finished) 141 if (finished)
142 { 142 {
143 this.TextureSent(sender); 143 TextureSent(sender);
144 } 144 }
145 else 145 else
146 { 146 {
147 this.QueueSenders.Enqueue(sender); 147 QueueSenders.Enqueue(sender);
148 } 148 }
149 } 149 }
150 } 150 }
@@ -173,13 +173,13 @@ namespace OpenSim.Region.Environment.Modules
173 173
174 if (asset.Data.LongLength > 600) 174 if (asset.Data.LongLength > 600)
175 { 175 {
176 NumPackets = 2 + (int)(asset.Data.Length - 601) / 1000; 176 NumPackets = 2 + (int) (asset.Data.Length - 601)/1000;
177 } 177 }
178 else 178 else
179 { 179 {
180 NumPackets = 1; 180 NumPackets = 1;
181 } 181 }
182 182
183 PacketCounter = (int) req.PacketNumber; 183 PacketCounter = (int) req.PacketNumber;
184 } 184 }
185 185
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules
205 im.Header.Reliable = false; 205 im.Header.Reliable = false;
206 im.ImageID.Packets = 1; 206 im.ImageID.Packets = 1;
207 im.ImageID.ID = m_asset.FullID; 207 im.ImageID.ID = m_asset.FullID;
208 im.ImageID.Size = (uint)m_asset.Data.Length; 208 im.ImageID.Size = (uint) m_asset.Data.Length;
209 im.ImageData.Data = m_asset.Data; 209 im.ImageData.Data = m_asset.Data;
210 im.ImageID.Codec = 2; 210 im.ImageID.Codec = 2;
211 req.RequestUser.OutPacket(im); 211 req.RequestUser.OutPacket(im);
@@ -215,9 +215,9 @@ namespace OpenSim.Region.Environment.Modules
215 { 215 {
216 ImageDataPacket im = new ImageDataPacket(); 216 ImageDataPacket im = new ImageDataPacket();
217 im.Header.Reliable = false; 217 im.Header.Reliable = false;
218 im.ImageID.Packets = (ushort)(NumPackets); 218 im.ImageID.Packets = (ushort) (NumPackets);
219 im.ImageID.ID = m_asset.FullID; 219 im.ImageID.ID = m_asset.FullID;
220 im.ImageID.Size = (uint)m_asset.Data.Length; 220 im.ImageID.Size = (uint) m_asset.Data.Length;
221 im.ImageData.Data = new byte[600]; 221 im.ImageData.Data = new byte[600];
222 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); 222 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
223 im.ImageID.Codec = 2; 223 im.ImageID.Codec = 2;
@@ -229,18 +229,16 @@ namespace OpenSim.Region.Environment.Modules
229 { 229 {
230 ImagePacketPacket im = new ImagePacketPacket(); 230 ImagePacketPacket im = new ImagePacketPacket();
231 im.Header.Reliable = false; 231 im.Header.Reliable = false;
232 im.ImageID.Packet = (ushort)(PacketCounter); 232 im.ImageID.Packet = (ushort) (PacketCounter);
233 im.ImageID.ID = m_asset.FullID; 233 im.ImageID.ID = m_asset.FullID;
234 int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); 234 int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1));
235 if (size > 1000) size = 1000; 235 if (size > 1000) size = 1000;
236 im.ImageData.Data = new byte[size]; 236 im.ImageData.Data = new byte[size];
237 Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); 237 Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size);
238 req.RequestUser.OutPacket(im); 238 req.RequestUser.OutPacket(im);
239 PacketCounter++; 239 PacketCounter++;
240 } 240 }
241
242 } 241 }
243
244 } 242 }
245 243
246 public class AssetRequest 244 public class AssetRequest
@@ -258,6 +256,5 @@ namespace OpenSim.Region.Environment.Modules
258 PacketNumber = packetNumber; 256 PacketNumber = packetNumber;
259 } 257 }
260 } 258 }
261
262 } 259 }
263} 260} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index a697162..7a631d7 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -27,20 +27,12 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.Collections.Generic;
31using System.Net.Sockets;
32using System.Text;
33using System.Threading;
34using libsecondlife; 31using libsecondlife;
35using OpenSim.Framework.Interfaces; 32using Nini.Config;
36using OpenSim.Framework; 33using OpenSim.Framework;
37using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
39using OpenSim.Framework.Servers;
40using Nwc.XmlRpc;
41using System.Collections;
42using System.Collections.Generic;
43using Nini.Config;
44 36
45/***************************************************** 37/*****************************************************
46 * 38 *
@@ -71,6 +63,7 @@ using Nini.Config;
71 * thats the way it works. 63 * thats the way it works.
72 * 64 *
73 * **************************************************/ 65 * **************************************************/
66
74namespace OpenSim.Region.Environment.Modules 67namespace OpenSim.Region.Environment.Modules
75{ 68{
76 public class WorldCommModule : IRegionModule, IWorldComm 69 public class WorldCommModule : IRegionModule, IWorldComm
@@ -120,9 +113,9 @@ namespace OpenSim.Region.Environment.Modules
120 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) 113 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
121 { 114 {
122 DeliverMessage(e.Sender.AgentId.ToString(), 115 DeliverMessage(e.Sender.AgentId.ToString(),
123 (int)e.Type, e.Channel, 116 (int) e.Type, e.Channel,
124 e.Sender.FirstName + " " + e.Sender.LastName, 117 e.Sender.FirstName + " " + e.Sender.LastName,
125 e.Message); 118 e.Message);
126 } 119 }
127 120
128 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 121 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@@ -132,11 +125,10 @@ namespace OpenSim.Region.Environment.Modules
132 125
133 public void ListenControl(int handle, int active) 126 public void ListenControl(int handle, int active)
134 { 127 {
135 if ( active == 1 ) 128 if (active == 1)
136 m_listenerManager.Activate(handle); 129 m_listenerManager.Activate(handle);
137 else if ( active == 0 ) 130 else if (active == 0)
138 m_listenerManager.Dectivate(handle); 131 m_listenerManager.Dectivate(handle);
139
140 } 132 }
141 133
142 public void ListenRemove(int handle) 134 public void ListenRemove(int handle)
@@ -151,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules
151 // nearby avatards, the SimChat function is used. 143 // nearby avatards, the SimChat function is used.
152 public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) 144 public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg)
153 { 145 {
154
155 SceneObjectPart source = null; 146 SceneObjectPart source = null;
156 ScenePresence avatar = null; 147 ScenePresence avatar = null;
157 148
@@ -160,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules
160 { 151 {
161 avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); 152 avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID));
162 } 153 }
163 if( (avatar != null) || (source != null) ) 154 if ((avatar != null) || (source != null))
164 { 155 {
165 // Loop through the objects in the scene 156 // Loop through the objects in the scene
166 // If they are in proximity, then if they are 157 // If they are in proximity, then if they are
@@ -169,12 +160,12 @@ namespace OpenSim.Region.Environment.Modules
169 foreach (LLUUID eb in m_scene.Entities.Keys) 160 foreach (LLUUID eb in m_scene.Entities.Keys)
170 { 161 {
171 EntityBase sPart; 162 EntityBase sPart;
172 163
173 m_scene.Entities.TryGetValue(eb, out sPart); 164 m_scene.Entities.TryGetValue(eb, out sPart);
174 165
175 // Dont process if this message is from itself! 166 // Dont process if this message is from itself!
176 if (eb.ToString().Equals(sourceItemID) || 167 if (eb.ToString().Equals(sourceItemID) ||
177 sPart.UUID.ToString().Equals(sourceItemID) ) 168 sPart.UUID.ToString().Equals(sourceItemID))
178 continue; 169 continue;
179 170
180 double dis = 0; 171 double dis = 0;
@@ -192,12 +183,11 @@ namespace OpenSim.Region.Environment.Modules
192 { 183 {
193 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 184 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
194 sourceItemID, sPart.UUID, channel, name, msg 185 sourceItemID, sPart.UUID, channel, name, msg
195 ); 186 );
196 if (isListener != null) 187 if (isListener != null)
197 { 188 {
198 m_pending.Enqueue(isListener); 189 m_pending.Enqueue(isListener);
199 } 190 }
200
201 } 191 }
202 break; 192 break;
203 193
@@ -207,12 +197,11 @@ namespace OpenSim.Region.Environment.Modules
207 { 197 {
208 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 198 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
209 sourceItemID, sPart.UUID, channel, name, msg 199 sourceItemID, sPart.UUID, channel, name, msg
210 ); 200 );
211 if (isListener != null) 201 if (isListener != null)
212 { 202 {
213 m_pending.Enqueue(isListener); 203 m_pending.Enqueue(isListener);
214 } 204 }
215
216 } 205 }
217 break; 206 break;
218 207
@@ -221,22 +210,22 @@ namespace OpenSim.Region.Environment.Modules
221 { 210 {
222 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 211 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
223 sourceItemID, sPart.UUID, channel, name, msg 212 sourceItemID, sPart.UUID, channel, name, msg
224 ); 213 );
225 if (isListener != null) 214 if (isListener != null)
226 { 215 {
227 m_pending.Enqueue(isListener); 216 m_pending.Enqueue(isListener);
228 } 217 }
229
230 } 218 }
231 break; 219 break;
232 220
233 case 0xff: // Broadcast 221 case 0xff: // Broadcast
234 ListenerInfo isListen = m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); 222 ListenerInfo isListen =
223 m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg);
235 if (isListen != null) 224 if (isListen != null)
236 { 225 {
237 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 226 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
238 sourceItemID, sPart.UUID, channel, name, msg 227 sourceItemID, sPart.UUID, channel, name, msg
239 ); 228 );
240 if (isListener != null) 229 if (isListener != null)
241 { 230 {
242 m_pending.Enqueue(isListener); 231 m_pending.Enqueue(isListener);
@@ -244,10 +233,9 @@ namespace OpenSim.Region.Environment.Modules
244 } 233 }
245 break; 234 break;
246 } 235 }
247 }; 236 }
248 237 ;
249 } 238 }
250
251 } 239 }
252 240
253 public bool HasMessages() 241 public bool HasMessages()
@@ -257,18 +245,15 @@ namespace OpenSim.Region.Environment.Modules
257 245
258 public ListenerInfo GetNextMessage() 246 public ListenerInfo GetNextMessage()
259 { 247 {
260
261 ListenerInfo li = null; 248 ListenerInfo li = null;
262 249
263 lock (CommListLock) 250 lock (CommListLock)
264 { 251 {
265 li = m_pending.Dequeue(); 252 li = m_pending.Dequeue();
266 } 253 }
267 254
268 return li; 255 return li;
269
270 } 256 }
271
272 } 257 }
273 258
274 // hostID: the ID of the ScenePart 259 // hostID: the ID of the ScenePart
@@ -285,20 +270,19 @@ namespace OpenSim.Region.Environment.Modules
285 m_listeners = new Dictionary<int, ListenerInfo>(); 270 m_listeners = new Dictionary<int, ListenerInfo>();
286 } 271 }
287 272
288 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 273 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id,
274 string msg)
289 { 275 {
290 276 if (m_listeners.Count < m_MaxListeners)
291 if ( m_listeners.Count < m_MaxListeners )
292 { 277 {
293 ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); 278 ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg);
294 279
295 if(isListener == null) 280 if (isListener == null)
296 { 281 {
297 int newHandle = GetNewHandle(); 282 int newHandle = GetNewHandle();
298 283
299 if (newHandle > -1) 284 if (newHandle > -1)
300 { 285 {
301
302 ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); 286 ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg);
303 287
304 lock (ListenersLock) 288 lock (ListenersLock)
@@ -308,13 +292,10 @@ namespace OpenSim.Region.Environment.Modules
308 292
309 return newHandle; 293 return newHandle;
310 } 294 }
311
312 } 295 }
313
314 } 296 }
315 297
316 return -1; 298 return -1;
317
318 } 299 }
319 300
320 public void Remove(int handle) 301 public void Remove(int handle)
@@ -324,7 +305,6 @@ namespace OpenSim.Region.Environment.Modules
324 305
325 private int GetNewHandle() 306 private int GetNewHandle()
326 { 307 {
327
328 for (int i = 0; i < int.MaxValue - 1; i++) 308 for (int i = 0; i < int.MaxValue - 1; i++)
329 { 309 {
330 if (!m_listeners.ContainsKey(i)) 310 if (!m_listeners.ContainsKey(i))
@@ -332,12 +312,10 @@ namespace OpenSim.Region.Environment.Modules
332 } 312 }
333 313
334 return -1; 314 return -1;
335
336 } 315 }
337 316
338 public bool IsListener(LLUUID hostID) 317 public bool IsListener(LLUUID hostID)
339 { 318 {
340
341 foreach (ListenerInfo li in m_listeners.Values) 319 foreach (ListenerInfo li in m_listeners.Values)
342 { 320 {
343 if (li.GetHostID().Equals(hostID)) 321 if (li.GetHostID().Equals(hostID))
@@ -345,15 +323,13 @@ namespace OpenSim.Region.Environment.Modules
345 } 323 }
346 324
347 return false; 325 return false;
348
349 } 326 }
350 327
351 public void Activate(int handle) 328 public void Activate(int handle)
352 { 329 {
353
354 ListenerInfo li; 330 ListenerInfo li;
355 331
356 if( m_listeners.TryGetValue(handle, out li) ) 332 if (m_listeners.TryGetValue(handle, out li))
357 { 333 {
358 li.Activate(); 334 li.Activate();
359 } 335 }
@@ -361,10 +337,9 @@ namespace OpenSim.Region.Environment.Modules
361 337
362 public void Dectivate(int handle) 338 public void Dectivate(int handle)
363 { 339 {
364
365 ListenerInfo li; 340 ListenerInfo li;
366 341
367 if( m_listeners.TryGetValue(handle, out li) ) 342 if (m_listeners.TryGetValue(handle, out li))
368 { 343 {
369 li.Deactivate(); 344 li.Deactivate();
370 } 345 }
@@ -372,40 +347,40 @@ namespace OpenSim.Region.Environment.Modules
372 347
373 // Theres probably a more clever and efficient way to 348 // Theres probably a more clever and efficient way to
374 // do this, maybe with regex. 349 // do this, maybe with regex.
375 public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, string msg) 350 public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name,
351 string msg)
376 { 352 {
377
378 bool isMatch = true; 353 bool isMatch = true;
379 354
380 foreach (ListenerInfo li in m_listeners.Values) 355 foreach (ListenerInfo li in m_listeners.Values)
381 { 356 {
382 if (li.GetHostID().Equals(listenerKey)) 357 if (li.GetHostID().Equals(listenerKey))
383 { 358 {
384 if ( li.IsActive() ) 359 if (li.IsActive())
385 { 360 {
386 if ( channel == li.GetChannel() ) 361 if (channel == li.GetChannel())
387 { 362 {
388 if ( (li.GetID().ToString().Length > 0) && 363 if ((li.GetID().ToString().Length > 0) &&
389 (!li.GetID().Equals(LLUUID.Zero)) ) 364 (!li.GetID().Equals(LLUUID.Zero)))
390 { 365 {
391 if (!li.GetID().ToString().Equals(sourceItemID)) 366 if (!li.GetID().ToString().Equals(sourceItemID))
392 { 367 {
393 isMatch = false; 368 isMatch = false;
394 } 369 }
395 } 370 }
396 if ( isMatch && (li.GetName().Length > 0) ) 371 if (isMatch && (li.GetName().Length > 0))
397 { 372 {
398 if ( li.GetName().Equals(name) ) 373 if (li.GetName().Equals(name))
399 { 374 {
400 isMatch = false; 375 isMatch = false;
401 } 376 }
402 } 377 }
403 if ( isMatch ) 378 if (isMatch)
404 { 379 {
405 return new ListenerInfo( 380 return new ListenerInfo(
406 li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), 381 li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(),
407 li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) 382 li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID)
408 ); 383 );
409 } 384 }
410 } 385 }
411 } 386 }
@@ -413,35 +388,36 @@ namespace OpenSim.Region.Environment.Modules
413 } 388 }
414 return null; 389 return null;
415 } 390 }
416
417 } 391 }
418 392
419 public class ListenerInfo 393 public class ListenerInfo
420 { 394 {
421 395 private LLUUID m_itemID; // ID of the host script engine
422 private LLUUID m_itemID; // ID of the host script engine 396 private LLUUID m_hostID; // ID of the host/scene part
423 private LLUUID m_hostID; // ID of the host/scene part 397 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
424 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message 398 private int m_channel; // Channel
425 private int m_channel; // Channel 399 private int m_handle; // Assigned handle of this listener
426 private int m_handle; // Assigned handle of this listener 400 private uint m_localID; // Local ID from script engine
427 private uint m_localID; // Local ID from script engine 401 private string m_name; // Object name to filter messages from
428 private string m_name; // Object name to filter messages from 402 private LLUUID m_id; // ID to filter messages from
429 private LLUUID m_id; // ID to filter messages from 403 private string m_message; // The message
430 private string m_message; // The message 404 private bool m_active; // Listener is active or not
431 private bool m_active; // Listener is active or not 405
432 406 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id,
433 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) 407 string message)
434 { 408 {
435 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 409 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
436 } 410 }
437 411
438 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message, LLUUID sourceItemID) 412 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id,
413 string message, LLUUID sourceItemID)
439 { 414 {
440 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 415 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
441 m_sourceItemID = sourceItemID; 416 m_sourceItemID = sourceItemID;
442 } 417 }
443 418
444 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) 419 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name,
420 LLUUID id, string message)
445 { 421 {
446 m_handle = handle; 422 m_handle = handle;
447 m_channel = channel; 423 m_channel = channel;
@@ -453,55 +429,65 @@ namespace OpenSim.Region.Environment.Modules
453 m_active = true; 429 m_active = true;
454 m_localID = localID; 430 m_localID = localID;
455 } 431 }
432
456 public LLUUID GetItemID() 433 public LLUUID GetItemID()
457 { 434 {
458 return m_itemID; 435 return m_itemID;
459 } 436 }
437
460 public LLUUID GetHostID() 438 public LLUUID GetHostID()
461 { 439 {
462 return m_hostID; 440 return m_hostID;
463 } 441 }
442
464 public LLUUID GetSourceItemID() 443 public LLUUID GetSourceItemID()
465 { 444 {
466 return m_sourceItemID; 445 return m_sourceItemID;
467 } 446 }
447
468 public int GetChannel() 448 public int GetChannel()
469 { 449 {
470 return m_channel; 450 return m_channel;
471 } 451 }
452
472 public uint GetLocalID() 453 public uint GetLocalID()
473 { 454 {
474 return m_localID; 455 return m_localID;
475 } 456 }
457
476 public int GetHandle() 458 public int GetHandle()
477 { 459 {
478 return m_handle; 460 return m_handle;
479 } 461 }
462
480 public string GetMessage() 463 public string GetMessage()
481 { 464 {
482 return m_message; 465 return m_message;
483 } 466 }
467
484 public string GetName() 468 public string GetName()
485 { 469 {
486 return m_name; 470 return m_name;
487 } 471 }
472
488 public bool IsActive() 473 public bool IsActive()
489 { 474 {
490 return m_active; 475 return m_active;
491 } 476 }
477
492 public void Deactivate() 478 public void Deactivate()
493 { 479 {
494 m_active = false; 480 m_active = false;
495 } 481 }
482
496 public void Activate() 483 public void Activate()
497 { 484 {
498 m_active = true; 485 m_active = true;
499 } 486 }
487
500 public LLUUID GetID() 488 public LLUUID GetID()
501 { 489 {
502 return m_id; 490 return m_id;
503 } 491 }
504
505 } 492 }
506 493} \ No newline at end of file
507}
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index dd84778..434c92f 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -26,20 +26,15 @@
26* 26*
27*/ 27*/
28 28
29using System; 29using System.Collections;
30using System.IO; 30using System.Collections.Generic;
31using System.Net.Sockets;
32using System.Threading; 31using System.Threading;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework.Interfaces; 33using Nini.Config;
35using OpenSim.Framework; 34using Nwc.XmlRpc;
35using OpenSim.Framework.Servers;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38using OpenSim.Framework.Servers;
39using Nwc.XmlRpc;
40using System.Collections;
41using System.Collections.Generic;
42using Nini.Config;
43 38
44/***************************************************** 39/*****************************************************
45 * 40 *
@@ -73,6 +68,7 @@ using Nini.Config;
73 * llCloseRemoteDataChannel 68 * llCloseRemoteDataChannel
74 * 69 *
75 * **************************************************/ 70 * **************************************************/
71
76namespace OpenSim.Region.Environment.Modules 72namespace OpenSim.Region.Environment.Modules
77{ 73{
78 public class XMLRPCModule : IRegionModule, IXMLRPC 74 public class XMLRPCModule : IRegionModule, IXMLRPC
@@ -83,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules
83 private string m_name = "XMLRPCModule"; 79 private string m_name = "XMLRPCModule";
84 private int RemoteReplyScriptWait = 100; 80 private int RemoteReplyScriptWait = 100;
85 private int RemoteReplyScriptTimeout = 300; 81 private int RemoteReplyScriptTimeout = 300;
86 82
87 // <channel id, RPCChannelInfo> 83 // <channel id, RPCChannelInfo>
88 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; 84 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
89 85
@@ -106,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules
106 // Start http server 102 // Start http server
107 // Attach xmlrpc handlers 103 // Attach xmlrpc handlers
108 BaseHttpServer httpServer = new BaseHttpServer(20800); 104 BaseHttpServer httpServer = new BaseHttpServer(20800);
109 httpServer.AddXmlRPCHandler("llRemoteData", this.XmlRpcRemoteData); 105 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
110 httpServer.Start(); 106 httpServer.Start();
111 } 107 }
112 108
@@ -141,6 +137,7 @@ namespace OpenSim.Region.Environment.Modules
141 * current channel and assign a new one. 137 * current channel and assign a new one.
142 * 138 *
143 * ********************************************/ 139 * ********************************************/
140
144 public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) 141 public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID)
145 { 142 {
146 LLUUID channel = null; 143 LLUUID channel = null;
@@ -156,7 +153,7 @@ namespace OpenSim.Region.Environment.Modules
156 } 153 }
157 } 154 }
158 155
159 if ( (channel == null) || (channel.Equals(LLUUID.Zero)) ) 156 if ((channel == null) || (channel.Equals(LLUUID.Zero)))
160 { 157 {
161 channel = LLUUID.Random(); 158 channel = LLUUID.Random();
162 RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); 159 RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel);
@@ -164,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules
164 { 161 {
165 m_openChannels.Add(channel, rpcChanInfo); 162 m_openChannels.Add(channel, rpcChanInfo);
166 } 163 }
167
168 } 164 }
169 165
170 return channel; 166 return channel;
@@ -176,6 +172,7 @@ namespace OpenSim.Region.Environment.Modules
176 * Response to RPC message 172 * Response to RPC message
177 * 173 *
178 *********************************************/ 174 *********************************************/
175
179 public void RemoteDataReply(string channel, string message_id, string sdata, int idata) 176 public void RemoteDataReply(string channel, string message_id, string sdata, int idata)
180 { 177 {
181 RPCRequestInfo rpcInfo; 178 RPCRequestInfo rpcInfo;
@@ -191,7 +188,6 @@ namespace OpenSim.Region.Environment.Modules
191 m_pendingResponse.Remove(message_key); 188 m_pendingResponse.Remove(message_key);
192 } 189 }
193 } 190 }
194
195 } 191 }
196 192
197 /********************************************** 193 /**********************************************
@@ -200,41 +196,44 @@ namespace OpenSim.Region.Environment.Modules
200 * Remove channel from dictionary 196 * Remove channel from dictionary
201 * 197 *
202 *********************************************/ 198 *********************************************/
199
203 public void CloseXMLRPCChannel(LLUUID channelKey) 200 public void CloseXMLRPCChannel(LLUUID channelKey)
204 { 201 {
205 if(m_openChannels.ContainsKey(channelKey)) 202 if (m_openChannels.ContainsKey(channelKey))
206 m_openChannels.Remove(channelKey); 203 m_openChannels.Remove(channelKey);
207 } 204 }
208 205
209 206
210 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) 207 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request)
211 { 208 {
212
213 XmlRpcResponse response = new XmlRpcResponse(); 209 XmlRpcResponse response = new XmlRpcResponse();
214 210
215 Hashtable requestData = (Hashtable)request.Params[0]; 211 Hashtable requestData = (Hashtable) request.Params[0];
216 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && requestData.Contains("StringValue")); 212 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") &&
213 requestData.Contains("StringValue"));
217 214
218 if (GoodXML) 215 if (GoodXML)
219 { 216 {
220 LLUUID channel = new LLUUID((string)requestData["Channel"]); 217 LLUUID channel = new LLUUID((string) requestData["Channel"]);
221 RPCChannelInfo rpcChanInfo; 218 RPCChannelInfo rpcChanInfo;
222 if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) 219 if (m_openChannels.TryGetValue(channel, out rpcChanInfo))
223 { 220 {
224 string intVal = (string)requestData["IntValue"]; 221 string intVal = (string) requestData["IntValue"];
225 string strVal = (string)requestData["StringValue"]; 222 string strVal = (string) requestData["StringValue"];
226 223
227 RPCRequestInfo rpcInfo; 224 RPCRequestInfo rpcInfo;
228 225
229 lock (XMLRPCListLock) 226 lock (XMLRPCListLock)
230 { 227 {
231 rpcInfo = new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, intVal); 228 rpcInfo =
229 new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal,
230 intVal);
232 rpcQueue.Enqueue(rpcInfo); 231 rpcQueue.Enqueue(rpcInfo);
233 } 232 }
234 233
235 int timeoutCtr = 0; 234 int timeoutCtr = 0;
236 235
237 while(!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) 236 while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout))
238 { 237 {
239 Thread.Sleep(RemoteReplyScriptWait); 238 Thread.Sleep(RemoteReplyScriptWait);
240 timeoutCtr += RemoteReplyScriptWait; 239 timeoutCtr += RemoteReplyScriptWait;
@@ -252,13 +251,11 @@ namespace OpenSim.Region.Environment.Modules
252 m_pendingResponse.Remove(rpcInfo.GetMessageID()); 251 m_pendingResponse.Remove(rpcInfo.GetMessageID());
253 } 252 }
254 } 253 }
255
256 } 254 }
257 else 255 else
258 { 256 {
259 response.SetFault(-1, "Invalid channel"); 257 response.SetFault(-1, "Invalid channel");
260 } 258 }
261
262 } 259 }
263 260
264 return response; 261 return response;
@@ -278,7 +275,6 @@ namespace OpenSim.Region.Environment.Modules
278 return rpcInfo; 275 return rpcInfo;
279 } 276 }
280 } 277 }
281
282 } 278 }
283 279
284 /************************************************************** 280 /**************************************************************
@@ -288,6 +284,7 @@ namespace OpenSim.Region.Environment.Modules
288 * Holds details about incoming requests until they are picked 284 * Holds details about incoming requests until they are picked
289 * from the queue by LSLLongCmdHandler 285 * from the queue by LSLLongCmdHandler
290 * ***********************************************************/ 286 * ***********************************************************/
287
291 public class RPCRequestInfo 288 public class RPCRequestInfo
292 { 289 {
293 private string m_StrVal; 290 private string m_StrVal;
@@ -315,6 +312,7 @@ namespace OpenSim.Region.Environment.Modules
315 { 312 {
316 return m_processed; 313 return m_processed;
317 } 314 }
315
318 public LLUUID GetChannelKey() 316 public LLUUID GetChannelKey()
319 { 317 {
320 return m_ChannelKey; 318 return m_ChannelKey;
@@ -324,36 +322,41 @@ namespace OpenSim.Region.Environment.Modules
324 { 322 {
325 m_processed = processed; 323 m_processed = processed;
326 } 324 }
325
327 public void SetRetval(string resp) 326 public void SetRetval(string resp)
328 { 327 {
329 m_resp = resp; 328 m_resp = resp;
330 } 329 }
330
331 public string GetRetval() 331 public string GetRetval()
332 { 332 {
333 return m_resp; 333 return m_resp;
334 } 334 }
335
335 public uint GetLocalID() 336 public uint GetLocalID()
336 { 337 {
337 return m_localID; 338 return m_localID;
338 } 339 }
340
339 public LLUUID GetItemID() 341 public LLUUID GetItemID()
340 { 342 {
341 return m_ItemID; 343 return m_ItemID;
342 } 344 }
345
343 public string GetStrVal() 346 public string GetStrVal()
344 { 347 {
345 return m_StrVal; 348 return m_StrVal;
346 } 349 }
350
347 public int GetIntValue() 351 public int GetIntValue()
348 { 352 {
349 return int.Parse(m_IntVal); 353 return int.Parse(m_IntVal);
350 } 354 }
355
351 public LLUUID GetMessageID() 356 public LLUUID GetMessageID()
352 { 357 {
353 return m_MessageID; 358 return m_MessageID;
354 } 359 }
355
356
357 } 360 }
358 361
359 public class RPCChannelInfo 362 public class RPCChannelInfo
@@ -383,7 +386,5 @@ namespace OpenSim.Region.Environment.Modules
383 { 386 {
384 return m_localID; 387 return m_localID;
385 } 388 }
386
387 } 389 }
388 390} \ No newline at end of file
389}
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index e555475..807b46c 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -29,11 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using Nini.Config;
33using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using OpenSim.Framework;
36using Nini.Config;
37 36
38namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
39{ 38{
@@ -200,4 +199,4 @@ namespace OpenSim.Region.Environment.Modules
200 } 199 }
201 } 200 }
202 } 201 }
203} 202} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 63285dc..fd55833 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -29,7 +29,6 @@
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Region.Environment.LandManagement; 30using OpenSim.Region.Environment.LandManagement;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework;
33 32
34namespace OpenSim.Region.Environment 33namespace OpenSim.Region.Environment
35{ 34{
@@ -337,4 +336,4 @@ namespace OpenSim.Region.Environment
337 336
338 #endregion 337 #endregion
339 } 338 }
340} 339} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 767a740..b8bae57 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -146,4 +146,4 @@ namespace OpenSim.Region.Environment.Scenes
146 146
147 public abstract void SetText(string text, Vector3 color, double alpha); 147 public abstract void SetText(string text, Vector3 color, double alpha);
148 } 148 }
149} 149} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 14a1c7e..0f3bca1 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -29,7 +29,6 @@
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Interfaces;
33 32
34namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
35{ 34{
@@ -40,4 +39,4 @@ namespace OpenSim.Region.Environment.Scenes
40 void SendOurAppearance(IClientAPI OurClient); 39 void SendOurAppearance(IClientAPI OurClient);
41 void SendAppearanceToOtherAgent(ScenePresence avatarInfo); 40 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
42 } 41 }
43} 42} \ 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 68591d4..a0c9a50 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -29,9 +29,8 @@
29using Axiom.Math; 29using Axiom.Math;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache;
35using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
36 35
37namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
@@ -45,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes
45 { 44 {
46 ScenePresence avatar; 45 ScenePresence avatar;
47 46
48 if ( TryGetAvatar( avatarId, out avatar )) 47 if (TryGetAvatar(avatarId, out avatar))
49 { 48 {
50 AddInventoryItem(avatar.ControllingClient, item); 49 AddInventoryItem(avatar.ControllingClient, item);
51 } 50 }
@@ -392,7 +391,7 @@ namespace OpenSim.Region.Environment.Scenes
392 remoteClient.SendInventoryItemUpdate(item); 391 remoteClient.SendInventoryItemUpdate(item);
393 } 392 }
394 393
395 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt); 394 DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt);
396 } 395 }
397 } 396 }
398 } 397 }
@@ -471,4 +470,4 @@ namespace OpenSim.Region.Environment.Scenes
471 } 470 }
472 } 471 }
473 } 472 }
474} 473} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 3a35e21..69bd310 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -28,9 +28,8 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Console;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Console;
34 33
35namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
36{ 35{
@@ -73,12 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
73 { 72 {
74 ChatFromViewerArgs args = new ChatFromViewerArgs(); 73 ChatFromViewerArgs args = new ChatFromViewerArgs();
75 74
76 args.Message = OpenSim.Framework.Util.FieldToString(message); 75 args.Message = Util.FieldToString(message);
77 args.Channel = channel; 76 args.Channel = channel;
78 args.Type = (ChatTypeEnum)type; 77 args.Type = (ChatTypeEnum) type;
79 args.Position = fromPos; 78 args.Position = fromPos;
80 79
81 ScenePresence user = this.GetScenePresence(fromAgentID); 80 ScenePresence user = GetScenePresence(fromAgentID);
82 if (user != null) 81 if (user != null)
83 args.Sender = user.ControllingClient; 82 args.Sender = user.ControllingClient;
84 else 83 else
@@ -488,10 +487,7 @@ namespace OpenSim.Region.Environment.Scenes
488 487
489 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) 488 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId)
490 { 489 {
491 Broadcast(delegate(IClientAPI client) 490 Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); });
492 {
493 client.SendAnimation(animID, seq, agentId);
494 });
495 } 491 }
496 492
497 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 493 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
@@ -503,14 +499,14 @@ namespace OpenSim.Region.Environment.Scenes
503 if (ent is SceneObjectGroup) 499 if (ent is SceneObjectGroup)
504 { 500 {
505 SceneObjectGroup obj = ent as SceneObjectGroup; 501 SceneObjectGroup obj = ent as SceneObjectGroup;
506 502
507 if( obj.HasChildPrim( localID ) ) 503 if (obj.HasChildPrim(localID))
508 { 504 {
509 obj.ObjectGrabHandler(localID, offsetPos, remoteClient); 505 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
510 return; 506 return;
511 } 507 }
512 } 508 }
513 } 509 }
514 } 510 }
515 } 511 }
516} 512} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b54c25b..db4d230 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Net;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.IO; 30using System.IO;
31using System.Net;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using System.Xml; 34using System.Xml;
@@ -38,17 +38,16 @@ using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Interfaces;
42using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
43using OpenSim.Region.Capabilities; 42using OpenSim.Region.Capabilities;
44using OpenSim.Region.Environment.Interfaces; 43using OpenSim.Region.Environment.Interfaces;
45using OpenSim.Region.Environment.LandManagement; 44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment.Modules;
46using OpenSim.Region.Environment.Scenes.Scripting; 46using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Environment.Types; 47using OpenSim.Region.Environment.Types;
48using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.Physics.Manager;
49using OpenSim.Region.Terrain; 49using OpenSim.Region.Terrain;
50using Timer = System.Timers.Timer; 50using Timer=System.Timers.Timer;
51using OpenSim.Region.Environment.Modules;
52 51
53namespace OpenSim.Region.Environment.Scenes 52namespace OpenSim.Region.Environment.Scenes
54{ 53{
@@ -130,6 +129,7 @@ namespace OpenSim.Region.Environment.Scenes
130 private readonly EstateManager m_estateManager; 129 private readonly EstateManager m_estateManager;
131 130
132 private PhysicsScene phyScene; 131 private PhysicsScene phyScene;
132
133 public PhysicsScene PhysScene 133 public PhysicsScene PhysScene
134 { 134 {
135 set { phyScene = value; } 135 set { phyScene = value; }
@@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
199 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 199 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
200 200
201 MainLog.Instance.Verbose("Creating LandMap"); 201 MainLog.Instance.Verbose("Creating LandMap");
202 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); 202 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
203 203
204 ScenePresence.LoadAnims(); 204 ScenePresence.LoadAnims();
205 205
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes
233 public void StartTimer() 233 public void StartTimer()
234 { 234 {
235 m_heartbeatTimer.Enabled = true; 235 m_heartbeatTimer.Enabled = true;
236 m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 236 m_heartbeatTimer.Interval = (int) (m_timespan*1000);
237 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 237 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
238 } 238 }
239 239
@@ -267,33 +267,33 @@ namespace OpenSim.Region.Environment.Scenes
267 if (m_frame == Int32.MaxValue) 267 if (m_frame == Int32.MaxValue)
268 m_frame = 0; 268 m_frame = 0;
269 269
270 if (m_frame % m_update_physics == 0) 270 if (m_frame%m_update_physics == 0)
271 UpdatePreparePhysics(); 271 UpdatePreparePhysics();
272 272
273 if (m_frame % m_update_entitymovement == 0) 273 if (m_frame%m_update_entitymovement == 0)
274 UpdateEntityMovement(); 274 UpdateEntityMovement();
275 275
276 if (m_frame % m_update_physics == 0) 276 if (m_frame%m_update_physics == 0)
277 UpdatePhysics( 277 UpdatePhysics(
278 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 278 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
279 ); 279 );
280 280
281 if (m_frame % m_update_entities == 0) 281 if (m_frame%m_update_entities == 0)
282 UpdateEntities(); 282 UpdateEntities();
283 283
284 if (m_frame % m_update_events == 0) 284 if (m_frame%m_update_events == 0)
285 UpdateEvents(); 285 UpdateEvents();
286 286
287 if (m_frame % m_update_backup == 0) 287 if (m_frame%m_update_backup == 0)
288 UpdateStorageBackup(); 288 UpdateStorageBackup();
289 289
290 if (m_frame % m_update_terrain == 0) 290 if (m_frame%m_update_terrain == 0)
291 UpdateTerrain(); 291 UpdateTerrain();
292 292
293 if (m_frame % m_update_land == 0) 293 if (m_frame%m_update_land == 0)
294 UpdateLand(); 294 UpdateLand();
295 295
296 if (m_frame % m_update_avatars == 0) 296 if (m_frame%m_update_avatars == 0)
297 UpdateInWorldTime(); 297 UpdateInWorldTime();
298 } 298 }
299 catch (NotImplementedException) 299 catch (NotImplementedException)
@@ -308,7 +308,7 @@ namespace OpenSim.Region.Environment.Scenes
308 { 308 {
309 updateLock.ReleaseMutex(); 309 updateLock.ReleaseMutex();
310 310
311 m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; 311 m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds;
312 m_lastupdate = DateTime.Now; 312 m_lastupdate = DateTime.Now;
313 } 313 }
314 } 314 }
@@ -369,24 +369,23 @@ namespace OpenSim.Region.Environment.Scenes
369 phyScene.SetTerrain(Terrain.GetHeights1D()); 369 phyScene.SetTerrain(Terrain.GetHeights1D());
370 } 370 }
371 371
372 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); 372 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
373 373
374 float[] terData = Terrain.GetHeights1D(); 374 float[] terData = Terrain.GetHeights1D();
375 375
376 Broadcast(delegate(IClientAPI client) 376 Broadcast(delegate(IClientAPI client)
377 { 377 {
378 for (int x = 0; x < 16; x++) 378 for (int x = 0; x < 16; x++)
379 { 379 {
380 for (int y = 0; y < 16; y++) 380 for (int y = 0; y < 16; y++)
381 { 381 {
382 if (Terrain.Tainted(x * 16, y * 16)) 382 if (Terrain.Tainted(x*16, y*16))
383 { 383 {
384 client.SendLayerData(x, y, terData); 384 client.SendLayerData(x, y, terData);
385 } 385 }
386 } 386 }
387 } 387 }
388 }); 388 });
389
390 389
391 390
392 Terrain.ResetTaint(); 391 Terrain.ResetTaint();
@@ -418,7 +417,7 @@ namespace OpenSim.Region.Environment.Scenes
418 { 417 {
419 lock (m_syncRoot) 418 lock (m_syncRoot)
420 { 419 {
421 phyScene.Simulate((float)elapsed); 420 phyScene.Simulate((float) elapsed);
422 } 421 }
423 } 422 }
424 423
@@ -438,11 +437,9 @@ namespace OpenSim.Region.Environment.Scenes
438 /// <returns></returns> 437 /// <returns></returns>
439 internal void Broadcast(Action<IClientAPI> whatToDo) 438 internal void Broadcast(Action<IClientAPI> whatToDo)
440 { 439 {
441 ForEachScenePresence(delegate(ScenePresence presence) 440 ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); });
442 {
443 whatToDo(presence.ControllingClient);
444 });
445 } 441 }
442
446 /// <summary> 443 /// <summary>
447 /// 444 ///
448 /// </summary> 445 /// </summary>
@@ -473,7 +470,7 @@ namespace OpenSim.Region.Environment.Scenes
473 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); 470 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
474 Terrain.HillsGenerator(); 471 Terrain.HillsGenerator();
475 472
476 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); 473 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
477 } 474 }
478 else 475 else
479 { 476 {
@@ -484,7 +481,8 @@ namespace OpenSim.Region.Environment.Scenes
484 } 481 }
485 catch 482 catch
486 { 483 {
487 MainLog.Instance.Verbose("TERRAIN", "No terrain found in database or default. Generating a new terrain."); 484 MainLog.Instance.Verbose("TERRAIN",
485 "No terrain found in database or default. Generating a new terrain.");
488 Terrain.HillsGenerator(); 486 Terrain.HillsGenerator();
489 } 487 }
490 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); 488 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
@@ -535,7 +533,7 @@ namespace OpenSim.Region.Environment.Scenes
535 { 533 {
536 AddEntityFromStorage(prim); 534 AddEntityFromStorage(prim);
537 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 535 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
538 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 536 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
539 rootPart.PhysActor = phyScene.AddPrimShape( 537 rootPart.PhysActor = phyScene.AddPrimShape(
540 rootPart.Name, 538 rootPart.Name,
541 rootPart.Shape, 539 rootPart.Shape,
@@ -581,17 +579,17 @@ namespace OpenSim.Region.Environment.Scenes
581 // if grass or tree, make phantom 579 // if grass or tree, make phantom
582 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) 580 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
583 { 581 {
584 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 582 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom;
585 } 583 }
586 // if not phantom, add to physics 584 // if not phantom, add to physics
587 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 585 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
588 rootPart.PhysActor = 586 rootPart.PhysActor =
589 phyScene.AddPrimShape( 587 phyScene.AddPrimShape(
590 rootPart.Name, 588 rootPart.Name,
591 rootPart.Shape, 589 rootPart.Shape,
592 new PhysicsVector(pos.X, pos.Y, pos.Z), 590 new PhysicsVector(pos.X, pos.Y, pos.Z),
593 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 591 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
594 new Quaternion()); 592 new Quaternion());
595 } 593 }
596 } 594 }
597 595
@@ -601,9 +599,9 @@ namespace OpenSim.Region.Environment.Scenes
601 { 599 {
602 if (obj is SceneObjectGroup) 600 if (obj is SceneObjectGroup)
603 { 601 {
604 if (((SceneObjectGroup)obj).LocalId == localID) 602 if (((SceneObjectGroup) obj).LocalId == localID)
605 { 603 {
606 RemoveEntity((SceneObjectGroup)obj); 604 RemoveEntity((SceneObjectGroup) obj);
607 return; 605 return;
608 } 606 }
609 } 607 }
@@ -657,7 +655,6 @@ namespace OpenSim.Region.Environment.Scenes
657 int primCount = 0; 655 int primCount = 0;
658 if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) 656 if ((fileName.StartsWith("http:")) | (File.Exists(fileName)))
659 { 657 {
660
661 XmlTextReader reader = new XmlTextReader(fileName); 658 XmlTextReader reader = new XmlTextReader(fileName);
662 reader.WhitespaceHandling = WhitespaceHandling.None; 659 reader.WhitespaceHandling = WhitespaceHandling.None;
663 doc.Load(reader); 660 doc.Load(reader);
@@ -672,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes
672 AddEntity(obj); 669 AddEntity(obj);
673 670
674 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 671 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
675 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 672 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
676 rootPart.PhysActor = phyScene.AddPrimShape( 673 rootPart.PhysActor = phyScene.AddPrimShape(
677 rootPart.Name, 674 rootPart.Name,
678 rootPart.Shape, 675 rootPart.Shape,
@@ -700,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
700 { 697 {
701 if (ent is SceneObjectGroup) 698 if (ent is SceneObjectGroup)
702 { 699 {
703 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); 700 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
704 primCount++; 701 primCount++;
705 } 702 }
706 } 703 }
@@ -737,7 +734,7 @@ namespace OpenSim.Region.Environment.Scenes
737 AddEntityFromStorage(obj); 734 AddEntityFromStorage(obj);
738 735
739 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 736 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
740 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 737 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
741 rootPart.PhysActor = phyScene.AddPrimShape( 738 rootPart.PhysActor = phyScene.AddPrimShape(
742 rootPart.Name, 739 rootPart.Name,
743 rootPart.Shape, 740 rootPart.Shape,
@@ -758,7 +755,7 @@ namespace OpenSim.Region.Environment.Scenes
758 { 755 {
759 if (ent is SceneObjectGroup) 756 if (ent is SceneObjectGroup)
760 { 757 {
761 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2()); 758 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2());
762 primCount++; 759 primCount++;
763 } 760 }
764 } 761 }
@@ -857,7 +854,8 @@ namespace OpenSim.Region.Environment.Scenes
857 byte[] visualParams; 854 byte[] visualParams;
858 AvatarWearable[] wearables; 855 AvatarWearable[] wearables;
859 856
860 if( m_AvatarFactory == null || !m_AvatarFactory.TryGetIntialAvatarAppearance( client.AgentId, out wearables, out visualParams)) 857 if (m_AvatarFactory == null ||
858 !m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
861 { 859 {
862 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams); 860 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
863 } 861 }
@@ -916,16 +914,10 @@ namespace OpenSim.Region.Environment.Scenes
916 914
917 ScenePresence avatar = GetScenePresence(agentID); 915 ScenePresence avatar = GetScenePresence(agentID);
918 916
919 Broadcast(delegate(IClientAPI client) 917 Broadcast(delegate(IClientAPI client) { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); });
920 {
921 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
922 });
923 918
924 ForEachScenePresence( 919 ForEachScenePresence(
925 delegate(ScenePresence presence) 920 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
926 {
927 presence.CoarseLocationChange();
928 });
929 921
930 lock (m_scenePresences) 922 lock (m_scenePresences)
931 { 923 {
@@ -965,10 +957,8 @@ namespace OpenSim.Region.Environment.Scenes
965 957
966 public List<ScenePresence> GetAvatars() 958 public List<ScenePresence> GetAvatars()
967 { 959 {
968 List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence) 960 List<ScenePresence> result =
969 { 961 GetScenePresences(delegate(ScenePresence scenePresence) { return !scenePresence.IsChildAgent; });
970 return !scenePresence.IsChildAgent;
971 });
972 962
973 return result; 963 return result;
974 } 964 }
@@ -1046,18 +1036,12 @@ namespace OpenSim.Region.Environment.Scenes
1046 1036
1047 public void SendKillObject(uint localID) 1037 public void SendKillObject(uint localID)
1048 { 1038 {
1049 Broadcast(delegate(IClientAPI client) 1039 Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
1050 {
1051 client.SendKillObject(m_regionHandle, localID);
1052 });
1053 } 1040 }
1054 1041
1055 public void NotifyMyCoarseLocationChange() 1042 public void NotifyMyCoarseLocationChange()
1056 { 1043 {
1057 ForEachScenePresence(delegate(ScenePresence presence) 1044 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
1058 {
1059 presence.CoarseLocationChange();
1060 });
1061 } 1045 }
1062 1046
1063 public void SendAllSceneObjectsToClient(ScenePresence presence) 1047 public void SendAllSceneObjectsToClient(ScenePresence presence)
@@ -1067,7 +1051,7 @@ namespace OpenSim.Region.Environment.Scenes
1067 if (ent is SceneObjectGroup) 1051 if (ent is SceneObjectGroup)
1068 { 1052 {
1069 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 1053 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
1070 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 1054 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
1071 } 1055 }
1072 } 1056 }
1073 } 1057 }
@@ -1137,11 +1121,12 @@ namespace OpenSim.Region.Environment.Scenes
1137 } 1121 }
1138 } 1122 }
1139 1123
1140 delegate void InformClientOfNeighbourDelegate(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); 1124 private delegate void InformClientOfNeighbourDelegate(
1125 IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
1141 1126
1142 private void InformClientOfNeighbourCompleted(IAsyncResult iar) 1127 private void InformClientOfNeighbourCompleted(IAsyncResult iar)
1143 { 1128 {
1144 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; 1129 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
1145 1130
1146 1131
1147 icon.EndInvoke(iar); 1132 icon.EndInvoke(iar);
@@ -1157,7 +1142,8 @@ namespace OpenSim.Region.Environment.Scenes
1157 /// <param name="a"></param> 1142 /// <param name="a"></param>
1158 /// <param name="regionHandle"></param> 1143 /// <param name="regionHandle"></param>
1159 /// <param name="endPoint"></param> 1144 /// <param name="endPoint"></param>
1160 private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) 1145 private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle,
1146 IPEndPoint endPoint)
1161 { 1147 {
1162 MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours"); 1148 MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours");
1163 bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); 1149 bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a);
@@ -1172,7 +1158,8 @@ namespace OpenSim.Region.Environment.Scenes
1172 /// </summary> 1158 /// </summary>
1173 public void InformClientOfNeighbours(IClientAPI remoteClient) 1159 public void InformClientOfNeighbours(IClientAPI remoteClient)
1174 { 1160 {
1175 List<SimpleRegionInfo> neighbours = commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); 1161 List<SimpleRegionInfo> neighbours =
1162 commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY);
1176 if (neighbours != null) 1163 if (neighbours != null)
1177 { 1164 {
1178 for (int i = 0; i < neighbours.Count; i++) 1165 for (int i = 0; i < neighbours.Count; i++)
@@ -1185,9 +1172,8 @@ namespace OpenSim.Region.Environment.Scenes
1185 1172
1186 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1173 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1187 d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, 1174 d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint,
1188 InformClientOfNeighbourCompleted, 1175 InformClientOfNeighbourCompleted,
1189 d); 1176 d);
1190
1191 } 1177 }
1192 } 1178 }
1193 } 1179 }
@@ -1289,17 +1275,17 @@ namespace OpenSim.Region.Environment.Scenes
1289 1275
1290 public void RegisterModuleInterface<M>(M mod) 1276 public void RegisterModuleInterface<M>(M mod)
1291 { 1277 {
1292 if (!ModuleInterfaces.ContainsKey(typeof(M))) 1278 if (!ModuleInterfaces.ContainsKey(typeof (M)))
1293 { 1279 {
1294 ModuleInterfaces.Add(typeof(M), mod); 1280 ModuleInterfaces.Add(typeof (M), mod);
1295 } 1281 }
1296 } 1282 }
1297 1283
1298 public T RequestModuleInterface<T>() 1284 public T RequestModuleInterface<T>()
1299 { 1285 {
1300 if (ModuleInterfaces.ContainsKey(typeof(T))) 1286 if (ModuleInterfaces.ContainsKey(typeof (T)))
1301 { 1287 {
1302 return (T)ModuleInterfaces[typeof(T)]; 1288 return (T) ModuleInterfaces[typeof (T)];
1303 } 1289 }
1304 else 1290 else
1305 { 1291 {
@@ -1317,7 +1303,8 @@ namespace OpenSim.Region.Environment.Scenes
1317 { 1303 {
1318 if (m_scenePresences.ContainsKey(avatarID)) 1304 if (m_scenePresences.ContainsKey(avatarID))
1319 { 1305 {
1320 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url); 1306 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned,
1307 message, url);
1321 } 1308 }
1322 } 1309 }
1323 1310
@@ -1388,7 +1375,7 @@ namespace OpenSim.Region.Environment.Scenes
1388 { 1375 {
1389 if (ent is SceneObjectGroup) 1376 if (ent is SceneObjectGroup)
1390 { 1377 {
1391 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 1378 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
1392 } 1379 }
1393 } 1380 }
1394 } 1381 }
@@ -1400,7 +1387,7 @@ namespace OpenSim.Region.Environment.Scenes
1400 { 1387 {
1401 if (ent is SceneObjectGroup) 1388 if (ent is SceneObjectGroup)
1402 { 1389 {
1403 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); 1390 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
1404 if (part != null) 1391 if (part != null)
1405 { 1392 {
1406 if (part.Name == cmmdparams[0]) 1393 if (part.Name == cmmdparams[0])
@@ -1429,14 +1416,14 @@ namespace OpenSim.Region.Environment.Scenes
1429 foreach (ScenePresence scenePrescence in GetAvatars()) 1416 foreach (ScenePresence scenePrescence in GetAvatars())
1430 { 1417 {
1431 MainLog.Instance.Error( 1418 MainLog.Instance.Error(
1432 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", 1419 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
1433 scenePrescence.Firstname, 1420 scenePrescence.Firstname,
1434 scenePrescence.Lastname, 1421 scenePrescence.Lastname,
1435 scenePrescence.UUID, 1422 scenePrescence.UUID,
1436 scenePrescence.ControllingClient.AgentId, 1423 scenePrescence.ControllingClient.AgentId,
1437 "Unknown", 1424 "Unknown",
1438 "Unknown", 1425 "Unknown",
1439 RegionInfo.RegionName)); 1426 RegionInfo.RegionName));
1440 } 1427 }
1441 break; 1428 break;
1442 case "modules": 1429 case "modules":
@@ -1482,10 +1469,10 @@ namespace OpenSim.Region.Environment.Scenes
1482 { 1469 {
1483 if (ent is SceneObjectGroup) 1470 if (ent is SceneObjectGroup)
1484 { 1471 {
1485 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1472 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1486 if (hasPrim != false) 1473 if (hasPrim != false)
1487 { 1474 {
1488 return ((SceneObjectGroup)ent).GetPartsFullID(localID); 1475 return ((SceneObjectGroup) ent).GetPartsFullID(localID);
1489 } 1476 }
1490 } 1477 }
1491 } 1478 }
@@ -1499,10 +1486,10 @@ namespace OpenSim.Region.Environment.Scenes
1499 { 1486 {
1500 if (ent is SceneObjectGroup) 1487 if (ent is SceneObjectGroup)
1501 { 1488 {
1502 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1489 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1503 if (hasPrim != false) 1490 if (hasPrim != false)
1504 { 1491 {
1505 return ((SceneObjectGroup)ent).GetChildPart(localID); 1492 return ((SceneObjectGroup) ent).GetChildPart(localID);
1506 } 1493 }
1507 } 1494 }
1508 } 1495 }
@@ -1516,10 +1503,10 @@ namespace OpenSim.Region.Environment.Scenes
1516 { 1503 {
1517 if (ent is SceneObjectGroup) 1504 if (ent is SceneObjectGroup)
1518 { 1505 {
1519 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); 1506 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
1520 if (hasPrim != false) 1507 if (hasPrim != false)
1521 { 1508 {
1522 return ((SceneObjectGroup)ent).GetChildPart(fullID); 1509 return ((SceneObjectGroup) ent).GetChildPart(fullID);
1523 } 1510 }
1524 } 1511 }
1525 } 1512 }
@@ -1569,12 +1556,12 @@ namespace OpenSim.Region.Environment.Scenes
1569 return false; 1556 return false;
1570 } 1557 }
1571 1558
1572 internal void ForEachClient( Action<IClientAPI> action ) 1559 internal void ForEachClient(Action<IClientAPI> action)
1573 { 1560 {
1574 foreach (ScenePresence presence in m_scenePresences.Values ) 1561 foreach (ScenePresence presence in m_scenePresences.Values)
1575 { 1562 {
1576 action(presence.ControllingClient); 1563 action(presence.ControllingClient);
1577 } 1564 }
1578 } 1565 }
1579 } 1566 }
1580} 1567} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 0072d4e..4ad9d65 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -28,10 +28,9 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
32using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework;
35using OpenSim.Region.Terrain; 34using OpenSim.Region.Terrain;
36 35
37namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
@@ -39,6 +38,7 @@ namespace OpenSim.Region.Environment.Scenes
39 public abstract class SceneBase : IScene 38 public abstract class SceneBase : IScene
40 { 39 {
41 private readonly ClientManager m_clientManager = new ClientManager(); 40 private readonly ClientManager m_clientManager = new ClientManager();
41
42 public ClientManager ClientManager 42 public ClientManager ClientManager
43 { 43 {
44 get { return m_clientManager; } 44 get { return m_clientManager; }
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index ea47713..493afd1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -27,9 +27,8 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces;
33 32
34namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
35{ 34{
@@ -207,4 +206,4 @@ namespace OpenSim.Region.Environment.Scenes
207 } 206 }
208 } 207 }
209 } 208 }
210} 209} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index a315d02..75e2a41 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -28,9 +28,9 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Framework.Console;
32using OpenSim.Framework;
33using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
@@ -152,10 +152,7 @@ namespace OpenSim.Region.Environment.Scenes
152 152
153 public void SendGeneralMessage(string msg) 153 public void SendGeneralMessage(string msg)
154 { 154 {
155 ForEachCurrentScene(delegate(Scene scene) 155 ForEachCurrentScene(delegate(Scene scene) { scene.SendGeneralAlert(msg); });
156 {
157 scene.SendGeneralAlert(msg);
158 });
159 } 156 }
160 157
161 public bool TrySetCurrentScene(string regionName) 158 public bool TrySetCurrentScene(string regionName)
@@ -185,23 +182,24 @@ namespace OpenSim.Region.Environment.Scenes
185 public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) 182 public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
186 { 183 {
187 ForEachCurrentScene(delegate(Scene scene) 184 ForEachCurrentScene(delegate(Scene scene)
188 {
189 foreach (EntityBase entity in scene.Entities.Values)
190 {
191 if (entity is ScenePresence)
192 {
193 ScenePresence scenePrescence = entity as ScenePresence;
194 if (!scenePrescence.IsChildAgent)
195 { 185 {
196 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 186 foreach (EntityBase entity in scene.Entities.Values)
197 scenePrescence.Firstname, scenePrescence.Lastname, 187 {
198 newDebug)); 188 if (entity is ScenePresence)
199 189 {
200 scenePrescence.ControllingClient.SetDebug(newDebug); 190 ScenePresence scenePrescence = entity as ScenePresence;
201 } 191 if (!scenePrescence.IsChildAgent)
202 } 192 {
203 } 193 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
204 }); 194 scenePrescence.Firstname,
195 scenePrescence.Lastname,
196 newDebug));
197
198 scenePrescence.ControllingClient.SetDebug(newDebug);
199 }
200 }
201 }
202 });
205 } 203 }
206 204
207 public List<ScenePresence> GetCurrentSceneAvatars() 205 public List<ScenePresence> GetCurrentSceneAvatars()
@@ -209,19 +207,19 @@ namespace OpenSim.Region.Environment.Scenes
209 List<ScenePresence> avatars = new List<ScenePresence>(); 207 List<ScenePresence> avatars = new List<ScenePresence>();
210 208
211 ForEachCurrentScene(delegate(Scene scene) 209 ForEachCurrentScene(delegate(Scene scene)
212 {
213 foreach (EntityBase entity in scene.Entities.Values)
214 {
215 if (entity is ScenePresence)
216 {
217 ScenePresence scenePrescence = entity as ScenePresence;
218 if (!scenePrescence.IsChildAgent)
219 { 210 {
220 avatars.Add(scenePrescence); 211 foreach (EntityBase entity in scene.Entities.Values)
221 } 212 {
222 } 213 if (entity is ScenePresence)
223 } 214 {
224 }); 215 ScenePresence scenePrescence = entity as ScenePresence;
216 if (!scenePrescence.IsChildAgent)
217 {
218 avatars.Add(scenePrescence);
219 }
220 }
221 }
222 });
225 223
226 return avatars; 224 return avatars;
227 } 225 }
@@ -242,11 +240,11 @@ namespace OpenSim.Region.Environment.Scenes
242 public void SetCurrentSceneTimePhase(int timePhase) 240 public void SetCurrentSceneTimePhase(int timePhase)
243 { 241 {
244 ForEachCurrentScene(delegate(Scene scene) 242 ForEachCurrentScene(delegate(Scene scene)
245 { 243 {
246 scene.SetTimePhase( 244 scene.SetTimePhase(
247 timePhase) 245 timePhase)
248 ; 246 ;
249 }); 247 });
250 } 248 }
251 249
252 250
@@ -260,11 +258,11 @@ namespace OpenSim.Region.Environment.Scenes
260 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); 258 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
261 } 259 }
262 260
263 public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) 261 public bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
264 { 262 {
265 foreach (Scene scene in m_localScenes) 263 foreach (Scene scene in m_localScenes)
266 { 264 {
267 if( scene.TryGetAvatar( avatarId, out avatar )) 265 if (scene.TryGetAvatar(avatarId, out avatar))
268 { 266 {
269 return true; 267 return true;
270 } 268 }
@@ -311,9 +309,9 @@ namespace OpenSim.Region.Environment.Scenes
311 return false; 309 return false;
312 } 310 }
313 311
314 public void ForEachScene(Action<Scene> action ) 312 public void ForEachScene(Action<Scene> action)
315 { 313 {
316 m_localScenes.ForEach( action ); 314 m_localScenes.ForEach(action);
317 } 315 }
318 } 316 }
319} 317} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 4603902..4d439b2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -34,7 +34,6 @@ using System.Xml;
34using Axiom.Math; 34using Axiom.Math;
35using libsecondlife; 35using libsecondlife;
36using libsecondlife.Packets; 36using libsecondlife.Packets;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework; 37using OpenSim.Framework;
39using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
@@ -270,7 +269,7 @@ namespace OpenSim.Region.Environment.Scenes
270 StringReader sr = new StringReader(xmlData); 269 StringReader sr = new StringReader(xmlData);
271 XmlTextReader reader = new XmlTextReader(sr); 270 XmlTextReader reader = new XmlTextReader(sr);
272 reader.Read(); 271 reader.Read();
273 272
274 reader.ReadStartElement("SceneObjectGroup"); 273 reader.ReadStartElement("SceneObjectGroup");
275 m_rootPart = SceneObjectPart.FromXml(reader); 274 m_rootPart = SceneObjectPart.FromXml(reader);
276 275
@@ -285,14 +284,14 @@ namespace OpenSim.Region.Environment.Scenes
285 if (reader.Name == "SceneObjectPart") 284 if (reader.Name == "SceneObjectPart")
286 { 285 {
287 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 286 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
288 AddPart(Part); 287 AddPart(Part);
289 } 288 }
290 break; 289 break;
291 case XmlNodeType.EndElement: 290 case XmlNodeType.EndElement:
292 reader.Read(); 291 reader.Read();
293 break; 292 break;
294 } 293 }
295 more = !reader.EOF; 294 more = !reader.EOF;
296 } 295 }
297 reader.Close(); 296 reader.Close();
298 sr.Close(); 297 sr.Close();
@@ -424,13 +423,13 @@ namespace OpenSim.Region.Environment.Scenes
424 PrimitiveBaseShape pbs = dupe.RootPart.Shape; 423 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
425 424
426 dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape( 425 dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
427 dupe.RootPart.Name, 426 dupe.RootPart.Name,
428 pbs, 427 pbs,
429 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), 428 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
430 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 429 dupe.RootPart.AbsolutePosition.Z),
431 new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 430 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
432 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); 431 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
433 432 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z));
434 } 433 }
435 434
436 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); 435 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
@@ -951,14 +950,15 @@ namespace OpenSim.Region.Environment.Scenes
951 } 950 }
952 if (m_rootPart.PhysActor != null) 951 if (m_rootPart.PhysActor != null)
953 { 952 {
954 this.m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor); 953 m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor);
955 m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape( 954 m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
956 m_rootPart.Name, 955 m_rootPart.Name,
957 m_rootPart.Shape, 956 m_rootPart.Shape,
958 new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y, m_rootPart.AbsolutePosition.Z), 957 new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y,
959 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z), 958 m_rootPart.AbsolutePosition.Z),
960 new Axiom.Math.Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, 959 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z),
961 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z)); 960 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X,
961 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z));
962 } 962 }
963 } 963 }
964 964
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Environment.Scenes
1001 AbsolutePosition = pos; 1001 AbsolutePosition = pos;
1002 ScheduleGroupForTerseUpdate(); 1002 ScheduleGroupForTerseUpdate();
1003 1003
1004 m_scene.EventManager.TriggerGroupMove(this.UUID, pos); 1004 m_scene.EventManager.TriggerGroupMove(UUID, pos);
1005 } 1005 }
1006 1006
1007 /// <summary> 1007 /// <summary>
@@ -1350,7 +1350,7 @@ namespace OpenSim.Region.Environment.Scenes
1350 1350
1351 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 1351 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
1352 { 1352 {
1353 m_scene.EventManager.TriggerGroupGrab(this.UUID, offsetPos, remoteClient.AgentId); 1353 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId);
1354 } 1354 }
1355 1355
1356 public void DeleteGroup() 1356 public void DeleteGroup()
@@ -1377,4 +1377,4 @@ namespace OpenSim.Region.Environment.Scenes
1377 Text = text; 1377 Text = text;
1378 } 1378 }
1379 } 1379 }
1380} 1380} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 3e104e3..387f573 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -33,12 +33,10 @@ using System.Xml.Serialization;
33using Axiom.Math; 33using Axiom.Math;
34using libsecondlife; 34using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes.Scripting; 38using OpenSim.Region.Environment.Scenes.Scripting;
40using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
41using OpenSim.Region.Environment.Types;
42 40
43namespace OpenSim.Region.Environment.Scenes 41namespace OpenSim.Region.Environment.Scenes
44{ 42{
@@ -49,8 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
49 private string m_inventoryFileName = ""; 47 private string m_inventoryFileName = "";
50 private LLUUID m_folderID = LLUUID.Zero; 48 private LLUUID m_folderID = LLUUID.Zero;
51 49
52 [XmlIgnore] 50 [XmlIgnore] public PhysicsActor PhysActor = null;
53 public PhysicsActor PhysActor = null;
54 51
55 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 52 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
56 53
@@ -68,10 +65,8 @@ namespace OpenSim.Region.Environment.Scenes
68 65
69 protected byte[] m_particleSystem = new byte[0]; 66 protected byte[] m_particleSystem = new byte[0];
70 67
71 [XmlIgnore] 68 [XmlIgnore] public uint TimeStampFull = 0;
72 public uint TimeStampFull = 0; 69 [XmlIgnore] public uint TimeStampTerse = 0;
73 [XmlIgnore]
74 public uint TimeStampTerse = 0;
75 70
76 protected SceneObjectGroup m_parentGroup; 71 protected SceneObjectGroup m_parentGroup;
77 72
@@ -124,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
124 set { m_name = value; } 119 set { m_name = value; }
125 } 120 }
126 121
127 protected LLObject.ObjectFlags m_flags =0; 122 protected LLObject.ObjectFlags m_flags = 0;
128 123
129 public uint ObjectFlags 124 public uint ObjectFlags
130 { 125 {
@@ -132,7 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
132 set { m_flags = (LLObject.ObjectFlags) value; } 127 set { m_flags = (LLObject.ObjectFlags) value; }
133 } 128 }
134 129
135 protected LLObject.MaterialType m_material =0; 130 protected LLObject.MaterialType m_material = 0;
136 131
137 public byte Material 132 public byte Material
138 { 133 {
@@ -712,7 +707,7 @@ namespace OpenSim.Region.Environment.Scenes
712 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 707 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
713 for (int i = 0; i < avatars.Count; i++) 708 for (int i = 0; i < avatars.Count; i++)
714 { 709 {
715 avatars[i].QueuePartForUpdate(this); 710 avatars[i].QueuePartForUpdate(this);
716 } 711 }
717 } 712 }
718 713
@@ -774,13 +769,13 @@ namespace OpenSim.Region.Environment.Scenes
774 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 769 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
775 for (int i = 0; i < avatars.Count; i++) 770 for (int i = 0; i < avatars.Count; i++)
776 { 771 {
777 avatars[i].QueuePartForUpdate(this); 772 avatars[i].QueuePartForUpdate(this);
778 } 773 }
779 } 774 }
780 775
781 public void AddTerseUpdateToAvatar(ScenePresence presence) 776 public void AddTerseUpdateToAvatar(ScenePresence presence)
782 { 777 {
783 presence.QueuePartForUpdate(this); 778 presence.QueuePartForUpdate(this);
784 } 779 }
785 780
786 /// <summary> 781 /// <summary>
@@ -927,4 +922,4 @@ namespace OpenSim.Region.Environment.Scenes
927 } 922 }
928 } 923 }
929 } 924 }
930} 925} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index 8ed4e87..f43a9fc 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
45 public void LoadAnims() 45 public void LoadAnims()
46 { 46 {
47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); 47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
48 using( XmlTextReader reader = new XmlTextReader("data/avataranimations.xml") ) 48 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
49 { 49 {
50 XmlDocument doc = new XmlDocument(); 50 XmlDocument doc = new XmlDocument();
51 doc.Load(reader); 51 doc.Load(reader);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 6ed50b7..527eb22 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -30,11 +30,10 @@ using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework; 33using OpenSim.Framework;
36using OpenSim.Region.Physics.Manager; 34using OpenSim.Framework.Console;
37using OpenSim.Region.Environment.Types; 35using OpenSim.Region.Environment.Types;
36using OpenSim.Region.Physics.Manager;
38 37
39namespace OpenSim.Region.Environment.Scenes 38namespace OpenSim.Region.Environment.Scenes
40{ 39{
@@ -116,18 +115,21 @@ namespace OpenSim.Region.Environment.Scenes
116 } 115 }
117 116
118 private readonly ulong m_regionHandle; 117 private readonly ulong m_regionHandle;
118
119 public ulong RegionHandle 119 public ulong RegionHandle
120 { 120 {
121 get { return m_regionHandle; } 121 get { return m_regionHandle; }
122 } 122 }
123 123
124 private readonly string m_firstname; 124 private readonly string m_firstname;
125
125 public string Firstname 126 public string Firstname
126 { 127 {
127 get { return m_firstname; } 128 get { return m_firstname; }
128 } 129 }
129 130
130 private readonly string m_lastname; 131 private readonly string m_lastname;
132
131 public string Lastname 133 public string Lastname
132 { 134 {
133 get { return m_lastname; } 135 get { return m_lastname; }
@@ -210,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
210 } 212 }
211 213
212 private bool m_isChildAgent = true; 214 private bool m_isChildAgent = true;
215
213 public bool IsChildAgent 216 public bool IsChildAgent
214 { 217 {
215 get { return m_isChildAgent; } 218 get { return m_isChildAgent; }
@@ -217,6 +220,7 @@ namespace OpenSim.Region.Environment.Scenes
217 } 220 }
218 221
219 private uint m_parentID = 0; 222 private uint m_parentID = 0;
223
220 public uint ParentID 224 public uint ParentID
221 { 225 {
222 get { return m_parentID; } 226 get { return m_parentID; }
@@ -227,7 +231,8 @@ namespace OpenSim.Region.Environment.Scenes
227 231
228 #region Constructor(s) 232 #region Constructor(s)
229 233
230 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables) 234 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
235 AvatarWearable[] wearables)
231 { 236 {
232 m_scene = world; 237 m_scene = world;
233 m_uuid = client.AgentId; 238 m_uuid = client.AgentId;
@@ -309,24 +314,24 @@ namespace OpenSim.Region.Environment.Scenes
309 if (update.LastFullUpdateTime < part.TimeStampFull) 314 if (update.LastFullUpdateTime < part.TimeStampFull)
310 { 315 {
311 //need to do a full update 316 //need to do a full update
312 part.SendFullUpdate(this.ControllingClient); 317 part.SendFullUpdate(ControllingClient);
313 update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 318 update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch();
314 updateCount++; 319 updateCount++;
315 } 320 }
316 else if (update.LastTerseUpdateTime < part.TimeStampTerse) 321 else if (update.LastTerseUpdateTime < part.TimeStampTerse)
317 { 322 {
318 part.SendTerseUpdate(this.ControllingClient); 323 part.SendTerseUpdate(ControllingClient);
319 update.LastTerseUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 324 update.LastTerseUpdateTime = (uint) Util.UnixTimeSinceEpoch();
320 updateCount++; 325 updateCount++;
321 } 326 }
322 } 327 }
323 else 328 else
324 { 329 {
325 //never been sent to client before so do full update 330 //never been sent to client before so do full update
326 part.SendFullUpdate(this.ControllingClient); 331 part.SendFullUpdate(ControllingClient);
327 ScenePartUpdate update = new ScenePartUpdate(); 332 ScenePartUpdate update = new ScenePartUpdate();
328 update.FullID = part.UUID; 333 update.FullID = part.UUID;
329 update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 334 update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch();
330 m_updateTimes.Add(part.UUID, update); 335 m_updateTimes.Add(part.UUID, update);
331 updateCount++; 336 updateCount++;
332 } 337 }
@@ -339,7 +344,6 @@ namespace OpenSim.Region.Environment.Scenes
339 } 344 }
340 } 345 }
341 346
342
343 #region Status Methods 347 #region Status Methods
344 348
345 public void MakeRootAgent(LLVector3 pos, bool isFlying) 349 public void MakeRootAgent(LLVector3 pos, bool isFlying)
@@ -368,10 +372,10 @@ namespace OpenSim.Region.Environment.Scenes
368 372
369 private void RemoveFromPhysicalScene() 373 private void RemoveFromPhysicalScene()
370 { 374 {
371 if (this.PhysicsActor != null) 375 if (PhysicsActor != null)
372 { 376 {
373 m_scene.PhysScene.RemoveAvatar(this.PhysicsActor); 377 m_scene.PhysScene.RemoveAvatar(PhysicsActor);
374 this.PhysicsActor = null; 378 PhysicsActor = null;
375 } 379 }
376 } 380 }
377 381
@@ -432,7 +436,7 @@ namespace OpenSim.Region.Environment.Scenes
432 m_isChildAgent = false; 436 m_isChildAgent = false;
433 437
434 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 438 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
435 this.MakeRootAgent(this.AbsolutePosition, false); 439 MakeRootAgent(AbsolutePosition, false);
436 } 440 }
437 } 441 }
438 442
@@ -457,13 +461,13 @@ namespace OpenSim.Region.Environment.Scenes
457 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 461 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
458 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 462 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
459 bool oldflying = PhysicsActor.Flying; 463 bool oldflying = PhysicsActor.Flying;
460 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 464 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
461 if (PhysicsActor.Flying != oldflying) 465 if (PhysicsActor.Flying != oldflying)
462 { 466 {
463 update_movementflag = true; 467 update_movementflag = true;
464 } 468 }
465 469
466 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 470 if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
467 { 471 {
468 StandUp(); 472 StandUp();
469 update_movementflag = true; 473 update_movementflag = true;
@@ -477,23 +481,23 @@ namespace OpenSim.Region.Environment.Scenes
477 481
478 if (m_parentID == 0) 482 if (m_parentID == 0)
479 { 483 {
480 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 484 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
481 { 485 {
482 if ((flags & (uint)DCF) != 0) 486 if ((flags & (uint) DCF) != 0)
483 { 487 {
484 DCFlagKeyPressed = true; 488 DCFlagKeyPressed = true;
485 agent_control_v3 += Dir_Vectors[i]; 489 agent_control_v3 += Dir_Vectors[i];
486 if ((m_movementflag & (uint)DCF) == 0) 490 if ((m_movementflag & (uint) DCF) == 0)
487 { 491 {
488 m_movementflag += (byte)(uint)DCF; 492 m_movementflag += (byte) (uint) DCF;
489 update_movementflag = true; 493 update_movementflag = true;
490 } 494 }
491 } 495 }
492 else 496 else
493 { 497 {
494 if ((m_movementflag & (uint)DCF) != 0) 498 if ((m_movementflag & (uint) DCF) != 0)
495 { 499 {
496 m_movementflag -= (byte)(uint)DCF; 500 m_movementflag -= (byte) (uint) DCF;
497 update_movementflag = true; 501 update_movementflag = true;
498 } 502 }
499 } 503 }
@@ -580,10 +584,10 @@ namespace OpenSim.Region.Environment.Scenes
580 } 584 }
581 585
582 NewForce newVelocity = new NewForce(); 586 NewForce newVelocity = new NewForce();
583 Vector3 direc = rotation * vec; 587 Vector3 direc = rotation*vec;
584 direc.Normalize(); 588 direc.Normalize();
585 589
586 direc = direc * ((0.03f) * 128f); 590 direc = direc*((0.03f)*128f);
587 if (m_physicsActor.Flying) 591 if (m_physicsActor.Flying)
588 direc *= 4; 592 direc *= 4;
589 593
@@ -692,8 +696,6 @@ namespace OpenSim.Region.Environment.Scenes
692 } 696 }
693 697
694 698
695
696
697 /// <summary> 699 /// <summary>
698 /// 700 ///
699 /// </summary> 701 /// </summary>
@@ -701,7 +703,8 @@ namespace OpenSim.Region.Environment.Scenes
701 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 703 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
702 { 704 {
703 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, 705 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
704 LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); 706 LocalId, AbsolutePosition, m_textureEntry.ToBytes(),
707 m_parentID);
705 } 708 }
706 709
707 public void SendFullUpdateToAllClients() 710 public void SendFullUpdateToAllClients()
@@ -784,7 +787,7 @@ namespace OpenSim.Region.Environment.Scenes
784 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 787 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
785 { 788 {
786 avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, 789 avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
787 m_textureEntry.ToBytes()); 790 m_textureEntry.ToBytes());
788 } 791 }
789 792
790 /// <summary> 793 /// <summary>
@@ -798,10 +801,7 @@ namespace OpenSim.Region.Environment.Scenes
798 AnimationSeq = seq; 801 AnimationSeq = seq;
799 LLUUID sourceAgentId = m_controllingClient.AgentId; 802 LLUUID sourceAgentId = m_controllingClient.AgentId;
800 803
801 m_scene.Broadcast(delegate(IClientAPI client) 804 m_scene.Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, sourceAgentId); });
802 {
803 client.SendAnimation(animID, seq, sourceAgentId);
804 });
805 } 805 }
806 806
807 /// <summary> 807 /// <summary>
@@ -842,9 +842,9 @@ namespace OpenSim.Region.Environment.Scenes
842 LLVector3 vel = Velocity; 842 LLVector3 vel = Velocity;
843 843
844 float timeStep = 0.1f; 844 float timeStep = 0.1f;
845 pos2.X = pos2.X + (vel.X * timeStep); 845 pos2.X = pos2.X + (vel.X*timeStep);
846 pos2.Y = pos2.Y + (vel.Y * timeStep); 846 pos2.Y = pos2.Y + (vel.Y*timeStep);
847 pos2.Z = pos2.Z + (vel.Z * timeStep); 847 pos2.Z = pos2.Z + (vel.Z*timeStep);
848 848
849 if ((pos2.X < 0) || (pos2.X > 256)) 849 if ((pos2.X < 0) || (pos2.X > 256))
850 { 850 {
@@ -889,7 +889,7 @@ namespace OpenSim.Region.Environment.Scenes
889 } 889 }
890 890
891 LLVector3 vel = m_velocity; 891 LLVector3 vel = m_velocity;
892 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 892 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
893 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 893 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
894 if (neighbourRegion != null) 894 if (neighbourRegion != null)
895 { 895 {
@@ -901,7 +901,7 @@ namespace OpenSim.Region.Environment.Scenes
901 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 901 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
902 string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); 902 string capsPath = Util.GetCapsURL(m_controllingClient.AgentId);
903 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, 903 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
904 capsPath); 904 capsPath);
905 MakeChildAgent(); 905 MakeChildAgent();
906 m_scene.SendKillObject(m_localId); 906 m_scene.SendKillObject(m_localId);
907 m_scene.NotifyMyCoarseLocationChange(); 907 m_scene.NotifyMyCoarseLocationChange();
@@ -980,7 +980,6 @@ namespace OpenSim.Region.Environment.Scenes
980 LastFullUpdateTime = 0; 980 LastFullUpdateTime = 0;
981 LastTerseUpdateTime = 0; 981 LastTerseUpdateTime = 0;
982 } 982 }
983
984 } 983 }
985 984
986 985
@@ -997,7 +996,7 @@ namespace OpenSim.Region.Environment.Scenes
997 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 996 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
998 AbsolutePosition.Z); 997 AbsolutePosition.Z);
999 998
1000 m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec); 999 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec);
1001 } 1000 }
1002 1001
1003 internal void Close() 1002 internal void Close()
@@ -1008,7 +1007,7 @@ namespace OpenSim.Region.Environment.Scenes
1008 public void SetWearable(int wearableId, AvatarWearable wearable) 1007 public void SetWearable(int wearableId, AvatarWearable wearable)
1009 { 1008 {
1010 m_wearables[wearableId] = wearable; 1009 m_wearables[wearableId] = wearable;
1011 SendOurAppearance( m_controllingClient ); 1010 SendOurAppearance(m_controllingClient);
1012 } 1011 }
1013 } 1012 }
1014} 1013} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
index 01c1d65..cb000c4 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
@@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
43 LLVector3 AbsolutePosition { get; } 43 LLVector3 AbsolutePosition { get; }
44 void SetText(string text, Vector3 color, double alpha); 44 void SetText(string text, Vector3 color, double alpha);
45 } 45 }
46} 46} \ 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 2fb3e78..c1bf72b 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
@@ -85,4 +85,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
85 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); 85 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
86 } 86 }
87 } 87 }
88} 88} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs
index 42048ea..11f0ce0 100644
--- a/OpenSim/Region/Environment/StorageManager.cs
+++ b/OpenSim/Region/Environment/StorageManager.cs
@@ -78,4 +78,4 @@ namespace OpenSim.Region.Environment
78 //TODO: Add checking and warning to make sure it initialised. 78 //TODO: Add checking and warning to make sure it initialised.
79 } 79 }
80 } 80 }
81} 81} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index 942ec4d..70b957e 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Types
44 //private int m_quadNumber; 44 //private int m_quadNumber;
45 private string m_quadID; 45 private string m_quadID;
46 46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) 47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
48 short height)
48 { 49 {
49 m_parent = parent; 50 m_parent = parent;
50 m_quadID = quadID; 51 m_quadID = quadID;
@@ -66,9 +67,9 @@ namespace OpenSim.Region.Environment.Types
66 } 67 }
67 else 68 else
68 { 69 {
69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 70 if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
70 { 71 {
71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 72 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
72 { 73 {
73 m_childNodes[0].AddObject(obj); 74 m_childNodes[0].AddObject(obj);
74 } 75 }
@@ -79,7 +80,7 @@ namespace OpenSim.Region.Environment.Types
79 } 80 }
80 else 81 else
81 { 82 {
82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 83 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
83 { 84 {
84 m_childNodes[1].AddObject(obj); 85 m_childNodes[1].AddObject(obj);
85 } 86 }
@@ -96,10 +97,18 @@ namespace OpenSim.Region.Environment.Types
96 if (m_childNodes == null) 97 if (m_childNodes == null)
97 { 98 {
98 m_childNodes = new BasicQuadTreeNode[4]; 99 m_childNodes = new BasicQuadTreeNode[4];
99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 100 m_childNodes[0] =
100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 101 new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 102 (short) (m_height/2));
102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 103 m_childNodes[1] =
104 new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
105 (short) (m_width/2), (short) (m_height/2));
106 m_childNodes[2] =
107 new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
108 (short) (m_width/2), (short) (m_height/2));
109 m_childNodes[3] =
110 new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
111 (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
103 } 112 }
104 else 113 else
105 { 114 {
@@ -118,9 +127,9 @@ namespace OpenSim.Region.Environment.Types
118 } 127 }
119 else 128 else
120 { 129 {
121 if (x < m_leftX + (m_width / 2)) 130 if (x < m_leftX + (m_width/2))
122 { 131 {
123 if (y < m_leftY + (m_height / 2)) 132 if (y < m_leftY + (m_height/2))
124 { 133 {
125 return m_childNodes[0].GetObjectsFrom(x, y); 134 return m_childNodes[0].GetObjectsFrom(x, y);
126 } 135 }
@@ -131,7 +140,7 @@ namespace OpenSim.Region.Environment.Types
131 } 140 }
132 else 141 else
133 { 142 {
134 if (y < m_leftY + (m_height / 2)) 143 if (y < m_leftY + (m_height/2))
135 { 144 {
136 return m_childNodes[1].GetObjectsFrom(x, y); 145 return m_childNodes[1].GetObjectsFrom(x, y);
137 } 146 }
@@ -172,9 +181,9 @@ namespace OpenSim.Region.Environment.Types
172 } 181 }
173 else 182 else
174 { 183 {
175 if (x < m_leftX + (m_width / 2)) 184 if (x < m_leftX + (m_width/2))
176 { 185 {
177 if (y < m_leftY + (m_height / 2)) 186 if (y < m_leftY + (m_height/2))
178 { 187 {
179 return m_childNodes[0].GetNodeID(x, y); 188 return m_childNodes[0].GetNodeID(x, y);
180 } 189 }
@@ -185,7 +194,7 @@ namespace OpenSim.Region.Environment.Types
185 } 194 }
186 else 195 else
187 { 196 {
188 if (y < m_leftY + (m_height / 2)) 197 if (y < m_leftY + (m_height/2))
189 { 198 {
190 return m_childNodes[1].GetNodeID(x, y); 199 return m_childNodes[1].GetNodeID(x, y);
191 } 200 }
@@ -211,7 +220,8 @@ namespace OpenSim.Region.Environment.Types
211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 220 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
212 foreach (SceneObjectGroup group in m_objects) 221 foreach (SceneObjectGroup group in m_objects)
213 { 222 {
214 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)))) 223 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
224 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
215 { 225 {
216 //still in bounds 226 //still in bounds
217 } 227 }
@@ -235,7 +245,8 @@ namespace OpenSim.Region.Environment.Types
235 245
236 public void PassUp(SceneObjectGroup group) 246 public void PassUp(SceneObjectGroup group)
237 { 247 {
238 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)))) 248 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
249 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
239 { 250 {
240 AddObject(group); 251 AddObject(group);
241 } 252 }
@@ -255,4 +266,4 @@ namespace OpenSim.Region.Environment.Types
255 return retVal; 266 return retVal;
256 } 267 }
257 } 268 }
258} 269} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index 442e9d5..0648476 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -76,4 +76,4 @@ namespace OpenSim.Region.Environment.Types
76 return part; 76 return part;
77 } 77 }
78 } 78 }
79} 79} \ No newline at end of file