diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 845de22..43e7e99 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -54,6 +54,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
54 | 54 | ||
55 | public partial class Scene : SceneBase | 55 | public partial class Scene : SceneBase |
56 | { | 56 | { |
57 | public delegate void SynchronizeSceneHandler(Scene scene); | ||
58 | public SynchronizeSceneHandler SynchronizeScene = null; | ||
59 | public int splitID = 0; | ||
60 | |||
57 | #region Fields | 61 | #region Fields |
58 | 62 | ||
59 | protected Timer m_heartbeatTimer = new Timer(); | 63 | protected Timer m_heartbeatTimer = new Timer(); |
@@ -216,7 +220,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | get { return m_innerScene.Entities; } | 220 | get { return m_innerScene.Entities; } |
217 | set { m_innerScene.Entities = value; } | 221 | set { m_innerScene.Entities = value; } |
218 | } | 222 | } |
219 | 223 | public Dictionary<LLUUID, ScenePresence> m_restorePresences | |
224 | { | ||
225 | get { return m_innerScene.RestorePresences; } | ||
226 | set { m_innerScene.RestorePresences = value; } | ||
227 | } | ||
220 | #endregion | 228 | #endregion |
221 | 229 | ||
222 | #region Constructors | 230 | #region Constructors |
@@ -276,6 +284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
276 | Entities = new Dictionary<LLUUID, EntityBase>(); | 284 | Entities = new Dictionary<LLUUID, EntityBase>(); |
277 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); | 285 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); |
278 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); | 286 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); |
287 | m_restorePresences = new Dictionary<LLUUID, ScenePresence>(); | ||
279 | 288 | ||
280 | m_log.Info("[SCENE]: Creating LandMap"); | 289 | m_log.Info("[SCENE]: Creating LandMap"); |
281 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); | 290 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); |
@@ -701,6 +710,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | physicsFPS = m_innerScene.UpdatePhysics( | 710 | physicsFPS = m_innerScene.UpdatePhysics( |
702 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 711 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) |
703 | ); | 712 | ); |
713 | if (m_frame % m_update_physics == 0 && SynchronizeScene != null) | ||
714 | SynchronizeScene(this); | ||
704 | 715 | ||
705 | physicsMS = System.Environment.TickCount - physicsMS; | 716 | physicsMS = System.Environment.TickCount - physicsMS; |
706 | physicsMS += physicsMS2; | 717 | physicsMS += physicsMS2; |
@@ -719,6 +730,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
719 | if (m_frame % m_update_presences == 0) | 730 | if (m_frame % m_update_presences == 0) |
720 | m_innerScene.UpdatePresences(); | 731 | m_innerScene.UpdatePresences(); |
721 | 732 | ||
733 | if (Region_Status != RegionStatus.SlaveScene) | ||
734 | { | ||
722 | if (m_frame % m_update_events == 0) | 735 | if (m_frame % m_update_events == 0) |
723 | UpdateEvents(); | 736 | UpdateEvents(); |
724 | 737 | ||
@@ -747,7 +760,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
747 | m_statsReporter.addOtherMS(otherMS); | 760 | m_statsReporter.addOtherMS(otherMS); |
748 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); | 761 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); |
749 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); | 762 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); |
750 | 763 | } | |
751 | } | 764 | } |
752 | catch (NotImplementedException) | 765 | catch (NotImplementedException) |
753 | { | 766 | { |
@@ -1058,10 +1071,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1058 | 1071 | ||
1059 | #region Load Land | 1072 | #region Load Land |
1060 | 1073 | ||
1061 | public void loadAllLandObjectsFromStorage() | 1074 | public void loadAllLandObjectsFromStorage(LLUUID regionID) |
1062 | { | 1075 | { |
1063 | m_log.Info("[SCENE]: Loading land objects from storage"); | 1076 | m_log.Info("[SCENE]: Loading land objects from storage"); |
1064 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); | 1077 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); |
1065 | 1078 | ||
1066 | if (landData.Count == 0) | 1079 | if (landData.Count == 0) |
1067 | { | 1080 | { |
@@ -1080,11 +1093,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1080 | /// <summary> | 1093 | /// <summary> |
1081 | /// Loads the World's objects | 1094 | /// Loads the World's objects |
1082 | /// </summary> | 1095 | /// </summary> |
1083 | public virtual void LoadPrimsFromStorage(bool m_permissions) | 1096 | public virtual void LoadPrimsFromStorage(bool m_permissions, LLUUID regionID) |
1084 | { | 1097 | { |
1085 | m_log.Info("[SCENE]: Loading objects from datastore"); | 1098 | m_log.Info("[SCENE]: Loading objects from datastore"); |
1086 | 1099 | ||
1087 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); | 1100 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); |
1088 | foreach (SceneObjectGroup group in PrimsFromDB) | 1101 | foreach (SceneObjectGroup group in PrimsFromDB) |
1089 | { | 1102 | { |
1090 | AddEntityFromStorage(group); | 1103 | AddEntityFromStorage(group); |
@@ -1339,13 +1352,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
1339 | { | 1352 | { |
1340 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); | 1353 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); |
1341 | SubscribeToClientEvents(client); | 1354 | SubscribeToClientEvents(client); |
1355 | ScenePresence presence = null; | ||
1356 | |||
1357 | if (m_restorePresences.ContainsKey(client.AgentId)) | ||
1358 | { | ||
1359 | m_log.Info("REGION Restore Scene Presence"); | ||
1360 | |||
1361 | presence = m_restorePresences[client.AgentId]; | ||
1362 | m_restorePresences.Remove(client.AgentId); | ||
1363 | |||
1364 | presence.initializeScenePresence(client, RegionInfo, this); | ||
1365 | |||
1366 | m_innerScene.AddScenePresence(presence); | ||
1342 | 1367 | ||
1343 | m_estateManager.sendRegionHandshake(client); | 1368 | lock (m_restorePresences) |
1369 | { | ||
1370 | Monitor.PulseAll(m_restorePresences); | ||
1371 | } | ||
1372 | } | ||
1373 | else | ||
1374 | { | ||
1375 | m_log.Info("REGION Add New Scene Presence"); | ||
1344 | 1376 | ||
1345 | CreateAndAddScenePresence(client, child); | 1377 | m_estateManager.sendRegionHandshake(client); |
1346 | 1378 | ||
1347 | m_LandManager.sendParcelOverlay(client); | 1379 | CreateAndAddScenePresence(client, child); |
1348 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 1380 | |
1381 | m_LandManager.sendParcelOverlay(client); | ||
1382 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | ||
1383 | } | ||
1349 | } | 1384 | } |
1350 | 1385 | ||
1351 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 1386 | protected virtual void SubscribeToClientEvents(IClientAPI client) |