Doing the HG Map / SimulatorFeatures "the right way": moved it to HGMapModule, hooking on to SimulatorFeatures.OnSimulatorFeaturesRequest event (similar to what the DynamicMenuModule does).
Only HG Visitors get this var, to avoid spamming local users. The config var is now called MapTileURL, to be consistent with the login one, and its being picked up from either [LoginService], [HGWorldMap] or [SimulatorFeatures], just because I have a bad memory.TeleportWork
parent
590a8b0315
commit
fd050fca7c
|
@ -68,7 +68,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
/// </summary>
|
||||
private OSDMap m_features = new OSDMap();
|
||||
|
||||
private string m_MapImageServerURL = string.Empty;
|
||||
private string m_SearchURL = string.Empty;
|
||||
private bool m_ExportSupported = false;
|
||||
|
||||
|
@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
IConfig config = source.Configs["SimulatorFeatures"];
|
||||
if (config != null)
|
||||
{
|
||||
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
}
|
||||
|
||||
{
|
||||
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
|
||||
|
||||
m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
|
||||
|
@ -149,13 +140,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_features["PhysicsShapeTypes"] = typesMap;
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
// TODO: Take these out of here into their respective modules, like map-server-url
|
||||
OSDMap extrasMap = new OSDMap();
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
extrasMap["map-server-url"] = m_MapImageServerURL;
|
||||
if (m_SearchURL != string.Empty)
|
||||
extrasMap["search-server-url"] = m_SearchURL;
|
||||
if (m_ExportSupported)
|
||||
extrasMap["ExportSupported"] = true;
|
||||
|
||||
if (extrasMap.Count > 0)
|
||||
m_features["OpenSimExtras"] = extrasMap;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using Mono.Addins;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.World.WorldMap;
|
||||
|
@ -48,13 +49,30 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
// Remember the map area that each client has been exposed to in this region
|
||||
private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>();
|
||||
|
||||
private string m_MapImageServerURL = string.Empty;
|
||||
|
||||
private IUserManagement m_UserManagement;
|
||||
|
||||
#region INonSharedRegionModule Members
|
||||
|
||||
public override void Initialise(IConfigSource config)
|
||||
public override void Initialise(IConfigSource source)
|
||||
{
|
||||
if (Util.GetConfigVarFromSections<string>(
|
||||
config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
|
||||
source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
|
||||
{
|
||||
m_Enabled = true;
|
||||
|
||||
m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"});
|
||||
|
||||
if (m_MapImageServerURL != string.Empty)
|
||||
{
|
||||
m_MapImageServerURL = m_MapImageServerURL.Trim();
|
||||
if (!m_MapImageServerURL.EndsWith("/"))
|
||||
m_MapImageServerURL = m_MapImageServerURL + "/";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRegion(Scene scene)
|
||||
|
@ -64,6 +82,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed);
|
||||
}
|
||||
|
||||
public override void RegionLoaded(Scene scene)
|
||||
{
|
||||
base.RegionLoaded(scene);
|
||||
ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
|
||||
|
||||
if (featuresModule != null)
|
||||
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
|
||||
|
||||
m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();
|
||||
|
||||
}
|
||||
public override string Name
|
||||
{
|
||||
get { return "HGWorldMap"; }
|
||||
|
@ -115,6 +144,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
return mapBlocks;
|
||||
}
|
||||
|
||||
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
|
||||
{
|
||||
if (m_UserManagement != null && !m_UserManagement.IsLocalGridUser(agentID) && m_MapImageServerURL != string.Empty)
|
||||
{
|
||||
OSD extras = new OSDMap();
|
||||
if (features.ContainsKey("OpenSimExtras"))
|
||||
extras = features["OpenSimExtras"];
|
||||
else
|
||||
features["OpenSimExtras"] = extras;
|
||||
|
||||
((OSDMap)extras)["map-server-url"] = m_MapImageServerURL;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MapArea
|
||||
|
|
Loading…
Reference in New Issue