From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 96 +++++++++++++---------- 1 file changed, 53 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Sun/SunModule.cs') 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; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SunModule : ISunModule { /// @@ -278,27 +280,12 @@ namespace OpenSim.Region.CoreModules return GetCurrentSunHour() + 6.0f; } - #region IRegion Methods + #region INonSharedRegionModule Methods // Called immediately after the module is loaded for a given region // i.e. Immediately after instance creation. - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - m_frame = 0; - - // This one puts an entry in the main help screen - m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); - - // This one enables the ability to type just "sun" without any parameters - m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); - foreach (KeyValuePair kvp in GetParamList()) - { - m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); - } - - - TimeZone local = TimeZone.CurrentTimeZone; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); @@ -346,7 +333,43 @@ namespace OpenSim.Region.CoreModules // m_latitude = d_latitude; // m_longitude = d_longitude; } + } + + public void Close() + { + ready = false; + + // Remove our hooks + m_scene.EventManager.OnFrame -= SunUpdate; + m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; + m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; + } + + public string Name + { + get { return "SunModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + m_scene = scene; + m_frame = 0; + + // This one puts an entry in the main help screen + m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); + // This one enables the ability to type just "sun" without any parameters + m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); + foreach (KeyValuePair kvp in GetParamList()) + { + m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); + } switch (m_RegionMode) { case "T1": @@ -354,8 +377,8 @@ namespace OpenSim.Region.CoreModules case "SL": // Time taken to complete a cycle (day and season) - SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); - SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays); // Ration of real-to-virtual time @@ -364,17 +387,17 @@ namespace OpenSim.Region.CoreModules // Speed of rotation needed to complete a cycle in the // designated period (day and season) - SunSpeed = m_SunCycle/SecondsPerSunCycle; - SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + SunSpeed = m_SunCycle / SecondsPerSunCycle; + SeasonSpeed = m_SeasonalCycle / SecondsPerYear; // Horizon translation - HorizonShift = m_HorizonShift; // Z axis translation + HorizonShift = m_HorizonShift; // Z axis translation // HoursToRadians = (SunCycle/24)*VWTimeRatio; // Insert our event handling hooks - scene.EventManager.OnFrame += SunUpdate; + scene.EventManager.OnFrame += SunUpdate; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; @@ -391,34 +414,21 @@ namespace OpenSim.Region.CoreModules } scene.RegisterModuleInterface(this); - } - - public void PostInitialise() + public void RegionLoaded(Scene scene) { } - public void Close() - { - ready = false; - - // Remove our hooks - m_scene.EventManager.OnFrame -= SunUpdate; - m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; - m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; - } - - public string Name + public void RemoveRegion(Scene scene) { - get { return "SunModule"; } + scene.RegisterModuleInterface(this); + scene.EventManager.OnFrame -= SunUpdate; + scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; + scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; } - public bool IsSharedModule - { - get { return false; } - } #endregion #region EventManager Events -- cgit v1.1