One more module converted: CloudModule.

integration
Diva Canto 2012-11-10 11:59:08 -08:00
parent b3574d23e4
commit e10d61ea8c
3 changed files with 34 additions and 22 deletions

View File

@ -44,6 +44,7 @@
<RegionModule id="VegetationModule" type="OpenSim.Region.CoreModules.Avatar.Vegetation.VegetationModule"/> <RegionModule id="VegetationModule" type="OpenSim.Region.CoreModules.Avatar.Vegetation.VegetationModule"/>
<RegionModule id="IPBanModule" type="OpenSim.Region.CoreModules.Agent.IPBan.IPBanModule"/> <RegionModule id="IPBanModule" type="OpenSim.Region.CoreModules.Agent.IPBan.IPBanModule"/>
<RegionModule id="J2KDecoderModule" type="OpenSim.Region.CoreModules.Agent.TextureSender.J2KDecoderModule"/> <RegionModule id="J2KDecoderModule" type="OpenSim.Region.CoreModules.Agent.TextureSender.J2KDecoderModule"/>
<RegionModule id="CloudModule" type="OpenSim.Region.CoreModules.CloudModule"/>
<!-- 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" />

View File

@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules namespace OpenSim.Region.CoreModules
{ {
public class CloudModule : ICloudModule public class CloudModule : ICloudModule, INonSharedRegionModule
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules
private float m_cloudDensity = 1.0F; private float m_cloudDensity = 1.0F;
private float[] cloudCover = new float[16 * 16]; private float[] cloudCover = new float[16 * 16];
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
IConfig cloudConfig = config.Configs["Cloud"]; IConfig cloudConfig = config.Configs["Cloud"];
@ -59,21 +59,40 @@ namespace OpenSim.Region.CoreModules
m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 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; m_scene = scene;
scene.RegisterModuleInterface<ICloudModule>(this);
scene.EventManager.OnFrame += CloudUpdate;
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() public void PostInitialise()
@ -82,13 +101,6 @@ namespace OpenSim.Region.CoreModules
public void Close() 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 public string Name
@ -96,12 +108,11 @@ namespace OpenSim.Region.CoreModules
get { return "CloudModule"; } get { return "CloudModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
public float CloudCover(int x, int y, int z) public float CloudCover(int x, int y, int z)
{ {
float cover = 0f; float cover = 0f;

View File

@ -27,7 +27,7 @@
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface ICloudModule : IRegionModule public interface ICloudModule
{ {
/// <summary> /// <summary>
/// Retrieves the cloud density at the given region coordinates /// Retrieves the cloud density at the given region coordinates