diff options
author | Melanie | 2010-08-20 08:36:23 +0100 |
---|---|---|
committer | Melanie | 2010-08-20 08:36:23 +0100 |
commit | ae554a48d0cea61d05dc931c04f336d83de4834b (patch) | |
tree | b5bf93da7bb9a115c36967ccce681c8f29215dd0 /OpenSim/Region | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-ae554a48d0cea61d05dc931c04f336d83de4834b.zip opensim-SC_OLD-ae554a48d0cea61d05dc931c04f336d83de4834b.tar.gz opensim-SC_OLD-ae554a48d0cea61d05dc931c04f336d83de4834b.tar.bz2 opensim-SC_OLD-ae554a48d0cea61d05dc931c04f336d83de4834b.tar.xz |
Add some maptile options, change maptile generation from OpenSimBase to Scene
to make it more configurable.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 63 |
2 files changed, 54 insertions, 17 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index eb18e83..b80d17d 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -347,14 +347,6 @@ namespace OpenSim | |||
347 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 347 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
348 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 348 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
349 | 349 | ||
350 | // moved these here as the map texture has to be created after the modules are initialized | ||
351 | // and has to happen before the region is registered with the grid. | ||
352 | IWorldMapModule mapModule = scene.RequestModuleInterface<IWorldMapModule>(); | ||
353 | if (mapModule != null) | ||
354 | mapModule.GenerateMaptile(); | ||
355 | else | ||
356 | m_log.WarnFormat("[STARTUP]: No map module available to generate map tile"); | ||
357 | |||
358 | // TODO : Try setting resource for region xstats here on scene | 350 | // TODO : Try setting resource for region xstats here on scene |
359 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); | 351 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); |
360 | 352 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18705a8..2890ecd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -396,6 +396,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
396 | private double m_rootReprioritizationDistance = 10.0; | 396 | private double m_rootReprioritizationDistance = 10.0; |
397 | private double m_childReprioritizationDistance = 20.0; | 397 | private double m_childReprioritizationDistance = 20.0; |
398 | 398 | ||
399 | private Timer m_mapGenerationTimer = new Timer(); | ||
400 | bool m_generateMaptiles = false; | ||
401 | |||
399 | #endregion | 402 | #endregion |
400 | 403 | ||
401 | #region Properties | 404 | #region Properties |
@@ -646,6 +649,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
646 | } | 649 | } |
647 | 650 | ||
648 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 651 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
652 | |||
653 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
654 | if (m_generateMaptiles) | ||
655 | { | ||
656 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | ||
657 | if (maptileRefresh != 0) | ||
658 | { | ||
659 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
660 | m_mapGenerationTimer.Elapsed += RegenerateMaptile; | ||
661 | m_mapGenerationTimer.AutoReset = true; | ||
662 | m_mapGenerationTimer.Start(); | ||
663 | } | ||
664 | } | ||
665 | else | ||
666 | { | ||
667 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
668 | UUID tileID; | ||
669 | |||
670 | if (UUID.TryParse(tile, out tileID)) | ||
671 | { | ||
672 | RegionInfo.RegionSettings.TerrainImageID = tileID; | ||
673 | } | ||
674 | } | ||
649 | } | 675 | } |
650 | catch | 676 | catch |
651 | { | 677 | { |
@@ -1662,16 +1688,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1662 | 1688 | ||
1663 | m_sceneGridService.SetScene(this); | 1689 | m_sceneGridService.SetScene(this); |
1664 | 1690 | ||
1665 | // These two 'commands' *must be* next to each other or sim rebooting fails. | 1691 | // If we generate maptiles internally at all, the maptile generator |
1666 | //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); | 1692 | // will register the region. If not, do it here |
1667 | 1693 | if (m_generateMaptiles) | |
1668 | GridRegion region = new GridRegion(RegionInfo); | ||
1669 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | ||
1670 | if (error != String.Empty) | ||
1671 | { | 1694 | { |
1672 | throw new Exception(error); | 1695 | RegenerateMaptile(null, null); |
1696 | } | ||
1697 | else | ||
1698 | { | ||
1699 | GridRegion region = new GridRegion(RegionInfo); | ||
1700 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | ||
1701 | if (error != String.Empty) | ||
1702 | { | ||
1703 | throw new Exception(error); | ||
1704 | } | ||
1673 | } | 1705 | } |
1674 | |||
1675 | } | 1706 | } |
1676 | 1707 | ||
1677 | #endregion | 1708 | #endregion |
@@ -4878,5 +4909,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4878 | 4909 | ||
4879 | return offsets.ToArray(); | 4910 | return offsets.ToArray(); |
4880 | } | 4911 | } |
4912 | |||
4913 | public void RegenerateMaptile(object sender, ElapsedEventArgs e) | ||
4914 | { | ||
4915 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | ||
4916 | if (mapModule != null) | ||
4917 | { | ||
4918 | mapModule.GenerateMaptile(); | ||
4919 | |||
4920 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | ||
4921 | |||
4922 | if (error != String.Empty) | ||
4923 | throw new Exception(error); | ||
4924 | } | ||
4925 | } | ||
4881 | } | 4926 | } |
4882 | } \ No newline at end of file | 4927 | } |