Converted the WindModule to the new region module interface (38 to go). Also added both the WindModule and the SunModule to the Plugin manifest.
parent
7dfd1468cc
commit
19aab3e6fe
|
@ -38,6 +38,8 @@
|
||||||
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
|
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
|
||||||
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
|
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
|
||||||
<RegionModule id="LibraryModule" type="OpenSim.Region.CoreModules.Framework.Library.LibraryModule"/>
|
<RegionModule id="LibraryModule" type="OpenSim.Region.CoreModules.Framework.Library.LibraryModule"/>
|
||||||
|
<RegionModule id="SunModule" type="OpenSim.Region.CoreModules.SunModule"/>
|
||||||
|
<RegionModule id="WindModule" type="OpenSim.Region.CoreModules.WindModule"/>
|
||||||
<!-- Service connectors OUT modules -->
|
<!-- Service connectors OUT modules -->
|
||||||
<RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" />
|
<RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" />
|
||||||
<RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" />
|
<RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" />
|
||||||
|
|
|
@ -278,14 +278,6 @@ namespace OpenSim.Region.CoreModules
|
||||||
// This one puts an entry in the main help screen
|
// 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);
|
// 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;
|
TimeZone local = TimeZone.CurrentTimeZone;
|
||||||
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
|
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
|
||||||
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
|
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
|
||||||
|
@ -385,6 +377,14 @@ namespace OpenSim.Region.CoreModules
|
||||||
|
|
||||||
scene.RegisterModuleInterface<ISunModule>(this);
|
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;
|
ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,31 +52,31 @@ namespace OpenSim.Region.CoreModules
|
||||||
private bool m_ready = false;
|
private bool m_ready = false;
|
||||||
|
|
||||||
private bool m_enabled = false;
|
private bool m_enabled = false;
|
||||||
|
private IConfig m_windConfig;
|
||||||
private IWindModelPlugin m_activeWindPlugin = null;
|
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>();
|
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
|
// Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
|
||||||
private Vector2[] windSpeeds = new Vector2[16 * 16];
|
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;
|
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
|
// 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,6 +84,15 @@ namespace OpenSim.Region.CoreModules
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
|
m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
|
|
||||||
|
@ -95,16 +104,16 @@ namespace OpenSim.Region.CoreModules
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for desired plugin
|
// Check for desired plugin
|
||||||
if (m_availableWindPlugins.ContainsKey(desiredWindPlugin))
|
if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
|
||||||
{
|
{
|
||||||
m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin];
|
m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
|
||||||
|
|
||||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin);
|
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||||
|
|
||||||
if (windConfig != null)
|
if (m_windConfig != null)
|
||||||
{
|
{
|
||||||
m_activeWindPlugin.Initialise();
|
m_activeWindPlugin.Initialise();
|
||||||
m_activeWindPlugin.WindConfig(m_scene, windConfig);
|
m_activeWindPlugin.WindConfig(m_scene, m_windConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +121,7 @@ namespace OpenSim.Region.CoreModules
|
||||||
// if the plug-in wasn't found, default to no wind.
|
// if the plug-in wasn't found, default to no wind.
|
||||||
if (m_activeWindPlugin == null)
|
if (m_activeWindPlugin == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin);
|
m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName);
|
||||||
m_log.ErrorFormat("[WIND] Defaulting to no wind.");
|
m_log.ErrorFormat("[WIND] Defaulting to no wind.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,19 +163,13 @@ namespace OpenSim.Region.CoreModules
|
||||||
|
|
||||||
// Mark Module Ready for duty
|
// Mark Module Ready for duty
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
if (m_enabled)
|
|
||||||
{
|
|
||||||
m_ready = false;
|
m_ready = false;
|
||||||
|
|
||||||
// REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
|
// REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
|
||||||
|
@ -181,7 +184,11 @@ namespace OpenSim.Region.CoreModules
|
||||||
// Remove our hooks
|
// Remove our hooks
|
||||||
m_scene.EventManager.OnFrame -= WindUpdate;
|
m_scene.EventManager.OnFrame -= WindUpdate;
|
||||||
m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
|
m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -189,11 +196,14 @@ namespace OpenSim.Region.CoreModules
|
||||||
get { return "WindModule"; }
|
get { return "WindModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return false; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public interface IWindModule : IRegionModule
|
public interface IWindModule : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue