From e10d61ea8cde802b925db54c6717ada718db49db Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 10 Nov 2012 11:59:08 -0800 Subject: [PATCH] One more module converted: CloudModule. --- .../Resources/CoreModulePlugin.addin.xml | 1 + .../CoreModules/World/Cloud/CloudModule.cs | 53 +++++++++++-------- .../Framework/Interfaces/ICloudModule.cs | 2 +- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 820f11baf9..81f1ff61a4 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -44,6 +44,7 @@ + diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index 5fa3dc2191..2ec6ff91c1 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -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(this); - scene.EventManager.OnFrame += CloudUpdate; + m_scene = scene; - GenerateCloudCover(); + scene.EventManager.OnNewClient += CloudsToClient; + scene.RegisterModuleInterface(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(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; diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index 7296ac3ef5..54172bd22f 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -27,7 +27,7 @@ namespace OpenSim.Region.Framework.Interfaces { - public interface ICloudModule : IRegionModule + public interface ICloudModule { /// /// Retrieves the cloud density at the given region coordinates