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.cs473
1 files changed, 214 insertions, 259 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e58aadc..1a1c3d2 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 {
@@ -678,7 +740,6 @@ namespace OpenSim.Region.Framework.Scenes
678 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 740 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
679 SceneCommunicationService sceneGridService, 741 SceneCommunicationService sceneGridService,
680 ISimulationDataService simDataService, IEstateDataService estateDataService, 742 ISimulationDataService simDataService, IEstateDataService estateDataService,
681 bool dumpAssetsToFile,
682 IConfigSource config, string simulatorVersion) 743 IConfigSource config, string simulatorVersion)
683 : this(regInfo) 744 : this(regInfo)
684 { 745 {
@@ -762,15 +823,20 @@ namespace OpenSim.Region.Framework.Scenes
762 // 823 //
763 // Out of memory 824 // Out of memory
764 // Operating system has killed the plugin 825 // Operating system has killed the plugin
765 m_sceneGraph.UnRecoverableError += RestartNow; 826 m_sceneGraph.UnRecoverableError
827 += () =>
828 {
829 m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
830 RestartNow();
831 };
766 832
767 RegisterDefaultSceneEvents(); 833 RegisterDefaultSceneEvents();
768 834
769 DumpAssetsToFile = dumpAssetsToFile; 835 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
770 836 // better in the future.
771 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 837 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
772 838
773 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 839 PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
774 840
775 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; 841 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
776 842
@@ -778,141 +844,139 @@ namespace OpenSim.Region.Framework.Scenes
778 844
779 // Region config overrides global config 845 // Region config overrides global config
780 // 846 //
781 try 847 if (m_config.Configs["Startup"] != null)
782 { 848 {
783 if (m_config.Configs["Startup"] != null) 849 IConfig startupConfig = m_config.Configs["Startup"];
784 {
785 IConfig startupConfig = m_config.Configs["Startup"];
786 850
787 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 851 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
788 852
789 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 853 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
790 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 854 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
791 if (!m_useBackup) 855 if (!UseBackup)
792 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 856 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
793 857
794 //Animation states 858 //Animation states
795 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 859 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
796 860
797 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 861 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
798 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 862 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
799 863
800 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 864 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
801 if (RegionInfo.NonphysPrimMin > 0) 865 if (RegionInfo.NonphysPrimMin > 0)
802 { 866 {
803 m_minNonphys = RegionInfo.NonphysPrimMin; 867 m_minNonphys = RegionInfo.NonphysPrimMin;
804 } 868 }
805 869
806 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 870 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
807 if (RegionInfo.NonphysPrimMax > 0) 871 if (RegionInfo.NonphysPrimMax > 0)
808 { 872 {
809 m_maxNonphys = RegionInfo.NonphysPrimMax; 873 m_maxNonphys = RegionInfo.NonphysPrimMax;
810 } 874 }
811 875
812 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); 876 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
813 if (RegionInfo.PhysPrimMin > 0) 877 if (RegionInfo.PhysPrimMin > 0)
814 { 878 {
815 m_minPhys = RegionInfo.PhysPrimMin; 879 m_minPhys = RegionInfo.PhysPrimMin;
816 } 880 }
817 881
818 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 882 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
819 883
820 if (RegionInfo.PhysPrimMax > 0) 884 if (RegionInfo.PhysPrimMax > 0)
821 { 885 {
822 m_maxPhys = RegionInfo.PhysPrimMax; 886 m_maxPhys = RegionInfo.PhysPrimMax;
823 } 887 }
824 888
825 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); 889 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
826 if (RegionInfo.LinksetCapacity > 0) 890 if (RegionInfo.LinksetCapacity > 0)
827 { 891 {
828 m_linksetCapacity = RegionInfo.LinksetCapacity; 892 m_linksetCapacity = RegionInfo.LinksetCapacity;
829 } 893 }
830 894
831 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 895 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
832 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 896 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
833 897
834 // Here, if clamping is requested in either global or 898 // Here, if clamping is requested in either global or
835 // local config, it will be used 899 // local config, it will be used
836 // 900 //
837 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 901 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
838 if (RegionInfo.ClampPrimSize) 902 if (RegionInfo.ClampPrimSize)
903 {
904 m_clampPrimSize = true;
905 }
906
907 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
908 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
909 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
910 m_dontPersistBefore =
911 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
912 m_dontPersistBefore *= 10000000;
913 m_persistAfter =
914 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
915 m_persistAfter *= 10000000;
916
917 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
918 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
919
920 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
921 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
922 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
923
924 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
925 if (m_generateMaptiles)
926 {
927 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
928 if (maptileRefresh != 0)
839 { 929 {
840 m_clampPrimSize = true; 930 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
931 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
932 m_mapGenerationTimer.AutoReset = true;
933 m_mapGenerationTimer.Start();
841 } 934 }
935 }
936 else
937 {
938 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
939 UUID tileID;
842 940
843 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 941 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 { 942 {
863 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 943 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 } 944 }
872 else 945 else
873 { 946 {
874 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 947 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
875 UUID tileID; 948 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 } 949 }
950 }
882 951
883 string grant = startupConfig.GetString("AllowedClients", String.Empty); 952 string grant = startupConfig.GetString("AllowedClients", String.Empty);
884 if (grant.Length > 0) 953 if (grant.Length > 0)
954 {
955 foreach (string viewer in grant.Split(','))
885 { 956 {
886 foreach (string viewer in grant.Split(',')) 957 m_AllowedViewers.Add(viewer.Trim().ToLower());
887 {
888 m_AllowedViewers.Add(viewer.Trim().ToLower());
889 }
890 } 958 }
959 }
891 960
892 grant = startupConfig.GetString("BannedClients", String.Empty); 961 grant = startupConfig.GetString("BannedClients", String.Empty);
893 if (grant.Length > 0) 962 if (grant.Length > 0)
963 {
964 foreach (string viewer in grant.Split(','))
894 { 965 {
895 foreach (string viewer in grant.Split(',')) 966 m_BannedViewers.Add(viewer.Trim().ToLower());
896 {
897 m_BannedViewers.Add(viewer.Trim().ToLower());
898 }
899 } 967 }
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 } 968 }
912 } 969
913 catch (Exception e) 970 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
914 { 971 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
915 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); 972 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
973 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
974 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
975 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
976 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
977 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
978 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
979 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
916 } 980 }
917 981
918 // FIXME: Ultimately this should be in a module. 982 // FIXME: Ultimately this should be in a module.
@@ -965,6 +1029,10 @@ namespace OpenSim.Region.Framework.Scenes
965 { 1029 {
966 PhysicalPrims = true; 1030 PhysicalPrims = true;
967 CollidablePrims = true; 1031 CollidablePrims = true;
1032 PhysicsEnabled = true;
1033
1034 PeriodicBackup = true;
1035 UseBackup = true;
968 1036
969 BordersLocked = true; 1037 BordersLocked = true;
970 Border northBorder = new Border(); 1038 Border northBorder = new Border();
@@ -1207,83 +1275,6 @@ namespace OpenSim.Region.Framework.Scenes
1207 } 1275 }
1208 } 1276 }
1209 1277
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() 1278 public int GetInaccurateNeighborCount()
1288 { 1279 {
1289 return m_neighbours.Count; 1280 return m_neighbours.Count;
@@ -1332,16 +1323,7 @@ namespace OpenSim.Region.Framework.Scenes
1332 1323
1333 m_log.Debug("[SCENE]: Persisting changed objects"); 1324 m_log.Debug("[SCENE]: Persisting changed objects");
1334 1325
1335 EntityBase[] entities = GetEntities(); 1326 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(); 1327 m_sceneGraph.Close();
1346 1328
1347 if (!GridService.DeregisterRegion(RegionInfo.RegionID)) 1329 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
@@ -1568,7 +1550,7 @@ namespace OpenSim.Region.Framework.Scenes
1568 } 1550 }
1569 1551
1570 tmpMS = Util.EnvironmentTickCount(); 1552 tmpMS = Util.EnvironmentTickCount();
1571 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1553 if (PhysicsEnabled && Frame % m_update_physics == 0)
1572 m_sceneGraph.UpdatePreparePhysics(); 1554 m_sceneGraph.UpdatePreparePhysics();
1573 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1555 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1574 1556
@@ -1583,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes
1583 tmpMS = Util.EnvironmentTickCount(); 1565 tmpMS = Util.EnvironmentTickCount();
1584 if (Frame % m_update_physics == 0) 1566 if (Frame % m_update_physics == 0)
1585 { 1567 {
1586 if (m_physics_enabled) 1568 if (PhysicsEnabled)
1587 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1569 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1588 1570
1589 if (SynchronizeScene != null) 1571 if (SynchronizeScene != null)
@@ -1625,7 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes
1625 eventMS = Util.EnvironmentTickCountSubtract(tmpMS); 1607 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1626 } 1608 }
1627 1609
1628 if (Frame % m_update_backup == 0) 1610 if (PeriodicBackup && Frame % m_update_backup == 0)
1629 { 1611 {
1630 tmpMS = Util.EnvironmentTickCount(); 1612 tmpMS = Util.EnvironmentTickCount();
1631 UpdateStorageBackup(); 1613 UpdateStorageBackup();
@@ -4709,19 +4691,6 @@ namespace OpenSim.Region.Framework.Scenes
4709 4691
4710 #region Script Engine 4692 #region Script Engine
4711 4693
4712 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
4713 public bool DumpAssetsToFile;
4714
4715 /// <summary>
4716 ///
4717 /// </summary>
4718 /// <param name="scriptEngine"></param>
4719 public void AddScriptEngine(ScriptEngineInterface scriptEngine)
4720 {
4721 ScriptEngines.Add(scriptEngine);
4722 scriptEngine.InitializeEngine(this);
4723 }
4724
4725 private bool ScriptDanger(SceneObjectPart part,Vector3 pos) 4694 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
4726 { 4695 {
4727 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 4696 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
@@ -5628,33 +5597,7 @@ Environment.Exit(1);
5628 5597
5629 public void TriggerEstateSunUpdate() 5598 public void TriggerEstateSunUpdate()
5630 { 5599 {
5631 float sun; 5600 EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle);
5632 if (RegionInfo.RegionSettings.UseEstateSun)
5633 {
5634 sun = (float)RegionInfo.EstateSettings.SunPosition;
5635 if (RegionInfo.EstateSettings.UseGlobalTime)
5636 {
5637 sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f;
5638 }
5639
5640 //
5641 EventManager.TriggerEstateToolsSunUpdate(
5642 RegionInfo.RegionHandle,
5643 RegionInfo.EstateSettings.FixedSun,
5644 RegionInfo.RegionSettings.UseEstateSun,
5645 sun);
5646 }
5647 else
5648 {
5649 // Use the Sun Position from the Region Settings
5650 sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f;
5651
5652 EventManager.TriggerEstateToolsSunUpdate(
5653 RegionInfo.RegionHandle,
5654 RegionInfo.RegionSettings.FixedSun,
5655 RegionInfo.RegionSettings.UseEstateSun,
5656 sun);
5657 }
5658 } 5601 }
5659 5602
5660 private void HandleReloadEstate(string module, string[] cmd) 5603 private void HandleReloadEstate(string module, string[] cmd)
@@ -5922,8 +5865,13 @@ Environment.Exit(1);
5922 5865
5923 if (banned) 5866 if (banned)
5924 { 5867 {
5925 reason = "No suitable landing point found"; 5868 if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false)
5926 return false; 5869 {
5870 reason = "No suitable landing point found";
5871 return false;
5872 }
5873 reason = "Administrative access only";
5874 return true;
5927 } 5875 }
5928 } 5876 }
5929 } 5877 }
@@ -6050,10 +5998,17 @@ Environment.Exit(1);
6050 GC.Collect(); 5998 GC.Collect();
6051 } 5999 }
6052 6000
6053 // Wrappers to get physics modules retrieve assets. Has to be done this way 6001 /// <summary>
6054 // because we can't assign the asset service to physics directly - at the 6002 /// Wrappers to get physics modules retrieve assets.
6055 // time physics are instantiated it's not registered but it will be by 6003 /// </summary>
6056 // the time the first prim exists. 6004 /// <remarks>
6005 /// Has to be done this way
6006 /// because we can't assign the asset service to physics directly - at the
6007 /// time physics are instantiated it's not registered but it will be by
6008 /// the time the first prim exists.
6009 /// </remarks>
6010 /// <param name="assetID"></param>
6011 /// <param name="callback"></param>
6057 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) 6012 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
6058 { 6013 {
6059 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); 6014 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);