aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2013-07-30 21:10:00 -0700
committerDiva Canto2013-07-30 21:10:00 -0700
commitfd050fca7caef83d72d00241d0c0db5c1ec5d1ff (patch)
tree7f6c05282088c75b51aa900e1c7f85f0e0735f6f /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.zip
opensim-SC-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.gz
opensim-SC-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.bz2
opensim-SC-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs47
1 files changed, 45 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index c4255b9..4a5a352 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
34using Mono.Addins; 35using Mono.Addins;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.CoreModules.World.WorldMap; 37using OpenSim.Region.CoreModules.World.WorldMap;
@@ -48,13 +49,30 @@ namespace OpenSim.Region.CoreModules.Hypergrid
48 // Remember the map area that each client has been exposed to in this region 49 // Remember the map area that each client has been exposed to in this region
49 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>(); 50 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>();
50 51
52 private string m_MapImageServerURL = string.Empty;
53
54 private IUserManagement m_UserManagement;
55
51 #region INonSharedRegionModule Members 56 #region INonSharedRegionModule Members
52 57
53 public override void Initialise(IConfigSource config) 58 public override void Initialise(IConfigSource source)
54 { 59 {
55 if (Util.GetConfigVarFromSections<string>( 60 if (Util.GetConfigVarFromSections<string>(
56 config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") 61 source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
62 {
57 m_Enabled = true; 63 m_Enabled = true;
64
65 m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"});
66
67 if (m_MapImageServerURL != string.Empty)
68 {
69 m_MapImageServerURL = m_MapImageServerURL.Trim();
70 if (!m_MapImageServerURL.EndsWith("/"))
71 m_MapImageServerURL = m_MapImageServerURL + "/";
72 }
73
74
75 }
58 } 76 }
59 77
60 public override void AddRegion(Scene scene) 78 public override void AddRegion(Scene scene)
@@ -64,6 +82,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid
64 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); 82 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed);
65 } 83 }
66 84
85 public override void RegionLoaded(Scene scene)
86 {
87 base.RegionLoaded(scene);
88 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
89
90 if (featuresModule != null)
91 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
92
93 m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();
94
95 }
67 public override string Name 96 public override string Name
68 { 97 {
69 get { return "HGWorldMap"; } 98 get { return "HGWorldMap"; }
@@ -115,6 +144,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid
115 return mapBlocks; 144 return mapBlocks;
116 } 145 }
117 146
147 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
148 {
149 if (m_UserManagement != null && !m_UserManagement.IsLocalGridUser(agentID) && m_MapImageServerURL != string.Empty)
150 {
151 OSD extras = new OSDMap();
152 if (features.ContainsKey("OpenSimExtras"))
153 extras = features["OpenSimExtras"];
154 else
155 features["OpenSimExtras"] = extras;
156
157 ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL;
158
159 }
160 }
118 } 161 }
119 162
120 class MapArea 163 class MapArea