aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Cloud
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Cloud')
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs57
1 files changed, 35 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index 5fa3dc2..d217f36 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
@@ -27,15 +27,17 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
30using Nini.Config; 31using Nini.Config;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules 37namespace OpenSim.Region.CoreModules.World
37{ 38{
38 public class CloudModule : ICloudModule 39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CloudModule")]
40 public class CloudModule : ICloudModule, INonSharedRegionModule
39 { 41 {
40// private static readonly log4net.ILog m_log 42// private static readonly log4net.ILog m_log
41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules
48 private float m_cloudDensity = 1.0F; 50 private float m_cloudDensity = 1.0F;
49 private float[] cloudCover = new float[16 * 16]; 51 private float[] cloudCover = new float[16 * 16];
50 52
51 public void Initialise(Scene scene, IConfigSource config) 53 public void Initialise(IConfigSource config)
52 { 54 {
53 IConfig cloudConfig = config.Configs["Cloud"]; 55 IConfig cloudConfig = config.Configs["Cloud"];
54 56
@@ -59,21 +61,40 @@ namespace OpenSim.Region.CoreModules
59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 61 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
60 } 62 }
61 63
62 if (m_enabled) 64 }
63 {
64 65
65 m_scene = scene; 66 public void AddRegion(Scene scene)
67 {
68 if (!m_enabled)
69 return;
66 70
67 scene.EventManager.OnNewClient += CloudsToClient; 71 m_scene = scene;
68 scene.RegisterModuleInterface<ICloudModule>(this);
69 scene.EventManager.OnFrame += CloudUpdate;
70 72
71 GenerateCloudCover(); 73 scene.EventManager.OnNewClient += CloudsToClient;
74 scene.RegisterModuleInterface<ICloudModule>(this);
75 scene.EventManager.OnFrame += CloudUpdate;
72 76
73 m_ready = true; 77 GenerateCloudCover();
74 78
75 } 79 m_ready = true;
80 }
81
82 public void RemoveRegion(Scene scene)
83 {
84 if (!m_enabled)
85 return;
76 86
87 m_ready = false;
88 // Remove our hooks
89 m_scene.EventManager.OnNewClient -= CloudsToClient;
90 m_scene.EventManager.OnFrame -= CloudUpdate;
91 m_scene.UnregisterModuleInterface<ICloudModule>(this);
92
93 m_scene = null;
94 }
95
96 public void RegionLoaded(Scene scene)
97 {
77 } 98 }
78 99
79 public void PostInitialise() 100 public void PostInitialise()
@@ -82,13 +103,6 @@ namespace OpenSim.Region.CoreModules
82 103
83 public void Close() 104 public void Close()
84 { 105 {
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 } 106 }
93 107
94 public string Name 108 public string Name
@@ -96,12 +110,11 @@ namespace OpenSim.Region.CoreModules
96 get { return "CloudModule"; } 110 get { return "CloudModule"; }
97 } 111 }
98 112
99 public bool IsSharedModule 113 public Type ReplaceableInterface
100 { 114 {
101 get { return false; } 115 get { return null; }
102 } 116 }
103 117
104
105 public float CloudCover(int x, int y, int z) 118 public float CloudCover(int x, int y, int z)
106 { 119 {
107 float cover = 0f; 120 float cover = 0f;