aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs72
1 files changed, 66 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index e0921ad..ea5b34e 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -31,11 +31,13 @@ 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;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion; 41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 42
41namespace OpenSim.Region.CoreModules.Hypergrid 43namespace OpenSim.Region.CoreModules.Hypergrid
@@ -48,20 +50,63 @@ namespace OpenSim.Region.CoreModules.Hypergrid
48 // Remember the map area that each client has been exposed to in this region 50 // 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>>(); 51 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>();
50 52
53 private string m_MapImageServerURL = string.Empty;
54
55 private IUserManagement m_UserManagement;
56
51 #region INonSharedRegionModule Members 57 #region INonSharedRegionModule Members
52 58
53 public override void Initialise(IConfigSource config) 59 public override void Initialise(IConfigSource source)
54 { 60 {
55 IConfig startupConfig = config.Configs["Startup"]; 61 if (Util.GetConfigVarFromSections<string>(
56 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") 62 source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
63 {
57 m_Enabled = true; 64 m_Enabled = true;
65
66 m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"});
67
68 if (!string.IsNullOrEmpty(m_MapImageServerURL))
69 {
70 m_MapImageServerURL = m_MapImageServerURL.Trim();
71 if (!m_MapImageServerURL.EndsWith("/"))
72 m_MapImageServerURL = m_MapImageServerURL + "/";
73 }
74
75
76 }
58 } 77 }
59 78
60 public override void AddRegion(Scene scene) 79 public override void AddRegion(Scene scene)
61 { 80 {
81 if (!m_Enabled)
82 return;
83
62 base.AddRegion(scene); 84 base.AddRegion(scene);
63 85
64 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); 86 scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
87 }
88
89 public override void RegionLoaded(Scene scene)
90 {
91 if (!m_Enabled)
92 return;
93
94 base.RegionLoaded(scene);
95 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
96
97 if (featuresModule != null)
98 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
99
100 m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();
101
102 }
103
104 public override void RemoveRegion(Scene scene)
105 {
106 if (!m_Enabled)
107 return;
108
109 scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
65 } 110 }
66 111
67 public override string Name 112 public override string Name
@@ -82,10 +127,11 @@ namespace OpenSim.Region.CoreModules.Hypergrid
82 foreach (MapBlockData b in mapBlocks) 127 foreach (MapBlockData b in mapBlocks)
83 { 128 {
84 b.Name = string.Empty; 129 b.Name = string.Empty;
85 b.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's 130 // Set 'simulator is offline'. We need this because the viewer ignores SimAccess.Unknown (255)
131 b.Access = (byte)SimAccess.Down;
86 } 132 }
87 133
88 m_log.DebugFormat("[HG MAP]: Reseting {0} blocks", mapBlocks.Count); 134 m_log.DebugFormat("[HG MAP]: Resetting {0} blocks", mapBlocks.Count);
89 sp.ControllingClient.SendMapBlock(mapBlocks, 0); 135 sp.ControllingClient.SendMapBlock(mapBlocks, 0);
90 m_SeenMapBlocks.Remove(clientID); 136 m_SeenMapBlocks.Remove(clientID);
91 } 137 }
@@ -115,6 +161,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid
115 return mapBlocks; 161 return mapBlocks;
116 } 162 }
117 163
164 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
165 {
166 if (m_UserManagement != null && !string.IsNullOrEmpty(m_MapImageServerURL) && !m_UserManagement.IsLocalGridUser(agentID))
167 {
168 OSD extras = new OSDMap();
169 if (features.ContainsKey("OpenSimExtras"))
170 extras = features["OpenSimExtras"];
171 else
172 features["OpenSimExtras"] = extras;
173
174 ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL;
175
176 }
177 }
118 } 178 }
119 179
120 class MapArea 180 class MapArea