* Added helper method to the Sun module to Get the Linden hour based on the math in the sun module. This populates the sun phase slider on the terrain tab in the estate tools according to the current sun phase. Display purposes only for now. Need to go the other way for setting the sun phase based on the linden hour in the estate tools.

0.6.0-stable
Teravus Ovares 2008-05-30 05:25:50 +00:00
parent cdfb1f3623
commit d2aa2be788
3 changed files with 21 additions and 2 deletions

View File

@ -199,7 +199,9 @@ namespace OpenSim.Framework
set set
{ {
m_sunHour = value; m_sunHour = value;
configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString());
if (useFixedSun)
configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString());
} }
} }

View File

@ -183,7 +183,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
// Time of day / fixed sun // Time of day / fixed sun
m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun;
m_scene.RegionInfo.EstateSettings.sunHour = SunHour; m_scene.RegionInfo.EstateSettings.sunHour = SunHour;
//m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
//m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString());
sendRegionInfoPacketToAll(); sendRegionInfoPacketToAll();
} }

View File

@ -94,6 +94,9 @@ namespace OpenSim.Region.Environment.Modules
private LLVector3 Position = new LLVector3(0,0,0); private LLVector3 Position = new LLVector3(0,0,0);
private LLVector3 Velocity = new LLVector3(0,0,0); private LLVector3 Velocity = new LLVector3(0,0,0);
private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); private LLQuaternion Tilt = new LLQuaternion(1,0,0,0);
private float LindenEstateHour = 6f;
private bool sunFixed = false;
private long estateTicksOffset = 0;
private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
@ -101,9 +104,21 @@ namespace OpenSim.Region.Environment.Modules
private ulong CurrentTime private ulong CurrentTime
{ {
get { get {
return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000); return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000);
} }
} }
private float GetLindenEstateHourFromCurrentTime()
{
float ticksleftover = ((float)((ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset) / 10000000))) % ((float)SecondsPerSunCycle);
//m_log.Debug("[TICKS]: " + ticksleftover.ToString());
float hour = (24 * (ticksleftover / SecondsPerSunCycle)) + 6;
//m_log.Debug("[LINDENHOUR]: " + hour.ToString());
//m_log.Debug("[SunCycle]: " + (ticksleftover / 3600));
//m_log.Debug("[DayLength]: " + m_day_length.ToString());
return hour;
}
// 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.
@ -256,6 +271,7 @@ namespace OpenSim.Region.Environment.Modules
// set estate settings for region access to sun position // set estate settings for region access to sun position
m_scene.RegionInfo.EstateSettings.sunPosition = Position; m_scene.RegionInfo.EstateSettings.sunPosition = Position;
m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime();
} }
/// <summary> /// <summary>