Add some maptile options, change maptile generation from OpenSimBase to Scene

to make it more configurable.
prebuild-update
Melanie 2010-08-20 08:36:23 +01:00
parent f639a9e5ae
commit ae554a48d0
3 changed files with 60 additions and 17 deletions

View File

@ -347,14 +347,6 @@ namespace OpenSim
// Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
// moved these here as the map texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
IWorldMapModule mapModule = scene.RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
mapModule.GenerateMaptile();
else
m_log.WarnFormat("[STARTUP]: No map module available to generate map tile");
// TODO : Try setting resource for region xstats here on scene
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));

View File

@ -396,6 +396,9 @@ namespace OpenSim.Region.Framework.Scenes
private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
bool m_generateMaptiles = false;
#endregion
#region Properties
@ -646,6 +649,29 @@ namespace OpenSim.Region.Framework.Scenes
}
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
if (m_generateMaptiles)
{
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
if (maptileRefresh != 0)
{
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
m_mapGenerationTimer.Elapsed += RegenerateMaptile;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
if (UUID.TryParse(tile, out tileID))
{
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
}
}
catch
{
@ -1662,16 +1688,21 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.SetScene(this);
// These two 'commands' *must be* next to each other or sim rebooting fails.
//m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
// If we generate maptiles internally at all, the maptile generator
// will register the region. If not, do it here
if (m_generateMaptiles)
{
throw new Exception(error);
RegenerateMaptile(null, null);
}
else
{
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
{
throw new Exception(error);
}
}
}
#endregion
@ -4878,5 +4909,19 @@ namespace OpenSim.Region.Framework.Scenes
return offsets.ToArray();
}
public void RegenerateMaptile(object sender, ElapsedEventArgs e)
{
IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
{
mapModule.GenerateMaptile();
string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
if (error != String.Empty)
throw new Exception(error);
}
}
}
}
}

View File

@ -222,6 +222,12 @@
;WorldMapModule = "WorldMap"
;MapImageModule = "MapImageModule"
; Set to false to not generate any maptiles
;GenerateMaptiles = "true"
; Refreah (in seconds) the map tile periodically
;MaptileRefresh = 0
; If not generating maptiles, use this static texture asset ID
;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
; ##
; ## EMAIL MODULE