aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMW2007-11-13 12:23:05 +0000
committerMW2007-11-13 12:23:05 +0000
commit297cc7ef4f44dc783ebee817f48c205b04aa68f7 (patch)
treed401f5e38d03a0ff8bb4996c9bfed8ae7962f5c9 /OpenSim/Region/Environment/Scenes/Scene.cs
parentSome work on being able to set/send a users Buddylist info. (added handling c... (diff)
downloadopensim-SC-297cc7ef4f44dc783ebee817f48c205b04aa68f7.zip
opensim-SC-297cc7ef4f44dc783ebee817f48c205b04aa68f7.tar.gz
opensim-SC-297cc7ef4f44dc783ebee817f48c205b04aa68f7.tar.bz2
opensim-SC-297cc7ef4f44dc783ebee817f48c205b04aa68f7.tar.xz
Some work on cleanly removing Regions.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs67
1 files changed, 41 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b4c8b68..2d58b0e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -47,7 +47,7 @@ using 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;
51 51
52namespace OpenSim.Region.Environment.Scenes 52namespace OpenSim.Region.Environment.Scenes
53{ 53{
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
195 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim) 195 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim)
196 { 196 {
197 updateLock = new Mutex(false); 197 updateLock = new Mutex(false);
198 198
199 m_moduleLoader = moduleLoader; 199 m_moduleLoader = moduleLoader;
200 m_authenticateHandler = authen; 200 m_authenticateHandler = authen;
201 CommsManager = commsMan; 201 CommsManager = commsMan;
@@ -228,7 +228,7 @@ namespace OpenSim.Region.Environment.Scenes
228 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 228 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
229 229
230 MainLog.Instance.Verbose("Creating LandMap"); 230 MainLog.Instance.Verbose("Creating LandMap");
231 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); 231 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
232 232
233 ScenePresence.LoadAnims(); 233 ScenePresence.LoadAnims();
234 234
@@ -241,11 +241,26 @@ namespace OpenSim.Region.Environment.Scenes
241 #region Startup / Close Methods 241 #region Startup / Close Methods
242 public override void Close() 242 public override void Close()
243 { 243 {
244 ForEachScenePresence(delegate(ScenePresence avatar)
245 {
246 avatar.ControllingClient.Stop();
247 });
248
244 m_heartbeatTimer.Close(); 249 m_heartbeatTimer.Close();
245 m_innerScene.Close(); 250 m_innerScene.Close();
246 m_sceneGridService.Close(); 251 m_sceneGridService.Close();
247 252
253 foreach (IRegionModule module in this.Modules.Values)
254 {
255 if (!module.IsSharedModule)
256 {
257 module.Close();
258 }
259 }
260 Modules.Clear();
261
248 base.Close(); 262 base.Close();
263
249 } 264 }
250 265
251 /// <summary> 266 /// <summary>
@@ -299,30 +314,30 @@ namespace OpenSim.Region.Environment.Scenes
299 if (m_frame == Int32.MaxValue) 314 if (m_frame == Int32.MaxValue)
300 m_frame = 0; 315 m_frame = 0;
301 316
302 if (m_frame%m_update_physics == 0) 317 if (m_frame % m_update_physics == 0)
303 m_innerScene.UpdatePreparePhysics(); 318 m_innerScene.UpdatePreparePhysics();
304 319
305 if (m_frame%m_update_entitymovement == 0) 320 if (m_frame % m_update_entitymovement == 0)
306 m_innerScene.UpdateEntityMovement(); 321 m_innerScene.UpdateEntityMovement();
307 322
308 if (m_frame%m_update_physics == 0) 323 if (m_frame % m_update_physics == 0)
309 m_innerScene.UpdatePhysics( 324 m_innerScene.UpdatePhysics(
310 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 325 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
311 ); 326 );
312 327
313 if (m_frame%m_update_entities == 0) 328 if (m_frame % m_update_entities == 0)
314 m_innerScene.UpdateEntities(); 329 m_innerScene.UpdateEntities();
315 330
316 if (m_frame%m_update_events == 0) 331 if (m_frame % m_update_events == 0)
317 UpdateEvents(); 332 UpdateEvents();
318 333
319 if (m_frame%m_update_backup == 0) 334 if (m_frame % m_update_backup == 0)
320 UpdateStorageBackup(); 335 UpdateStorageBackup();
321 336
322 if (m_frame%m_update_terrain == 0) 337 if (m_frame % m_update_terrain == 0)
323 UpdateTerrain(); 338 UpdateTerrain();
324 339
325 if (m_frame%m_update_land == 0) 340 if (m_frame % m_update_land == 0)
326 UpdateLand(); 341 UpdateLand();
327 342
328 // if (m_frame%m_update_avatars == 0) 343 // if (m_frame%m_update_avatars == 0)
@@ -340,7 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
340 { 355 {
341 updateLock.ReleaseMutex(); 356 updateLock.ReleaseMutex();
342 357
343 m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds; 358 m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds;
344 m_lastupdate = DateTime.Now; 359 m_lastupdate = DateTime.Now;
345 } 360 }
346 } 361 }
@@ -397,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
397 { 412 {
398 for (int y = 0; y < 16; y++) 413 for (int y = 0; y < 16; y++)
399 { 414 {
400 if (Terrain.Tainted(x*16, y*16)) 415 if (Terrain.Tainted(x * 16, y * 16))
401 { 416 {
402 client.SendLayerData(x, y, terData); 417 client.SendLayerData(x, y, terData);
403 } 418 }
@@ -524,7 +539,7 @@ namespace OpenSim.Region.Environment.Scenes
524 AddEntityFromStorage(prim); 539 AddEntityFromStorage(prim);
525 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 540 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
526 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 541 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
527 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 542 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
528 rootPart.PhysActor = phyScene.AddPrimShape( 543 rootPart.PhysActor = phyScene.AddPrimShape(
529 rootPart.Name, 544 rootPart.Name,
530 rootPart.Shape, 545 rootPart.Shape,
@@ -570,11 +585,11 @@ namespace OpenSim.Region.Environment.Scenes
570 // if grass or tree, make phantom 585 // if grass or tree, make phantom
571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) 586 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
572 { 587 {
573 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom; 588 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
574 } 589 }
575 // if not phantom, add to physics 590 // if not phantom, add to physics
576 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 591 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
577 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 592 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
578 rootPart.PhysActor = 593 rootPart.PhysActor =
579 phyScene.AddPrimShape( 594 phyScene.AddPrimShape(
580 rootPart.Name, 595 rootPart.Name,
@@ -668,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
668 client.OnRegionHandShakeReply += SendLayerData; 683 client.OnRegionHandShakeReply += SendLayerData;
669 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); 684 //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
670 client.OnModifyTerrain += ModifyTerrain; 685 client.OnModifyTerrain += ModifyTerrain;
671 // client.OnRequestWearables += InformClientOfNeighbours; 686 // client.OnRequestWearables += InformClientOfNeighbours;
672 client.OnAddPrim += AddNewPrim; 687 client.OnAddPrim += AddNewPrim;
673 client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition; 688 client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition;
674 client.OnUpdatePrimSinglePosition += m_innerScene.UpdatePrimSinglePosition; 689 client.OnUpdatePrimSinglePosition += m_innerScene.UpdatePrimSinglePosition;
@@ -843,7 +858,7 @@ namespace OpenSim.Region.Environment.Scenes
843 if (m_capsHandlers.ContainsKey(agent.AgentID)) 858 if (m_capsHandlers.ContainsKey(agent.AgentID))
844 { 859 {
845 //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + 860 //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
846 // agent.AgentID.ToStringHyphenated()); 861 // agent.AgentID.ToStringHyphenated());
847 m_capsHandlers[agent.AgentID] = cap; 862 m_capsHandlers[agent.AgentID] = cap;
848 } 863 }
849 else 864 else
@@ -871,7 +886,7 @@ namespace OpenSim.Region.Environment.Scenes
871 if (regionHandle == m_regionHandle) 886 if (regionHandle == m_regionHandle)
872 { 887 {
873 ScenePresence presence = m_innerScene.GetScenePresence(agentID); 888 ScenePresence presence = m_innerScene.GetScenePresence(agentID);
874 if(presence != null) 889 if (presence != null)
875 { 890 {
876 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); 891 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket();
877 presence.ControllingClient.OutPacket(disable); 892 presence.ControllingClient.OutPacket(disable);
@@ -879,7 +894,7 @@ namespace OpenSim.Region.Environment.Scenes
879 } 894 }
880 } 895 }
881 896
882 897
883 /// <summary> 898 /// <summary>
884 /// 899 ///
885 /// </summary> 900 /// </summary>
@@ -951,17 +966,17 @@ namespace OpenSim.Region.Environment.Scenes
951 966
952 public void RegisterModuleInterface<M>(M mod) 967 public void RegisterModuleInterface<M>(M mod)
953 { 968 {
954 if (!ModuleInterfaces.ContainsKey(typeof (M))) 969 if (!ModuleInterfaces.ContainsKey(typeof(M)))
955 { 970 {
956 ModuleInterfaces.Add(typeof (M), mod); 971 ModuleInterfaces.Add(typeof(M), mod);
957 } 972 }
958 } 973 }
959 974
960 public T RequestModuleInterface<T>() 975 public T RequestModuleInterface<T>()
961 { 976 {
962 if (ModuleInterfaces.ContainsKey(typeof (T))) 977 if (ModuleInterfaces.ContainsKey(typeof(T)))
963 { 978 {
964 return (T) ModuleInterfaces[typeof (T)]; 979 return (T)ModuleInterfaces[typeof(T)];
965 } 980 }
966 else 981 else
967 { 982 {
@@ -1073,7 +1088,7 @@ namespace OpenSim.Region.Environment.Scenes
1073 { 1088 {
1074 if (ent is SceneObjectGroup) 1089 if (ent is SceneObjectGroup)
1075 { 1090 {
1076 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); 1091 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
1077 } 1092 }
1078 } 1093 }
1079 } 1094 }
@@ -1085,7 +1100,7 @@ namespace OpenSim.Region.Environment.Scenes
1085 { 1100 {
1086 if (ent is SceneObjectGroup) 1101 if (ent is SceneObjectGroup)
1087 { 1102 {
1088 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID); 1103 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
1089 if (part != null) 1104 if (part != null)
1090 { 1105 {
1091 if (part.Name == cmmdparams[0]) 1106 if (part.Name == cmmdparams[0])