diff options
Diffstat (limited to 'OpenSim')
-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 e742b55..2f862ea 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 |
@@ -4880,5 +4911,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4880 | 4911 | ||
4881 | return offsets.ToArray(); | 4912 | return offsets.ToArray(); |
4882 | } | 4913 | } |
4914 | |||
4915 | public void RegenerateMaptile(object sender, ElapsedEventArgs e) | ||
4916 | { | ||
4917 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | ||
4918 | if (mapModule != null) | ||
4919 | { | ||
4920 | mapModule.GenerateMaptile(); | ||
4921 | |||
4922 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | ||
4923 | |||
4924 | if (error != String.Empty) | ||
4925 | throw new Exception(error); | ||
4926 | } | ||
4927 | } | ||
4883 | } | 4928 | } |
4884 | } \ No newline at end of file | 4929 | } |