diff options
author | Revolution | 2010-01-22 18:09:33 -0600 |
---|---|---|
committer | Melanie | 2010-01-23 15:18:52 +0000 |
commit | ec3c31e61e5e540f822891110df9bc978655bbaf (patch) | |
tree | b0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/CoreModules/World/Wind | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Wind')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Wind/WindModule.cs | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 3283c1f..cd3706d 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs | |||
@@ -55,17 +55,19 @@ namespace OpenSim.Region.CoreModules | |||
55 | 55 | ||
56 | private IWindModelPlugin m_activeWindPlugin = null; | 56 | private IWindModelPlugin m_activeWindPlugin = null; |
57 | private const string m_dWindPluginName = "SimpleRandomWind"; | 57 | private const string m_dWindPluginName = "SimpleRandomWind"; |
58 | private string m_desiredWindPlugin = "SimpleRandomWind"; | ||
58 | private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); | 59 | private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); |
59 | 60 | ||
60 | // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m | 61 | // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m |
61 | private Vector2[] windSpeeds = new Vector2[16 * 16]; | 62 | private Vector2[] windSpeeds = new Vector2[16 * 16]; |
63 | private IConfig windConfig; | ||
62 | 64 | ||
63 | #region IRegion Methods | 65 | #region IRegion Methods |
64 | 66 | ||
65 | public void Initialise(Scene scene, IConfigSource config) | 67 | public void Initialise(IConfigSource config) |
66 | { | 68 | { |
67 | IConfig windConfig = config.Configs["Wind"]; | 69 | windConfig = config.Configs["Wind"]; |
68 | string desiredWindPlugin = m_dWindPluginName; | 70 | m_desiredWindPlugin = m_dWindPluginName; |
69 | 71 | ||
70 | if (windConfig != null) | 72 | if (windConfig != null) |
71 | { | 73 | { |
@@ -76,10 +78,18 @@ namespace OpenSim.Region.CoreModules | |||
76 | // Determine which wind model plugin is desired | 78 | // Determine which wind model plugin is desired |
77 | if (windConfig.Contains("wind_plugin")) | 79 | if (windConfig.Contains("wind_plugin")) |
78 | { | 80 | { |
79 | desiredWindPlugin = windConfig.GetString("wind_plugin"); | 81 | m_desiredWindPlugin = windConfig.GetString("wind_plugin"); |
80 | } | 82 | } |
81 | } | 83 | } |
84 | } | ||
85 | |||
86 | public Type ReplaceableInterface | ||
87 | { | ||
88 | get { return null; } | ||
89 | } | ||
82 | 90 | ||
91 | public void AddRegion(Scene scene) | ||
92 | { | ||
83 | if (m_enabled) | 93 | if (m_enabled) |
84 | { | 94 | { |
85 | m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); | 95 | m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); |
@@ -95,30 +105,30 @@ namespace OpenSim.Region.CoreModules | |||
95 | } | 105 | } |
96 | 106 | ||
97 | // Check for desired plugin | 107 | // Check for desired plugin |
98 | if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) | 108 | if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin)) |
99 | { | 109 | { |
100 | m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; | 110 | m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin]; |
101 | 111 | ||
102 | m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); | 112 | m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin); |
103 | 113 | ||
104 | if (windConfig != null) | 114 | if (windConfig != null) |
105 | { | 115 | { |
106 | m_activeWindPlugin.Initialise(); | 116 | m_activeWindPlugin.Initialise(); |
107 | m_activeWindPlugin.WindConfig(m_scene, windConfig); | 117 | m_activeWindPlugin.WindConfig(m_scene, windConfig); |
108 | } | 118 | } |
109 | } | 119 | } |
110 | 120 | ||
111 | 121 | ||
112 | // if the plug-in wasn't found, default to no wind. | 122 | // if the plug-in wasn't found, default to no wind. |
113 | if (m_activeWindPlugin == null) | 123 | if (m_activeWindPlugin == null) |
114 | { | 124 | { |
115 | m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); | 125 | m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_desiredWindPlugin); |
116 | m_log.ErrorFormat("[WIND] Defaulting to no wind."); | 126 | m_log.ErrorFormat("[WIND] Defaulting to no wind."); |
117 | } | 127 | } |
118 | 128 | ||
119 | // This one puts an entry in the main help screen | 129 | // This one puts an entry in the main help screen |
120 | m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); | 130 | m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); |
121 | 131 | ||
122 | // This one enables the ability to type just the base command without any parameters | 132 | // This one enables the ability to type just the base command without any parameters |
123 | m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); | 133 | m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); |
124 | 134 | ||
@@ -127,7 +137,7 @@ namespace OpenSim.Region.CoreModules | |||
127 | { | 137 | { |
128 | m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); | 138 | m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); |
129 | m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); | 139 | m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); |
130 | 140 | ||
131 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) | 141 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) |
132 | { | 142 | { |
133 | m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); | 143 | m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); |
@@ -149,11 +159,17 @@ namespace OpenSim.Region.CoreModules | |||
149 | m_ready = true; | 159 | m_ready = true; |
150 | 160 | ||
151 | } | 161 | } |
162 | } | ||
152 | 163 | ||
164 | public void RegionLoaded(Scene scene) | ||
165 | { | ||
153 | } | 166 | } |
154 | 167 | ||
155 | public void PostInitialise() | 168 | public void RemoveRegion(Scene scene) |
156 | { | 169 | { |
170 | scene.EventManager.OnFrame -= WindUpdate; | ||
171 | scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; | ||
172 | scene.UnregisterModuleInterface<IWindModule>(this); | ||
157 | } | 173 | } |
158 | 174 | ||
159 | public void Close() | 175 | public void Close() |
@@ -182,11 +198,6 @@ namespace OpenSim.Region.CoreModules | |||
182 | get { return "WindModule"; } | 198 | get { return "WindModule"; } |
183 | } | 199 | } |
184 | 200 | ||
185 | public bool IsSharedModule | ||
186 | { | ||
187 | get { return false; } | ||
188 | } | ||
189 | |||
190 | 201 | ||
191 | #endregion | 202 | #endregion |
192 | 203 | ||