diff options
Some work on cleanly removing Regions.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 67 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 1 |
3 files changed, 71 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; | |||
47 | using OpenSim.Region.Environment.Types; | 47 | using OpenSim.Region.Environment.Types; |
48 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
49 | using OpenSim.Region.Terrain; | 49 | using OpenSim.Region.Terrain; |
50 | using Timer=System.Timers.Timer; | 50 | using Timer = System.Timers.Timer; |
51 | 51 | ||
52 | namespace OpenSim.Region.Environment.Scenes | 52 | namespace 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]) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 75e2a41..da553bc 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -179,6 +179,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | public bool TryGetScene(string regionName, out Scene scene) | ||
183 | { | ||
184 | foreach (Scene mscene in m_localScenes) | ||
185 | { | ||
186 | if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) | ||
187 | { | ||
188 | scene = mscene; | ||
189 | return true; | ||
190 | } | ||
191 | } | ||
192 | scene = null; | ||
193 | return false; | ||
194 | } | ||
195 | |||
196 | public bool TryGetScene(LLUUID regionID, out Scene scene) | ||
197 | { | ||
198 | foreach (Scene mscene in m_localScenes) | ||
199 | { | ||
200 | if (mscene.RegionInfo.RegionID == regionID) | ||
201 | { | ||
202 | scene = mscene; | ||
203 | return true; | ||
204 | } | ||
205 | } | ||
206 | scene = null; | ||
207 | return false; | ||
208 | } | ||
209 | |||
210 | |||
182 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) | 211 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) |
183 | { | 212 | { |
184 | ForEachCurrentScene(delegate(Scene scene) | 213 | ForEachCurrentScene(delegate(Scene scene) |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 48f3ef0..cfa4ffe 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1197,6 +1197,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1197 | { | 1197 | { |
1198 | m_wearables[wearableId] = wearable; | 1198 | m_wearables[wearableId] = wearable; |
1199 | SendOwnWearables(); | 1199 | SendOwnWearables(); |
1200 | |||
1200 | } | 1201 | } |
1201 | 1202 | ||
1202 | private void SendOwnWearables() | 1203 | private void SendOwnWearables() |