mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
This commit is contained in:
@@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules
|
||||
{
|
||||
public class CloudModule : ICloudModule
|
||||
public class CloudModule : ICloudModule, INonSharedRegionModule
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules
|
||||
private float m_cloudDensity = 1.0F;
|
||||
private float[] cloudCover = new float[16 * 16];
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig cloudConfig = config.Configs["Cloud"];
|
||||
|
||||
@@ -59,21 +59,40 @@ namespace OpenSim.Region.CoreModules
|
||||
m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
}
|
||||
|
||||
m_scene = scene;
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
scene.EventManager.OnNewClient += CloudsToClient;
|
||||
scene.RegisterModuleInterface<ICloudModule>(this);
|
||||
scene.EventManager.OnFrame += CloudUpdate;
|
||||
m_scene = scene;
|
||||
|
||||
GenerateCloudCover();
|
||||
scene.EventManager.OnNewClient += CloudsToClient;
|
||||
scene.RegisterModuleInterface<ICloudModule>(this);
|
||||
scene.EventManager.OnFrame += CloudUpdate;
|
||||
|
||||
m_ready = true;
|
||||
GenerateCloudCover();
|
||||
|
||||
}
|
||||
m_ready = true;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
m_ready = false;
|
||||
// Remove our hooks
|
||||
m_scene.EventManager.OnNewClient -= CloudsToClient;
|
||||
m_scene.EventManager.OnFrame -= CloudUpdate;
|
||||
m_scene.UnregisterModuleInterface<ICloudModule>(this);
|
||||
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -82,13 +101,6 @@ namespace OpenSim.Region.CoreModules
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_ready = false;
|
||||
// Remove our hooks
|
||||
m_scene.EventManager.OnNewClient -= CloudsToClient;
|
||||
m_scene.EventManager.OnFrame -= CloudUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
@@ -96,12 +108,11 @@ namespace OpenSim.Region.CoreModules
|
||||
get { return "CloudModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return false; }
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
|
||||
public float CloudCover(int x, int y, int z)
|
||||
{
|
||||
float cover = 0f;
|
||||
|
||||
@@ -267,26 +267,17 @@ namespace OpenSim.Region.CoreModules
|
||||
return GetCurrentSunHour() + 6.0f;
|
||||
}
|
||||
|
||||
#region IRegion Methods
|
||||
#region INonSharedRegion Methods
|
||||
|
||||
// Called immediately after the module is loaded for a given region
|
||||
// i.e. Immediately after instance creation.
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_frame = 0;
|
||||
|
||||
// This one puts an entry in the main help screen
|
||||
// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
|
||||
|
||||
// This one enables the ability to type just "sun" without any parameters
|
||||
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
|
||||
foreach (KeyValuePair<string, string> kvp in GetParamList())
|
||||
{
|
||||
string sunCommand = string.Format("sun {0}", kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
|
||||
}
|
||||
|
||||
TimeZone local = TimeZone.CurrentTimeZone;
|
||||
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
|
||||
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
|
||||
@@ -358,15 +349,6 @@ namespace OpenSim.Region.CoreModules
|
||||
HorizonShift = m_HorizonShift; // Z axis translation
|
||||
// HoursToRadians = (SunCycle/24)*VWTimeRatio;
|
||||
|
||||
// Insert our event handling hooks
|
||||
|
||||
scene.EventManager.OnFrame += SunUpdate;
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
|
||||
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
|
||||
|
||||
ready = true;
|
||||
|
||||
m_log.Debug("[SUN]: Mode is " + m_RegionMode);
|
||||
m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
|
||||
m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
|
||||
@@ -376,14 +358,37 @@ namespace OpenSim.Region.CoreModules
|
||||
break;
|
||||
}
|
||||
|
||||
scene.RegisterModuleInterface<ISunModule>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
// Insert our event handling hooks
|
||||
|
||||
scene.EventManager.OnFrame += SunUpdate;
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
|
||||
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
|
||||
|
||||
scene.RegisterModuleInterface<ISunModule>(this);
|
||||
|
||||
// This one enables the ability to type just "sun" without any parameters
|
||||
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
|
||||
foreach (KeyValuePair<string, string> kvp in GetParamList())
|
||||
{
|
||||
string sunCommand = string.Format("sun {0}", kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
|
||||
}
|
||||
|
||||
ready = true;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
ready = false;
|
||||
|
||||
@@ -394,16 +399,19 @@ namespace OpenSim.Region.CoreModules
|
||||
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "SunModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EventManager Events
|
||||
|
||||
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Vegetation
|
||||
{
|
||||
public class VegetationModule : IRegionModule, IVegetationModule
|
||||
public class VegetationModule : INonSharedRegionModule, IVegetationModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -45,16 +45,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
|
||||
protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
|
||||
public PCode[] CreationCapabilities { get { return creationCapabilities; } }
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<IVegetationModule>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_scene.UnregisterModuleInterface<IVegetationModule>(this);
|
||||
}
|
||||
|
||||
public void Close() {}
|
||||
public string Name { get { return "Vegetation Module"; } }
|
||||
public bool IsSharedModule { get { return false; } }
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public SceneObjectGroup AddTree(
|
||||
UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
|
||||
|
||||
@@ -52,31 +52,31 @@ namespace OpenSim.Region.CoreModules
|
||||
private bool m_ready = false;
|
||||
|
||||
private bool m_enabled = false;
|
||||
|
||||
private IConfig m_windConfig;
|
||||
private IWindModelPlugin m_activeWindPlugin = null;
|
||||
private const string m_dWindPluginName = "SimpleRandomWind";
|
||||
private string m_dWindPluginName = "SimpleRandomWind";
|
||||
private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>();
|
||||
|
||||
// Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
|
||||
private Vector2[] windSpeeds = new Vector2[16 * 16];
|
||||
|
||||
#region IRegion Methods
|
||||
#region INonSharedRegionModule Methods
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig windConfig = config.Configs["Wind"];
|
||||
m_windConfig = config.Configs["Wind"];
|
||||
string desiredWindPlugin = m_dWindPluginName;
|
||||
|
||||
if (windConfig != null)
|
||||
if (m_windConfig != null)
|
||||
{
|
||||
m_enabled = windConfig.GetBoolean("enabled", true);
|
||||
m_enabled = m_windConfig.GetBoolean("enabled", true);
|
||||
|
||||
m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150);
|
||||
m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);
|
||||
|
||||
// Determine which wind model plugin is desired
|
||||
if (windConfig.Contains("wind_plugin"))
|
||||
if (m_windConfig.Contains("wind_plugin"))
|
||||
{
|
||||
desiredWindPlugin = windConfig.GetString("wind_plugin");
|
||||
m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,104 +84,111 @@ namespace OpenSim.Region.CoreModules
|
||||
{
|
||||
m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
|
||||
|
||||
m_scene = scene;
|
||||
m_frame = 0;
|
||||
|
||||
// Register all the Wind Model Plug-ins
|
||||
foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false))
|
||||
{
|
||||
m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name);
|
||||
m_availableWindPlugins.Add(windPlugin.Name, windPlugin);
|
||||
}
|
||||
|
||||
// Check for desired plugin
|
||||
if (m_availableWindPlugins.ContainsKey(desiredWindPlugin))
|
||||
{
|
||||
m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin];
|
||||
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin);
|
||||
|
||||
if (windConfig != null)
|
||||
{
|
||||
m_activeWindPlugin.Initialise();
|
||||
m_activeWindPlugin.WindConfig(m_scene, windConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if the plug-in wasn't found, default to no wind.
|
||||
if (m_activeWindPlugin == null)
|
||||
{
|
||||
m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin);
|
||||
m_log.ErrorFormat("[WIND] Defaulting to no wind.");
|
||||
}
|
||||
|
||||
// This one puts an entry in the main help screen
|
||||
// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
|
||||
|
||||
// This one enables the ability to type just the base command without any parameters
|
||||
// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
|
||||
|
||||
// Get a list of the parameters for each plugin
|
||||
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
|
||||
{
|
||||
// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
|
||||
m_scene.AddCommand(
|
||||
"Regions",
|
||||
this,
|
||||
"wind base wind_update_rate",
|
||||
"wind base wind_update_rate [<value>]",
|
||||
"Get or set the wind update rate.",
|
||||
"",
|
||||
HandleConsoleBaseCommand);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
|
||||
{
|
||||
string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
|
||||
}
|
||||
}
|
||||
|
||||
// Register event handlers for when Avatars enter the region, and frame ticks
|
||||
m_scene.EventManager.OnFrame += WindUpdate;
|
||||
m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
|
||||
|
||||
// Register the wind module
|
||||
m_scene.RegisterModuleInterface<IWindModule>(this);
|
||||
|
||||
// Generate initial wind values
|
||||
GenWindPos();
|
||||
|
||||
// Mark Module Ready for duty
|
||||
m_ready = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
m_scene = scene;
|
||||
m_frame = 0;
|
||||
|
||||
// Register all the Wind Model Plug-ins
|
||||
foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false))
|
||||
{
|
||||
m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name);
|
||||
m_availableWindPlugins.Add(windPlugin.Name, windPlugin);
|
||||
}
|
||||
|
||||
// Check for desired plugin
|
||||
if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
|
||||
{
|
||||
m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
|
||||
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||
|
||||
if (m_windConfig != null)
|
||||
{
|
||||
m_activeWindPlugin.Initialise();
|
||||
m_activeWindPlugin.WindConfig(m_scene, m_windConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if the plug-in wasn't found, default to no wind.
|
||||
if (m_activeWindPlugin == null)
|
||||
{
|
||||
m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName);
|
||||
m_log.ErrorFormat("[WIND] Defaulting to no wind.");
|
||||
}
|
||||
|
||||
// This one puts an entry in the main help screen
|
||||
// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
|
||||
|
||||
// This one enables the ability to type just the base command without any parameters
|
||||
// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
|
||||
|
||||
// Get a list of the parameters for each plugin
|
||||
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
|
||||
{
|
||||
// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
|
||||
m_scene.AddCommand(
|
||||
"Regions",
|
||||
this,
|
||||
"wind base wind_update_rate",
|
||||
"wind base wind_update_rate [<value>]",
|
||||
"Get or set the wind update rate.",
|
||||
"",
|
||||
HandleConsoleBaseCommand);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
|
||||
{
|
||||
string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
|
||||
}
|
||||
}
|
||||
|
||||
// Register event handlers for when Avatars enter the region, and frame ticks
|
||||
m_scene.EventManager.OnFrame += WindUpdate;
|
||||
m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
|
||||
|
||||
// Register the wind module
|
||||
m_scene.RegisterModuleInterface<IWindModule>(this);
|
||||
|
||||
// Generate initial wind values
|
||||
GenWindPos();
|
||||
|
||||
// Mark Module Ready for duty
|
||||
m_ready = true;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
m_ready = false;
|
||||
|
||||
// REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
|
||||
m_activeWindPlugin = null;
|
||||
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
|
||||
{
|
||||
windPlugin.Dispose();
|
||||
}
|
||||
|
||||
m_availableWindPlugins.Clear();
|
||||
|
||||
// Remove our hooks
|
||||
m_scene.EventManager.OnFrame -= WindUpdate;
|
||||
m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_ready = false;
|
||||
|
||||
// REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
|
||||
m_activeWindPlugin = null;
|
||||
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
|
||||
{
|
||||
windPlugin.Dispose();
|
||||
}
|
||||
|
||||
m_availableWindPlugins.Clear();
|
||||
|
||||
// Remove our hooks
|
||||
m_scene.EventManager.OnFrame -= WindUpdate;
|
||||
m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
@@ -189,11 +196,14 @@ namespace OpenSim.Region.CoreModules
|
||||
get { return "WindModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return false; }
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
@@ -37,16 +38,21 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
public class MapSearchModule : IRegionModule
|
||||
public class MapSearchModule : ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
Scene m_scene = null; // only need one for communication with GridService
|
||||
List<Scene> m_scenes = new List<Scene>();
|
||||
List<UUID> m_Clients;
|
||||
|
||||
#region IRegionModule Members
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
#region ISharedRegionModule Members
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
@@ -55,6 +61,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
|
||||
m_scenes.Add(scene);
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
m_Clients = new List<UUID>();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_scenes.Remove(scene);
|
||||
if (m_scene == scene && m_scenes.Count > 0)
|
||||
m_scene = m_scenes[0];
|
||||
|
||||
scene.EventManager.OnNewClient -= OnNewClient;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -72,16 +88,44 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
get { return "MapSearchModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return true; }
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnMapNameRequest += OnMapNameRequest;
|
||||
client.OnMapNameRequest += OnMapNameRequestHandler;
|
||||
}
|
||||
|
||||
private void OnMapNameRequestHandler(IClientAPI remoteClient, string mapName, uint flags)
|
||||
{
|
||||
lock (m_Clients)
|
||||
{
|
||||
if (m_Clients.Contains(remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
m_Clients.Add(remoteClient.AgentId);
|
||||
}
|
||||
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
OnMapNameRequest(remoteClient, mapName, flags);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (m_Clients)
|
||||
m_Clients.Remove(remoteClient.AgentId);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
|
||||
@@ -175,6 +219,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
});
|
||||
}
|
||||
|
||||
private void AddFinalBlock(List<MapBlockData> blocks)
|
||||
{
|
||||
// final block, closing the search result
|
||||
MapBlockData data = new MapBlockData();
|
||||
data.Agents = 0;
|
||||
data.Access = 255;
|
||||
data.MapImageId = UUID.Zero;
|
||||
data.Name = "";
|
||||
data.RegionFlags = 0;
|
||||
data.WaterHeight = 0; // not used
|
||||
data.X = 0;
|
||||
data.Y = 0;
|
||||
blocks.Add(data);
|
||||
}
|
||||
// private Scene GetClientScene(IClientAPI client)
|
||||
// {
|
||||
// foreach (Scene s in m_scenes)
|
||||
|
||||
Reference in New Issue
Block a user