From 1a6694b26487e4b9bd33e1c6c4415fb7d36f0d1d Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Tue, 25 Dec 2012 10:47:45 +0200
Subject: Fixed several problems with the Sun: some settings didn't work, or
were inconsistently used. - The sun position is always calculated by
combining the sun settings in the Region and Estate. This fixes the problem
that 'UseEstateSun' didn't work. - To remove ambiguity, the
EstateToolsSunUpdate event no longer accepts the sun's position as
parameters. That's because the position is always calculated from the Region
and Estate settings. - Use only the 'FixedSun' flag to determine whether the
sun is fixed; not the 'UseGlobalTime' flag. - Don't change the region's
'SunPosition' field according to the sun's position: this field is used only
to set the position when using a FixedSun. (The 'SunVector' field does get
updated according to the sun's position in the sky)
---
OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 44 +++++++++++++----------
1 file changed, 25 insertions(+), 19 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 a321c09..6f344c8 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -252,12 +252,11 @@ namespace OpenSim.Region.CoreModules
}
// TODO: Decouple this, so we can get rid of Linden Hour info
- // Update Region infor with new Sun Position and Hour
+ // Update Region with new Sun Vector
// set estate settings for region access to sun position
if (receivedEstateToolsSunUpdate)
{
m_scene.RegionInfo.RegionSettings.SunVector = Position;
- m_scene.RegionInfo.RegionSettings.SunPosition = GetCurrentTimeAsLindenSunHour();
}
}
@@ -395,7 +394,7 @@ namespace OpenSim.Region.CoreModules
ready = false;
// Remove our hooks
- m_scene.EventManager.OnFrame -= SunUpdate;
+ m_scene.EventManager.OnFrame -= SunUpdate;
m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
@@ -459,26 +458,33 @@ namespace OpenSim.Region.CoreModules
SunToClient(avatar.ControllingClient);
}
- ///
- ///
- ///
- ///
- /// Is the sun's position fixed?
- /// Use the Region or Estate Sun hour?
- /// What hour of the day is the Sun Fixed at?
- public void EstateToolsSunUpdate(ulong regionHandle, bool FixedSun, bool useEstateTime, float FixedSunHour)
+ public void EstateToolsSunUpdate(ulong regionHandle)
{
if (m_scene.RegionInfo.RegionHandle == regionHandle)
{
- // Must limit the Sun Hour to 0 ... 24
- while (FixedSunHour > 24.0f)
- FixedSunHour -= 24;
+ float sunFixedHour;
+ bool fixedSun;
- while (FixedSunHour < 0)
- FixedSunHour += 24;
+ if (m_scene.RegionInfo.RegionSettings.UseEstateSun)
+ {
+ sunFixedHour = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
+ fixedSun = m_scene.RegionInfo.EstateSettings.FixedSun;
+ }
+ else
+ {
+ sunFixedHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f;
+ fixedSun = m_scene.RegionInfo.RegionSettings.FixedSun;
+ }
+
+ // Must limit the Sun Hour to 0 ... 24
+ while (sunFixedHour > 24.0f)
+ sunFixedHour -= 24;
- m_SunFixedHour = FixedSunHour;
- m_SunFixed = FixedSun;
+ while (sunFixedHour < 0)
+ sunFixedHour += 24;
+
+ m_SunFixedHour = sunFixedHour;
+ m_SunFixed = fixedSun;
// m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString());
// m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString());
@@ -501,7 +507,7 @@ namespace OpenSim.Region.CoreModules
{
m_scene.ForEachRootClient(delegate(IClientAPI client)
{
- SunToClient(client);
+ SunToClient(client);
});
}
--
cgit v1.1