Converted the SunModule to the new region module interface. (39 to go...)

integration
Diva Canto 2012-11-09 15:38:10 -08:00
parent 64c80aec64
commit 7dfd1468cc
2 changed files with 29 additions and 21 deletions

View File

@ -267,13 +267,12 @@ namespace OpenSim.Region.CoreModules
return GetCurrentSunHour() + 6.0f; return GetCurrentSunHour() + 6.0f;
} }
#region IRegion Methods #region INonSharedRegion Methods
// Called immediately after the module is loaded for a given region // Called immediately after the module is loaded for a given region
// i.e. Immediately after instance creation. // i.e. Immediately after instance creation.
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_scene = scene;
m_frame = 0; m_frame = 0;
// This one puts an entry in the main help screen // This one puts an entry in the main help screen
@ -358,15 +357,6 @@ namespace OpenSim.Region.CoreModules
HorizonShift = m_HorizonShift; // Z axis translation HorizonShift = m_HorizonShift; // Z axis translation
// HoursToRadians = (SunCycle/24)*VWTimeRatio; // HoursToRadians = (SunCycle/24)*VWTimeRatio;
// Insert our event handling hooks
scene.EventManager.OnFrame += SunUpdate;
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
ready = true;
m_log.Debug("[SUN]: Mode is " + m_RegionMode); m_log.Debug("[SUN]: Mode is " + m_RegionMode);
m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
@ -376,14 +366,29 @@ namespace OpenSim.Region.CoreModules
break; break;
} }
scene.RegisterModuleInterface<ISunModule>(this);
} }
public void PostInitialise() public Type ReplaceableInterface
{ {
get { return null; }
} }
public void Close() public void AddRegion(Scene scene)
{
m_scene = scene;
// Insert our event handling hooks
scene.EventManager.OnFrame += SunUpdate;
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
scene.RegisterModuleInterface<ISunModule>(this);
ready = true;
}
public void RemoveRegion(Scene scene)
{ {
ready = false; ready = false;
@ -394,16 +399,19 @@ namespace OpenSim.Region.CoreModules
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
} }
public void RegionLoaded(Scene scene)
{
}
public void Close()
{
}
public string Name public string Name
{ {
get { return "SunModule"; } get { return "SunModule"; }
} }
public bool IsSharedModule
{
get { return false; }
}
#endregion #endregion
#region EventManager Events #region EventManager Events

View File

@ -29,7 +29,7 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface ISunModule : IRegionModule public interface ISunModule : INonSharedRegionModule
{ {
double GetSunParameter(string param); double GetSunParameter(string param);