aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs111
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs232
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs10
5 files changed, 362 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 40506a5..dda67f9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -280,11 +280,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
280 List<string> ids = new List<string>(); 280 List<string> ids = new List<string>();
281 foreach (FriendInfo f in kvp.Value) 281 foreach (FriendInfo f in kvp.Value)
282 ids.Add(f.Friend); 282 ids.Add(f.Friend);
283 UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false); 283 UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
284 List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); 284 List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
285 Thread.Sleep(100); 285
286 // need to debug this here 286 if (online && friendsOnline.Count > 0)
287 if (online)
288 { 287 {
289 IClientAPI client = LocateClientObject(userID); 288 IClientAPI client = LocateClientObject(userID);
290 if (client != null) 289 if (client != null)
@@ -305,15 +304,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
305 if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out first, out last, out tmp)) 304 if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out first, out last, out tmp))
306 { 305 {
307 IUserManagement userMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); 306 IUserManagement userMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
308 userMan.AddUser(agentID, url + ";" + first + " " + last); 307 userMan.AddUser(agentID, first, last, url);
309 308
310 try // our best
311 {
312 string[] parts = userMan.GetUserName(agentID).Split();
313 first = parts[0];
314 last = parts[1];
315 }
316 catch { }
317 return true; 309 return true;
318 } 310 }
319 return false; 311 return false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs
new file mode 100644
index 0000000..b570155
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs
@@ -0,0 +1,111 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using System.Collections.Generic;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base;
39using OpenSim.Server.Handlers.MapImage;
40using OpenSim.Services.Interfaces;
41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MapImageServiceInConnectorModule : ISharedRegionModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static bool m_Enabled = false;
49
50 private IConfigSource m_Config;
51 bool m_Registered = false;
52
53 #region IRegionModule interface
54
55 public void Initialise(IConfigSource config)
56 {
57 m_Config = config;
58 IConfig moduleConfig = config.Configs["Modules"];
59 if (moduleConfig != null)
60 {
61 m_Enabled = moduleConfig.GetBoolean("MapImageServiceInConnector", false);
62 if (m_Enabled)
63 {
64 m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled");
65 new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService");
66 }
67
68 }
69
70 }
71
72 public void PostInitialise()
73 {
74 }
75
76 public void Close()
77 {
78 }
79
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
84
85 public string Name
86 {
87 get { return "MapImageServiceIn"; }
88 }
89
90 public void AddRegion(Scene scene)
91 {
92 if (!m_Enabled)
93 return;
94 }
95
96 public void RemoveRegion(Scene scene)
97 {
98 if (!m_Enabled)
99 return;
100 }
101
102 public void RegionLoaded(Scene scene)
103 {
104 if (!m_Enabled)
105 return;
106 }
107
108 #endregion
109
110 }
111}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
new file mode 100644
index 0000000..ee90859
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -0,0 +1,232 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Net;
32using System.IO;
33using System.Timers;
34using System.Drawing;
35using System.Drawing.Imaging;
36
37using log4net;
38using Mono.Addins;
39using Nini.Config;
40using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Services.Interfaces;
44using OpenSim.Server.Base;
45using OpenMetaverse;
46using OpenMetaverse.StructuredData;
47
48namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
49{
50 /// <summary>
51 /// </summary>
52 /// <remarks>
53 /// </remarks>
54
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
56 public class MapImageServiceModule : ISharedRegionModule
57 {
58 private static readonly ILog m_log =
59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60
61 private bool m_enabled = false;
62 private IMapImageService m_MapService;
63
64 private string m_serverUrl = String.Empty;
65 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
66
67 private int m_refreshtime = 0;
68 private int m_lastrefresh = 0;
69 private System.Timers.Timer m_refreshTimer = new System.Timers.Timer();
70
71 #region ISharedRegionModule
72
73 public Type ReplaceableInterface { get { return null; } }
74 public string Name { get { return "MapImageServiceModule"; } }
75 public void RegionLoaded(Scene scene) { }
76 public void Close() { }
77 public void PostInitialise() { }
78
79
80 ///<summary>
81 ///
82 ///</summary>
83 public void Initialise(IConfigSource source)
84 {
85 IConfig moduleConfig = source.Configs["Modules"];
86 if (moduleConfig != null)
87 {
88 string name = moduleConfig.GetString("MapImageService", "");
89 if (name != Name)
90 return;
91 }
92
93 IConfig config = source.Configs["MapImageService"];
94 if (config == null)
95 return;
96
97 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));
98 if (refreshminutes <= 0)
99 {
100 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No refresh time given in config. Module disabled.");
101 return;
102 }
103
104 m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms
105
106 string service = config.GetString("LocalServiceModule", string.Empty);
107 if (service == string.Empty)
108 {
109 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No service dll given in config. Unable to proceed.");
110 return;
111 }
112
113 Object[] args = new Object[] { source };
114 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(service, args);
115
116 m_refreshTimer.Enabled = true;
117 m_refreshTimer.AutoReset = true;
118 m_refreshTimer.Interval = m_refreshtime;
119 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
120
121 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0}min and service object {1}",
122 refreshminutes, service);
123
124 m_enabled = true;
125 }
126
127 ///<summary>
128 ///
129 ///</summary>
130
131
132 ///<summary>
133 ///
134 ///</summary>
135 public void AddRegion(Scene scene)
136 {
137 if (! m_enabled)
138 return;
139
140 // Every shared region module has to maintain an indepedent list of
141 // currently running regions
142 lock (m_scenes)
143 m_scenes[scene.RegionInfo.RegionID] = scene;
144
145 scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
146 }
147
148 ///<summary>
149 ///
150 ///</summary>
151 public void RemoveRegion(Scene scene)
152 {
153 if (! m_enabled)
154 return;
155
156 lock (m_scenes)
157 m_scenes.Remove(scene.RegionInfo.RegionID);
158 }
159
160 #endregion ISharedRegionModule
161
162 void EventManager_OnPrimsLoaded(Scene s)
163 {
164 UploadMapTile(s);
165 }
166
167
168 ///<summary>
169 ///
170 ///</summary>
171 private void HandleMaptileRefresh(object sender, EventArgs ea)
172 {
173 // this approach is a bit convoluted becase we want to wait for the
174 // first upload to happen on startup but after all the objects are
175 // loaded and initialized
176 if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime)
177 return;
178
179 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: map refresh!");
180 lock (m_scenes)
181 {
182 foreach (IScene scene in m_scenes.Values)
183 {
184 try
185 {
186 UploadMapTile(scene);
187 }
188 catch (Exception ex)
189 {
190 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: something bad happened {0}", ex.Message);
191 }
192 }
193 }
194
195 m_lastrefresh = Util.EnvironmentTickCount();
196 }
197
198 ///<summary>
199 ///
200 ///</summary>
201 private void UploadMapTile(IScene scene)
202 {
203 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName);
204
205 // Create a PNG map tile and upload it to the AddMapTile API
206 byte[] jpgData = Utils.EmptyBytes;
207 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
208 if (tileGenerator == null)
209 {
210 m_log.Warn("[MAP IMAGE SERVICE MODULE]: Cannot upload PNG map tile without an ImageGenerator");
211 return;
212 }
213
214 using (Image mapTile = tileGenerator.CreateMapTile())
215 {
216 using (MemoryStream stream = new MemoryStream())
217 {
218 mapTile.Save(stream, ImageFormat.Jpeg);
219 jpgData = stream.ToArray();
220 }
221 }
222
223 string reason = string.Empty;
224 if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason))
225 {
226 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}",
227 scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason);
228 }
229
230 }
231 }
232} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
index 6eb57eb..6163fd1 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
52 public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule 52 public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule
53 { 53 {
54 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); 54 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3");
55 private static readonly Color4 WATER_COLOR = new Color4(29, 71, 95, 216); 55 private static readonly Color4 WATER_COLOR = new Color4(29, 72, 96, 216);
56 56
57 private static readonly ILog m_log = 57 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
61 private IRendering m_primMesher; 61 private IRendering m_primMesher;
62 private IConfigSource m_config; 62 private IConfigSource m_config;
63 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>(); 63 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>();
64 private bool m_useAntiAliasing = true; // TODO: Make this a config option 64 private bool m_useAntiAliasing = false; // TODO: Make this a config option
65 private bool m_Enabled = false; 65 private bool m_Enabled = false;
66 66
67 #region IRegionModule Members 67 #region IRegionModule Members
@@ -192,8 +192,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
192 192
193 #endregion Camera 193 #endregion Camera
194 194
195 renderer.Scene.addLight("Light1", new warp_Light(new warp_Vector(0.2f, 0.2f, 1f), 0xffffff, 320, 80)); 195 renderer.Scene.addLight("Light1", new warp_Light(new warp_Vector(1.0f, 0.5f, 1f), 0xffffff, 0, 320, 40));
196 renderer.Scene.addLight("Light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 100, 40)); 196 renderer.Scene.addLight("Light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 0, 100, 40));
197 197
198 CreateWater(renderer); 198 CreateWater(renderer);
199 CreateTerrain(renderer, textureTerrain); 199 CreateTerrain(renderer, textureTerrain);
@@ -237,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
237 renderer.Scene.sceneobject("Water").setPos(127.5f, waterHeight, 127.5f); 237 renderer.Scene.sceneobject("Water").setPos(127.5f, waterHeight, 127.5f);
238 238
239 renderer.AddMaterial("WaterColor", ConvertColor(WATER_COLOR)); 239 renderer.AddMaterial("WaterColor", ConvertColor(WATER_COLOR));
240 renderer.Scene.material("WaterColor").setReflectivity(0); // match water color with standard map module thanks lkalif
240 renderer.Scene.material("WaterColor").setTransparency((byte)((1f - WATER_COLOR.A) * 255f)); 241 renderer.Scene.material("WaterColor").setTransparency((byte)((1f - WATER_COLOR.A) * 255f));
241 renderer.SetObjectMaterial("Water", "WaterColor"); 242 renderer.SetObjectMaterial("Water", "WaterColor");
242 } 243 }
@@ -322,6 +323,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
322 warp_Material material = new warp_Material(texture); 323 warp_Material material = new warp_Material(texture);
323 material.setReflectivity(50); 324 material.setReflectivity(50);
324 renderer.Scene.addMaterial("TerrainColor", material); 325 renderer.Scene.addMaterial("TerrainColor", material);
326 renderer.Scene.material("TerrainColor").setReflectivity(0); // reduces tile seams a bit thanks lkalif
325 renderer.SetObjectMaterial("Terrain", "TerrainColor"); 327 renderer.SetObjectMaterial("Terrain", "TerrainColor");
326 } 328 }
327 329
@@ -653,4 +655,4 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
653 return result; 655 return result;
654 } 656 }
655 } 657 }
656} 658} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index fc240d3..ca5529d9 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -836,7 +836,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
836 block.Access = 254; // means 'simulator is offline' 836 block.Access = 254; // means 'simulator is offline'
837 response.Add(block); 837 response.Add(block);
838 } 838 }
839 remoteClient.SendMapBlock(response, 0); 839 if ((flag & 2) == 2) // V2 !!!
840 remoteClient.SendMapBlock(response, 2);
841 else
842 remoteClient.SendMapBlock(response, 0);
840 } 843 }
841 else 844 else
842 { 845 {
@@ -859,7 +862,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
859 MapBlockFromGridRegion(block, r); 862 MapBlockFromGridRegion(block, r);
860 mapBlocks.Add(block); 863 mapBlocks.Add(block);
861 } 864 }
862 remoteClient.SendMapBlock(mapBlocks, 0); 865 if ((flag & 2) == 2) // V2 !!!
866 remoteClient.SendMapBlock(mapBlocks, 2);
867 else
868 remoteClient.SendMapBlock(mapBlocks, 0);
863 869
864 return mapBlocks; 870 return mapBlocks;
865 } 871 }