diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 486 |
1 files changed, 228 insertions, 258 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2e64819..92d0aff 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,154 @@ 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"]; |
850 | |||
851 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
852 | |||
853 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | ||
854 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | ||
855 | if (!UseBackup) | ||
856 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
857 | |||
858 | //Animation states | ||
859 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
860 | |||
861 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | ||
862 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | ||
863 | |||
864 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
865 | if (RegionInfo.NonphysPrimMin > 0) | ||
784 | { | 866 | { |
785 | IConfig startupConfig = m_config.Configs["Startup"]; | 867 | m_minNonphys = RegionInfo.NonphysPrimMin; |
868 | } | ||
786 | 869 | ||
787 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 870 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
871 | if (RegionInfo.NonphysPrimMax > 0) | ||
872 | { | ||
873 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
874 | } | ||
788 | 875 | ||
789 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 876 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
790 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 877 | if (RegionInfo.PhysPrimMin > 0) |
791 | if (!m_useBackup) | 878 | { |
792 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 879 | m_minPhys = RegionInfo.PhysPrimMin; |
793 | 880 | } | |
794 | //Animation states | ||
795 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
796 | 881 | ||
797 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | 882 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
798 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | ||
799 | 883 | ||
800 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 884 | if (RegionInfo.PhysPrimMax > 0) |
801 | if (RegionInfo.NonphysPrimMin > 0) | 885 | { |
802 | { | 886 | m_maxPhys = RegionInfo.PhysPrimMax; |
803 | m_minNonphys = RegionInfo.NonphysPrimMin; | 887 | } |
804 | } | ||
805 | 888 | ||
806 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 889 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
807 | if (RegionInfo.NonphysPrimMax > 0) | 890 | if (RegionInfo.LinksetCapacity > 0) |
808 | { | 891 | { |
809 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 892 | m_linksetCapacity = RegionInfo.LinksetCapacity; |
810 | } | 893 | } |
811 | 894 | ||
812 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 895 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
813 | if (RegionInfo.PhysPrimMin > 0) | 896 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
814 | { | ||
815 | m_minPhys = RegionInfo.PhysPrimMin; | ||
816 | } | ||
817 | 897 | ||
818 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 898 | // Here, if clamping is requested in either global or |
899 | // local config, it will be used | ||
900 | // | ||
901 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
902 | if (RegionInfo.ClampPrimSize) | ||
903 | { | ||
904 | m_clampPrimSize = true; | ||
905 | } | ||
819 | 906 | ||
820 | if (RegionInfo.PhysPrimMax > 0) | 907 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
821 | { | 908 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
822 | m_maxPhys = RegionInfo.PhysPrimMax; | 909 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
823 | } | 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; | ||
824 | 916 | ||
825 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 917 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
826 | if (RegionInfo.LinksetCapacity > 0) | 918 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); |
827 | { | ||
828 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
829 | } | ||
830 | 919 | ||
831 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 920 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
832 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 921 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); |
922 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
833 | 923 | ||
834 | // Here, if clamping is requested in either global or | 924 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
835 | // local config, it will be used | 925 | |
836 | // | 926 | m_generateMaptiles |
837 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 927 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
838 | if (RegionInfo.ClampPrimSize) | 928 | |
929 | if (m_generateMaptiles) | ||
930 | { | ||
931 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | ||
932 | if (maptileRefresh != 0) | ||
839 | { | 933 | { |
840 | m_clampPrimSize = true; | 934 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; |
935 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
936 | m_mapGenerationTimer.AutoReset = true; | ||
937 | m_mapGenerationTimer.Start(); | ||
841 | } | 938 | } |
939 | } | ||
940 | else | ||
941 | { | ||
942 | string tile | ||
943 | = Util.GetConfigVarFromSections<string>( | ||
944 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | ||
842 | 945 | ||
843 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); | 946 | UUID tileID; |
844 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 947 | |
845 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 948 | if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID)) |
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 | { | 949 | { |
863 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 950 | 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 | } | 951 | } |
872 | else | 952 | else |
873 | { | 953 | { |
874 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | 954 | RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID; |
875 | UUID tileID; | 955 | 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 | } | 956 | } |
957 | } | ||
958 | |||
959 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | ||
960 | |||
961 | string grant | ||
962 | = Util.GetConfigVarFromSections<string>( | ||
963 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | ||
882 | 964 | ||
883 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 965 | if (grant.Length > 0) |
884 | if (grant.Length > 0) | 966 | { |
967 | foreach (string viewer in grant.Split(',')) | ||
885 | { | 968 | { |
886 | foreach (string viewer in grant.Split(',')) | 969 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
887 | { | ||
888 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
889 | } | ||
890 | } | 970 | } |
971 | } | ||
972 | |||
973 | grant | ||
974 | = Util.GetConfigVarFromSections<string>( | ||
975 | config, "BannedClients", possibleAccessControlConfigSections, ""); | ||
891 | 976 | ||
892 | grant = startupConfig.GetString("BannedClients", String.Empty); | 977 | if (grant.Length > 0) |
893 | if (grant.Length > 0) | 978 | { |
979 | foreach (string viewer in grant.Split(',')) | ||
894 | { | 980 | { |
895 | foreach (string viewer in grant.Split(',')) | 981 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
896 | { | ||
897 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
898 | } | ||
899 | } | 982 | } |
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 | } | 983 | } |
912 | } | 984 | |
913 | catch (Exception e) | 985 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
914 | { | 986 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
915 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | 987 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
988 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | ||
989 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | ||
990 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | ||
991 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | ||
992 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | ||
993 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | ||
994 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | ||
916 | } | 995 | } |
917 | 996 | ||
918 | // FIXME: Ultimately this should be in a module. | 997 | // FIXME: Ultimately this should be in a module. |
@@ -965,6 +1044,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | { | 1044 | { |
966 | PhysicalPrims = true; | 1045 | PhysicalPrims = true; |
967 | CollidablePrims = true; | 1046 | CollidablePrims = true; |
1047 | PhysicsEnabled = true; | ||
1048 | |||
1049 | PeriodicBackup = true; | ||
1050 | UseBackup = true; | ||
968 | 1051 | ||
969 | BordersLocked = true; | 1052 | BordersLocked = true; |
970 | Border northBorder = new Border(); | 1053 | Border northBorder = new Border(); |
@@ -1207,83 +1290,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | } | 1290 | } |
1208 | } | 1291 | } |
1209 | 1292 | ||
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() | 1293 | public int GetInaccurateNeighborCount() |
1288 | { | 1294 | { |
1289 | return m_neighbours.Count; | 1295 | return m_neighbours.Count; |
@@ -1332,16 +1338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1332 | 1338 | ||
1333 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1339 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1334 | 1340 | ||
1335 | EntityBase[] entities = GetEntities(); | 1341 | 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(); | 1342 | m_sceneGraph.Close(); |
1346 | 1343 | ||
1347 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1344 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1568,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1568 | } | 1565 | } |
1569 | 1566 | ||
1570 | tmpMS = Util.EnvironmentTickCount(); | 1567 | tmpMS = Util.EnvironmentTickCount(); |
1571 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1568 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1572 | m_sceneGraph.UpdatePreparePhysics(); | 1569 | m_sceneGraph.UpdatePreparePhysics(); |
1573 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1570 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1574 | 1571 | ||
@@ -1583,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1583 | tmpMS = Util.EnvironmentTickCount(); | 1580 | tmpMS = Util.EnvironmentTickCount(); |
1584 | if (Frame % m_update_physics == 0) | 1581 | if (Frame % m_update_physics == 0) |
1585 | { | 1582 | { |
1586 | if (m_physics_enabled) | 1583 | if (PhysicsEnabled) |
1587 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1584 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); |
1588 | 1585 | ||
1589 | if (SynchronizeScene != null) | 1586 | if (SynchronizeScene != null) |
@@ -1625,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1625 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1622 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1626 | } | 1623 | } |
1627 | 1624 | ||
1628 | if (Frame % m_update_backup == 0) | 1625 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1629 | { | 1626 | { |
1630 | tmpMS = Util.EnvironmentTickCount(); | 1627 | tmpMS = Util.EnvironmentTickCount(); |
1631 | UpdateStorageBackup(); | 1628 | UpdateStorageBackup(); |
@@ -4728,19 +4725,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4728 | 4725 | ||
4729 | #region Script Engine | 4726 | #region Script Engine |
4730 | 4727 | ||
4731 | private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); | ||
4732 | public bool DumpAssetsToFile; | ||
4733 | |||
4734 | /// <summary> | ||
4735 | /// | ||
4736 | /// </summary> | ||
4737 | /// <param name="scriptEngine"></param> | ||
4738 | public void AddScriptEngine(ScriptEngineInterface scriptEngine) | ||
4739 | { | ||
4740 | ScriptEngines.Add(scriptEngine); | ||
4741 | scriptEngine.InitializeEngine(this); | ||
4742 | } | ||
4743 | |||
4744 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4728 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) |
4745 | { | 4729 | { |
4746 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4730 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
@@ -5647,33 +5631,7 @@ Environment.Exit(1); | |||
5647 | 5631 | ||
5648 | public void TriggerEstateSunUpdate() | 5632 | public void TriggerEstateSunUpdate() |
5649 | { | 5633 | { |
5650 | float sun; | 5634 | EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); |
5651 | if (RegionInfo.RegionSettings.UseEstateSun) | ||
5652 | { | ||
5653 | sun = (float)RegionInfo.EstateSettings.SunPosition; | ||
5654 | if (RegionInfo.EstateSettings.UseGlobalTime) | ||
5655 | { | ||
5656 | sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; | ||
5657 | } | ||
5658 | |||
5659 | // | ||
5660 | EventManager.TriggerEstateToolsSunUpdate( | ||
5661 | RegionInfo.RegionHandle, | ||
5662 | RegionInfo.EstateSettings.FixedSun, | ||
5663 | RegionInfo.RegionSettings.UseEstateSun, | ||
5664 | sun); | ||
5665 | } | ||
5666 | else | ||
5667 | { | ||
5668 | // Use the Sun Position from the Region Settings | ||
5669 | sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; | ||
5670 | |||
5671 | EventManager.TriggerEstateToolsSunUpdate( | ||
5672 | RegionInfo.RegionHandle, | ||
5673 | RegionInfo.RegionSettings.FixedSun, | ||
5674 | RegionInfo.RegionSettings.UseEstateSun, | ||
5675 | sun); | ||
5676 | } | ||
5677 | } | 5635 | } |
5678 | 5636 | ||
5679 | private void HandleReloadEstate(string module, string[] cmd) | 5637 | private void HandleReloadEstate(string module, string[] cmd) |
@@ -5941,8 +5899,13 @@ Environment.Exit(1); | |||
5941 | 5899 | ||
5942 | if (banned) | 5900 | if (banned) |
5943 | { | 5901 | { |
5944 | reason = "No suitable landing point found"; | 5902 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5945 | return false; | 5903 | { |
5904 | reason = "No suitable landing point found"; | ||
5905 | return false; | ||
5906 | } | ||
5907 | reason = "Administrative access only"; | ||
5908 | return true; | ||
5946 | } | 5909 | } |
5947 | } | 5910 | } |
5948 | } | 5911 | } |
@@ -6069,10 +6032,17 @@ Environment.Exit(1); | |||
6069 | GC.Collect(); | 6032 | GC.Collect(); |
6070 | } | 6033 | } |
6071 | 6034 | ||
6072 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6035 | /// <summary> |
6073 | // because we can't assign the asset service to physics directly - at the | 6036 | /// Wrappers to get physics modules retrieve assets. |
6074 | // time physics are instantiated it's not registered but it will be by | 6037 | /// </summary> |
6075 | // the time the first prim exists. | 6038 | /// <remarks> |
6039 | /// Has to be done this way | ||
6040 | /// because we can't assign the asset service to physics directly - at the | ||
6041 | /// time physics are instantiated it's not registered but it will be by | ||
6042 | /// the time the first prim exists. | ||
6043 | /// </remarks> | ||
6044 | /// <param name="assetID"></param> | ||
6045 | /// <param name="callback"></param> | ||
6076 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) | 6046 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) |
6077 | { | 6047 | { |
6078 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); | 6048 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); |