aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs448
1 files changed, 207 insertions, 241 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c7a38f7..40a57a4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -68,14 +68,84 @@ namespace OpenSim.Region.Framework.Scenes
68 public bool EmergencyMonitoring = false; 68 public bool EmergencyMonitoring = false;
69 69
70 /// <summary> 70 /// <summary>
71 /// Show debug information about animations.
72 /// </summary>
73 public bool DebugAnimations { get; set; }
74
75 /// <summary>
71 /// Show debug information about teleports. 76 /// Show debug information about teleports.
72 /// </summary> 77 /// </summary>
73 public bool DebugTeleporting { get; private set; } 78 public bool DebugTeleporting { get; set; }
74 79
75 /// <summary> 80 /// <summary>
76 /// Show debug information about the scene loop. 81 /// Show debug information about the scene loop.
77 /// </summary> 82 /// </summary>
78 public bool DebugUpdates { get; private set; } 83 public bool DebugUpdates { get; set; }
84
85 /// <summary>
86 /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
87 /// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter).
88 /// </summary>
89 /// <remarks>
90 /// Even if false, the scene will still be saved on clean shutdown.
91 /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels.
92 /// This needs to be fixed.
93 /// </remarks>
94 public bool PeriodicBackup { get; set; }
95
96 /// <summary>
97 /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even
98 /// if the scene is being shut down for the final time.
99 /// </summary>
100 public bool UseBackup { get; set; }
101
102 /// <summary>
103 /// If false then physical objects are disabled, though collisions will continue as normal.
104 /// </summary>
105 public bool PhysicsEnabled { get; set; }
106
107 /// <summary>
108 /// If false then scripts are not enabled on the smiulator
109 /// </summary>
110 public bool ScriptsEnabled
111 {
112 get { return m_scripts_enabled; }
113 set
114 {
115 if (m_scripts_enabled != value)
116 {
117 if (!value)
118 {
119 m_log.Info("Stopping all Scripts in Scene");
120
121 EntityBase[] entities = Entities.GetEntities();
122 foreach (EntityBase ent in entities)
123 {
124 if (ent is SceneObjectGroup)
125 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
126 }
127 }
128 else
129 {
130 m_log.Info("Starting all Scripts in Scene");
131
132 EntityBase[] entities = Entities.GetEntities();
133 foreach (EntityBase ent in entities)
134 {
135 if (ent is SceneObjectGroup)
136 {
137 SceneObjectGroup sog = (SceneObjectGroup)ent;
138 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
139 sog.ResumeScripts();
140 }
141 }
142 }
143
144 m_scripts_enabled = value;
145 }
146 }
147 }
148 private bool m_scripts_enabled;
79 149
80 public SynchronizeSceneHandler SynchronizeScene; 150 public SynchronizeSceneHandler SynchronizeScene;
81 151
@@ -284,8 +354,6 @@ namespace OpenSim.Region.Framework.Scenes
284 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 354 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
285 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); 355 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>();
286 356
287 private bool m_physics_enabled = true;
288 private bool m_scripts_enabled = true;
289 private string m_defaultScriptEngine; 357 private string m_defaultScriptEngine;
290 358
291 /// <summary> 359 /// <summary>
@@ -348,7 +416,6 @@ namespace OpenSim.Region.Framework.Scenes
348 416
349 private Timer m_mapGenerationTimer = new Timer(); 417 private Timer m_mapGenerationTimer = new Timer();
350 private bool m_generateMaptiles; 418 private bool m_generateMaptiles;
351 private bool m_useBackup = true;
352 419
353 #endregion Fields 420 #endregion Fields
354 421
@@ -614,11 +681,6 @@ namespace OpenSim.Region.Framework.Scenes
614 get { return m_authenticateHandler; } 681 get { return m_authenticateHandler; }
615 } 682 }
616 683
617 public bool UseBackup
618 {
619 get { return m_useBackup; }
620 }
621
622 // an instance to the physics plugin's Scene object. 684 // an instance to the physics plugin's Scene object.
623 public PhysicsScene PhysicsScene 685 public PhysicsScene PhysicsScene
624 { 686 {
@@ -762,15 +824,22 @@ namespace OpenSim.Region.Framework.Scenes
762 // 824 //
763 // Out of memory 825 // Out of memory
764 // Operating system has killed the plugin 826 // Operating system has killed the plugin
765 m_sceneGraph.UnRecoverableError += RestartNow; 827 m_sceneGraph.UnRecoverableError
828 += () =>
829 {
830 m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
831 RestartNow();
832 };
766 833
767 RegisterDefaultSceneEvents(); 834 RegisterDefaultSceneEvents();
768 835
769 DumpAssetsToFile = dumpAssetsToFile; 836 DumpAssetsToFile = dumpAssetsToFile;
770 837
838 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
839 // better in the future.
771 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 840 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
772 841
773 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 842 PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
774 843
775 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; 844 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
776 845
@@ -778,141 +847,139 @@ namespace OpenSim.Region.Framework.Scenes
778 847
779 // Region config overrides global config 848 // Region config overrides global config
780 // 849 //
781 try 850 if (m_config.Configs["Startup"] != null)
782 { 851 {
783 if (m_config.Configs["Startup"] != null) 852 IConfig startupConfig = m_config.Configs["Startup"];
784 {
785 IConfig startupConfig = m_config.Configs["Startup"];
786 853
787 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 854 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
788 855
789 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 856 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
790 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 857 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
791 if (!m_useBackup) 858 if (!UseBackup)
792 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 859 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
793 860
794 //Animation states 861 //Animation states
795 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 862 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
796 863
797 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 864 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
798 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 865 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
799 866
800 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 867 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
801 if (RegionInfo.NonphysPrimMin > 0) 868 if (RegionInfo.NonphysPrimMin > 0)
802 { 869 {
803 m_minNonphys = RegionInfo.NonphysPrimMin; 870 m_minNonphys = RegionInfo.NonphysPrimMin;
804 } 871 }
805 872
806 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 873 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
807 if (RegionInfo.NonphysPrimMax > 0) 874 if (RegionInfo.NonphysPrimMax > 0)
808 { 875 {
809 m_maxNonphys = RegionInfo.NonphysPrimMax; 876 m_maxNonphys = RegionInfo.NonphysPrimMax;
810 } 877 }
811 878
812 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); 879 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
813 if (RegionInfo.PhysPrimMin > 0) 880 if (RegionInfo.PhysPrimMin > 0)
814 { 881 {
815 m_minPhys = RegionInfo.PhysPrimMin; 882 m_minPhys = RegionInfo.PhysPrimMin;
816 } 883 }
817 884
818 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 885 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
819 886
820 if (RegionInfo.PhysPrimMax > 0) 887 if (RegionInfo.PhysPrimMax > 0)
821 { 888 {
822 m_maxPhys = RegionInfo.PhysPrimMax; 889 m_maxPhys = RegionInfo.PhysPrimMax;
823 } 890 }
824 891
825 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); 892 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
826 if (RegionInfo.LinksetCapacity > 0) 893 if (RegionInfo.LinksetCapacity > 0)
827 { 894 {
828 m_linksetCapacity = RegionInfo.LinksetCapacity; 895 m_linksetCapacity = RegionInfo.LinksetCapacity;
829 } 896 }
830 897
831 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 898 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
832 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 899 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
833 900
834 // Here, if clamping is requested in either global or 901 // Here, if clamping is requested in either global or
835 // local config, it will be used 902 // local config, it will be used
836 // 903 //
837 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 904 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
838 if (RegionInfo.ClampPrimSize) 905 if (RegionInfo.ClampPrimSize)
906 {
907 m_clampPrimSize = true;
908 }
909
910 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
911 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
912 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
913 m_dontPersistBefore =
914 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
915 m_dontPersistBefore *= 10000000;
916 m_persistAfter =
917 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
918 m_persistAfter *= 10000000;
919
920 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
921 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
922
923 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
924 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
925 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
926
927 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
928 if (m_generateMaptiles)
929 {
930 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
931 if (maptileRefresh != 0)
839 { 932 {
840 m_clampPrimSize = true; 933 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
934 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
935 m_mapGenerationTimer.AutoReset = true;
936 m_mapGenerationTimer.Start();
841 } 937 }
938 }
939 else
940 {
941 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
942 UUID tileID;
842 943
843 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 944 if ((tile!=UUID.Zero.ToString()) && UUID.TryParse(tile, out tileID))
844 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
845 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
846 m_dontPersistBefore =
847 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
848 m_dontPersistBefore *= 10000000;
849 m_persistAfter =
850 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
851 m_persistAfter *= 10000000;
852
853 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
854 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
855
856 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
857 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
858 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
859
860 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
861 if (m_generateMaptiles)
862 { 945 {
863 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 946 RegionInfo.RegionSettings.TerrainImageID = tileID;
864 if (maptileRefresh != 0)
865 {
866 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
867 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
868 m_mapGenerationTimer.AutoReset = true;
869 m_mapGenerationTimer.Start();
870 }
871 } 947 }
872 else 948 else
873 { 949 {
874 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 950 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
875 UUID tileID; 951 m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
876
877 if (UUID.TryParse(tile, out tileID))
878 {
879 RegionInfo.RegionSettings.TerrainImageID = tileID;
880 }
881 } 952 }
953 }
882 954
883 string grant = startupConfig.GetString("AllowedClients", String.Empty); 955 string grant = startupConfig.GetString("AllowedClients", String.Empty);
884 if (grant.Length > 0) 956 if (grant.Length > 0)
957 {
958 foreach (string viewer in grant.Split(','))
885 { 959 {
886 foreach (string viewer in grant.Split(',')) 960 m_AllowedViewers.Add(viewer.Trim().ToLower());
887 {
888 m_AllowedViewers.Add(viewer.Trim().ToLower());
889 }
890 } 961 }
962 }
891 963
892 grant = startupConfig.GetString("BannedClients", String.Empty); 964 grant = startupConfig.GetString("BannedClients", String.Empty);
893 if (grant.Length > 0) 965 if (grant.Length > 0)
966 {
967 foreach (string viewer in grant.Split(','))
894 { 968 {
895 foreach (string viewer in grant.Split(',')) 969 m_BannedViewers.Add(viewer.Trim().ToLower());
896 {
897 m_BannedViewers.Add(viewer.Trim().ToLower());
898 }
899 } 970 }
900
901 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
902 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
903 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
904 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
905 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
906 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
907 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
908 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
909 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
910 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
911 } 971 }
912 } 972
913 catch (Exception e) 973 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
914 { 974 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
915 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); 975 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
976 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
977 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
978 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
979 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
980 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
981 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
982 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
916 } 983 }
917 984
918 // FIXME: Ultimately this should be in a module. 985 // FIXME: Ultimately this should be in a module.
@@ -965,6 +1032,10 @@ namespace OpenSim.Region.Framework.Scenes
965 { 1032 {
966 PhysicalPrims = true; 1033 PhysicalPrims = true;
967 CollidablePrims = true; 1034 CollidablePrims = true;
1035 PhysicsEnabled = true;
1036
1037 PeriodicBackup = true;
1038 UseBackup = true;
968 1039
969 BordersLocked = true; 1040 BordersLocked = true;
970 Border northBorder = new Border(); 1041 Border northBorder = new Border();
@@ -1207,83 +1278,6 @@ namespace OpenSim.Region.Framework.Scenes
1207 } 1278 }
1208 } 1279 }
1209 1280
1210 public void SetSceneCoreDebug(Dictionary<string, string> options)
1211 {
1212 if (options.ContainsKey("active"))
1213 {
1214 bool active;
1215
1216 if (bool.TryParse(options["active"], out active))
1217 Active = active;
1218 }
1219
1220 if (options.ContainsKey("scripting"))
1221 {
1222 bool enableScripts = true;
1223 if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
1224 {
1225 if (!enableScripts)
1226 {
1227 m_log.Info("Stopping all Scripts in Scene");
1228
1229 EntityBase[] entities = Entities.GetEntities();
1230 foreach (EntityBase ent in entities)
1231 {
1232 if (ent is SceneObjectGroup)
1233 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1234 }
1235 }
1236 else
1237 {
1238 m_log.Info("Starting all Scripts in Scene");
1239
1240 EntityBase[] entities = Entities.GetEntities();
1241 foreach (EntityBase ent in entities)
1242 {
1243 if (ent is SceneObjectGroup)
1244 {
1245 SceneObjectGroup sog = (SceneObjectGroup)ent;
1246 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1247 sog.ResumeScripts();
1248 }
1249 }
1250 }
1251
1252 m_scripts_enabled = enableScripts;
1253 }
1254 }
1255
1256 if (options.ContainsKey("physics"))
1257 {
1258 bool enablePhysics;
1259 if (bool.TryParse(options["physics"], out enablePhysics))
1260 m_physics_enabled = enablePhysics;
1261 }
1262
1263// if (options.ContainsKey("collisions"))
1264// {
1265// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
1266// // the avatar themselves to collide with the ground.
1267// }
1268
1269 if (options.ContainsKey("teleport"))
1270 {
1271 bool enableTeleportDebugging;
1272 if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
1273 DebugTeleporting = enableTeleportDebugging;
1274 }
1275
1276 if (options.ContainsKey("updates"))
1277 {
1278 bool enableUpdateDebugging;
1279 if (bool.TryParse(options["updates"], out enableUpdateDebugging))
1280 {
1281 DebugUpdates = enableUpdateDebugging;
1282 GcNotify.Enabled = DebugUpdates;
1283 }
1284 }
1285 }
1286
1287 public int GetInaccurateNeighborCount() 1281 public int GetInaccurateNeighborCount()
1288 { 1282 {
1289 return m_neighbours.Count; 1283 return m_neighbours.Count;
@@ -1332,16 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
1332 1326
1333 m_log.Debug("[SCENE]: Persisting changed objects"); 1327 m_log.Debug("[SCENE]: Persisting changed objects");
1334 1328
1335 EntityBase[] entities = GetEntities(); 1329 Backup(false);
1336 foreach (EntityBase entity in entities)
1337 {
1338 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
1339 {
1340 ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
1341 }
1342 }
1343
1344 m_log.Debug("[SCENE]: Graph close");
1345 m_sceneGraph.Close(); 1330 m_sceneGraph.Close();
1346 1331
1347 if (!GridService.DeregisterRegion(RegionInfo.RegionID)) 1332 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
@@ -1568,7 +1553,7 @@ namespace OpenSim.Region.Framework.Scenes
1568 } 1553 }
1569 1554
1570 tmpMS = Util.EnvironmentTickCount(); 1555 tmpMS = Util.EnvironmentTickCount();
1571 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1556 if (PhysicsEnabled && Frame % m_update_physics == 0)
1572 m_sceneGraph.UpdatePreparePhysics(); 1557 m_sceneGraph.UpdatePreparePhysics();
1573 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1558 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1574 1559
@@ -1583,7 +1568,7 @@ namespace OpenSim.Region.Framework.Scenes
1583 tmpMS = Util.EnvironmentTickCount(); 1568 tmpMS = Util.EnvironmentTickCount();
1584 if (Frame % m_update_physics == 0) 1569 if (Frame % m_update_physics == 0)
1585 { 1570 {
1586 if (m_physics_enabled) 1571 if (PhysicsEnabled)
1587 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1572 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1588 1573
1589 if (SynchronizeScene != null) 1574 if (SynchronizeScene != null)
@@ -1625,7 +1610,7 @@ namespace OpenSim.Region.Framework.Scenes
1625 eventMS = Util.EnvironmentTickCountSubtract(tmpMS); 1610 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1626 } 1611 }
1627 1612
1628 if (Frame % m_update_backup == 0) 1613 if (PeriodicBackup && Frame % m_update_backup == 0)
1629 { 1614 {
1630 tmpMS = Util.EnvironmentTickCount(); 1615 tmpMS = Util.EnvironmentTickCount();
1631 UpdateStorageBackup(); 1616 UpdateStorageBackup();
@@ -5621,33 +5606,7 @@ Environment.Exit(1);
5621 5606
5622 public void TriggerEstateSunUpdate() 5607 public void TriggerEstateSunUpdate()
5623 { 5608 {
5624 float sun; 5609 EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle);
5625 if (RegionInfo.RegionSettings.UseEstateSun)
5626 {
5627 sun = (float)RegionInfo.EstateSettings.SunPosition;
5628 if (RegionInfo.EstateSettings.UseGlobalTime)
5629 {
5630 sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
5631 }
5632
5633 //
5634 EventManager.TriggerEstateToolsSunUpdate(
5635 RegionInfo.RegionHandle,
5636 RegionInfo.EstateSettings.FixedSun,
5637 RegionInfo.RegionSettings.UseEstateSun,
5638 sun);
5639 }
5640 else
5641 {
5642 // Use the Sun Position from the Region Settings
5643 sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
5644
5645 EventManager.TriggerEstateToolsSunUpdate(
5646 RegionInfo.RegionHandle,
5647 RegionInfo.RegionSettings.FixedSun,
5648 RegionInfo.RegionSettings.UseEstateSun,
5649 sun);
5650 }
5651 } 5610 }
5652 5611
5653 private void HandleReloadEstate(string module, string[] cmd) 5612 private void HandleReloadEstate(string module, string[] cmd)
@@ -6043,10 +6002,17 @@ Environment.Exit(1);
6043 GC.Collect(); 6002 GC.Collect();
6044 } 6003 }
6045 6004
6046 // Wrappers to get physics modules retrieve assets. Has to be done this way 6005 /// <summary>
6047 // because we can't assign the asset service to physics directly - at the 6006 /// Wrappers to get physics modules retrieve assets.
6048 // time physics are instantiated it's not registered but it will be by 6007 /// </summary>
6049 // the time the first prim exists. 6008 /// <remarks>
6009 /// Has to be done this way
6010 /// because we can't assign the asset service to physics directly - at the
6011 /// time physics are instantiated it's not registered but it will be by
6012 /// the time the first prim exists.
6013 /// </remarks>
6014 /// <param name="assetID"></param>
6015 /// <param name="callback"></param>
6050 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) 6016 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
6051 { 6017 {
6052 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); 6018 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);