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/Sun | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 0712a7f..948c47c 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules | 39 | namespace OpenSim.Region.CoreModules |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
40 | public class SunModule : ISunModule | 42 | public class SunModule : ISunModule |
41 | { | 43 | { |
42 | /// <summary> | 44 | /// <summary> |
@@ -278,27 +280,12 @@ namespace OpenSim.Region.CoreModules | |||
278 | return GetCurrentSunHour() + 6.0f; | 280 | return GetCurrentSunHour() + 6.0f; |
279 | } | 281 | } |
280 | 282 | ||
281 | #region IRegion Methods | 283 | #region INonSharedRegionModule Methods |
282 | 284 | ||
283 | // Called immediately after the module is loaded for a given region | 285 | // Called immediately after the module is loaded for a given region |
284 | // i.e. Immediately after instance creation. | 286 | // i.e. Immediately after instance creation. |
285 | public void Initialise(Scene scene, IConfigSource config) | 287 | public void Initialise(IConfigSource config) |
286 | { | 288 | { |
287 | m_scene = scene; | ||
288 | m_frame = 0; | ||
289 | |||
290 | // This one puts an entry in the main help screen | ||
291 | m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); | ||
292 | |||
293 | // This one enables the ability to type just "sun" without any parameters | ||
294 | m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); | ||
295 | foreach (KeyValuePair<string, string> kvp in GetParamList()) | ||
296 | { | ||
297 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); | ||
298 | } | ||
299 | |||
300 | |||
301 | |||
302 | TimeZone local = TimeZone.CurrentTimeZone; | 289 | TimeZone local = TimeZone.CurrentTimeZone; |
303 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | 290 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; |
304 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); | 291 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); |
@@ -346,7 +333,43 @@ namespace OpenSim.Region.CoreModules | |||
346 | // m_latitude = d_latitude; | 333 | // m_latitude = d_latitude; |
347 | // m_longitude = d_longitude; | 334 | // m_longitude = d_longitude; |
348 | } | 335 | } |
336 | } | ||
337 | |||
338 | public void Close() | ||
339 | { | ||
340 | ready = false; | ||
341 | |||
342 | // Remove our hooks | ||
343 | m_scene.EventManager.OnFrame -= SunUpdate; | ||
344 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
345 | m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; | ||
346 | m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; | ||
347 | } | ||
348 | |||
349 | public string Name | ||
350 | { | ||
351 | get { return "SunModule"; } | ||
352 | } | ||
353 | |||
354 | public Type ReplaceableInterface | ||
355 | { | ||
356 | get { return null; } | ||
357 | } | ||
358 | |||
359 | public void AddRegion(Scene scene) | ||
360 | { | ||
361 | m_scene = scene; | ||
362 | m_frame = 0; | ||
363 | |||
364 | // This one puts an entry in the main help screen | ||
365 | m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); | ||
349 | 366 | ||
367 | // This one enables the ability to type just "sun" without any parameters | ||
368 | m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); | ||
369 | foreach (KeyValuePair<string, string> kvp in GetParamList()) | ||
370 | { | ||
371 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); | ||
372 | } | ||
350 | switch (m_RegionMode) | 373 | switch (m_RegionMode) |
351 | { | 374 | { |
352 | case "T1": | 375 | case "T1": |
@@ -354,8 +377,8 @@ namespace OpenSim.Region.CoreModules | |||
354 | case "SL": | 377 | case "SL": |
355 | // Time taken to complete a cycle (day and season) | 378 | // Time taken to complete a cycle (day and season) |
356 | 379 | ||
357 | SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); | 380 | SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60); |
358 | SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); | 381 | SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays); |
359 | 382 | ||
360 | // Ration of real-to-virtual time | 383 | // Ration of real-to-virtual time |
361 | 384 | ||
@@ -364,17 +387,17 @@ namespace OpenSim.Region.CoreModules | |||
364 | // Speed of rotation needed to complete a cycle in the | 387 | // Speed of rotation needed to complete a cycle in the |
365 | // designated period (day and season) | 388 | // designated period (day and season) |
366 | 389 | ||
367 | SunSpeed = m_SunCycle/SecondsPerSunCycle; | 390 | SunSpeed = m_SunCycle / SecondsPerSunCycle; |
368 | SeasonSpeed = m_SeasonalCycle/SecondsPerYear; | 391 | SeasonSpeed = m_SeasonalCycle / SecondsPerYear; |
369 | 392 | ||
370 | // Horizon translation | 393 | // Horizon translation |
371 | 394 | ||
372 | HorizonShift = m_HorizonShift; // Z axis translation | 395 | HorizonShift = m_HorizonShift; // Z axis translation |
373 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; | 396 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; |
374 | 397 | ||
375 | // Insert our event handling hooks | 398 | // Insert our event handling hooks |
376 | 399 | ||
377 | scene.EventManager.OnFrame += SunUpdate; | 400 | scene.EventManager.OnFrame += SunUpdate; |
378 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 401 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
379 | scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; | 402 | scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; |
380 | scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; | 403 | scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; |
@@ -391,34 +414,21 @@ namespace OpenSim.Region.CoreModules | |||
391 | } | 414 | } |
392 | 415 | ||
393 | scene.RegisterModuleInterface<ISunModule>(this); | 416 | scene.RegisterModuleInterface<ISunModule>(this); |
394 | |||
395 | } | 417 | } |
396 | 418 | ||
397 | 419 | public void RegionLoaded(Scene scene) | |
398 | public void PostInitialise() | ||
399 | { | 420 | { |
400 | } | 421 | } |
401 | 422 | ||
402 | public void Close() | 423 | public void RemoveRegion(Scene scene) |
403 | { | ||
404 | ready = false; | ||
405 | |||
406 | // Remove our hooks | ||
407 | m_scene.EventManager.OnFrame -= SunUpdate; | ||
408 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
409 | m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; | ||
410 | m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; | ||
411 | } | ||
412 | |||
413 | public string Name | ||
414 | { | 424 | { |
415 | get { return "SunModule"; } | 425 | scene.RegisterModuleInterface<ISunModule>(this); |
426 | scene.EventManager.OnFrame -= SunUpdate; | ||
427 | scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
428 | scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; | ||
429 | scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; | ||
416 | } | 430 | } |
417 | 431 | ||
418 | public bool IsSharedModule | ||
419 | { | ||
420 | get { return false; } | ||
421 | } | ||
422 | #endregion | 432 | #endregion |
423 | 433 | ||
424 | #region EventManager Events | 434 | #region EventManager Events |