aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorDiva Canto2012-11-10 11:59:08 -0800
committerDiva Canto2012-11-10 11:59:08 -0800
commite10d61ea8cde802b925db54c6717ada718db49db (patch)
tree45e81726eaf8bd4a45d7e283d9bacd543184b134 /OpenSim/Region/CoreModules/World
parentOne more module converted: DataSnapshot. (diff)
downloadopensim-SC_OLD-e10d61ea8cde802b925db54c6717ada718db49db.zip
opensim-SC_OLD-e10d61ea8cde802b925db54c6717ada718db49db.tar.gz
opensim-SC_OLD-e10d61ea8cde802b925db54c6717ada718db49db.tar.bz2
opensim-SC_OLD-e10d61ea8cde802b925db54c6717ada718db49db.tar.xz
One more module converted: CloudModule.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs53
1 files changed, 32 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index 5fa3dc2..2ec6ff9 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;
35 35
36namespace OpenSim.Region.CoreModules 36namespace OpenSim.Region.CoreModules
37{ 37{
38 public class CloudModule : ICloudModule 38 public class CloudModule : ICloudModule, INonSharedRegionModule
39 { 39 {
40// private static readonly log4net.ILog m_log 40// private static readonly log4net.ILog m_log
41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules
48 private float m_cloudDensity = 1.0F; 48 private float m_cloudDensity = 1.0F;
49 private float[] cloudCover = new float[16 * 16]; 49 private float[] cloudCover = new float[16 * 16];
50 50
51 public void Initialise(Scene scene, IConfigSource config) 51 public void Initialise(IConfigSource config)
52 { 52 {
53 IConfig cloudConfig = config.Configs["Cloud"]; 53 IConfig cloudConfig = config.Configs["Cloud"];
54 54
@@ -59,21 +59,40 @@ namespace OpenSim.Region.CoreModules
59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
60 } 60 }
61 61
62 if (m_enabled) 62 }
63 {
64 63
65 m_scene = scene; 64 public void AddRegion(Scene scene)
65 {
66 if (!m_enabled)
67 return;
66 68
67 scene.EventManager.OnNewClient += CloudsToClient; 69 m_scene = scene;
68 scene.RegisterModuleInterface<ICloudModule>(this);
69 scene.EventManager.OnFrame += CloudUpdate;
70 70
71 GenerateCloudCover(); 71 scene.EventManager.OnNewClient += CloudsToClient;
72 scene.RegisterModuleInterface<ICloudModule>(this);
73 scene.EventManager.OnFrame += CloudUpdate;
72 74
73 m_ready = true; 75 GenerateCloudCover();
74 76
75 } 77 m_ready = true;
78 }
79
80 public void RemoveRegion(Scene scene)
81 {
82 if (!m_enabled)
83 return;
76 84
85 m_ready = false;
86 // Remove our hooks
87 m_scene.EventManager.OnNewClient -= CloudsToClient;
88 m_scene.EventManager.OnFrame -= CloudUpdate;
89 m_scene.UnregisterModuleInterface<ICloudModule>(this);
90
91 m_scene = null;
92 }
93
94 public void RegionLoaded(Scene scene)
95 {
77 } 96 }
78 97
79 public void PostInitialise() 98 public void PostInitialise()
@@ -82,13 +101,6 @@ namespace OpenSim.Region.CoreModules
82 101
83 public void Close() 102 public void Close()
84 { 103 {
85 if (m_enabled)
86 {
87 m_ready = false;
88 // Remove our hooks
89 m_scene.EventManager.OnNewClient -= CloudsToClient;
90 m_scene.EventManager.OnFrame -= CloudUpdate;
91 }
92 } 104 }
93 105
94 public string Name 106 public string Name
@@ -96,12 +108,11 @@ namespace OpenSim.Region.CoreModules
96 get { return "CloudModule"; } 108 get { return "CloudModule"; }
97 } 109 }
98 110
99 public bool IsSharedModule 111 public Type ReplaceableInterface
100 { 112 {
101 get { return false; } 113 get { return null; }
102 } 114 }
103 115
104
105 public float CloudCover(int x, int y, int z) 116 public float CloudCover(int x, int y, int z)
106 { 117 {
107 float cover = 0f; 118 float cover = 0f;