diff options
author | Teravus Ovares | 2008-05-30 05:25:50 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-30 05:25:50 +0000 |
commit | d2aa2be7889f22c5830dad19e44b5b3234d448a0 (patch) | |
tree | 37c4e243426cb75d97de920baaeb5c096a3fb7fb /OpenSim | |
parent | * Updated sun module to only send sun updates to root agents. Because it wa... (diff) | |
download | opensim-SC-d2aa2be7889f22c5830dad19e44b5b3234d448a0.zip opensim-SC-d2aa2be7889f22c5830dad19e44b5b3234d448a0.tar.gz opensim-SC-d2aa2be7889f22c5830dad19e44b5b3234d448a0.tar.bz2 opensim-SC-d2aa2be7889f22c5830dad19e44b5b3234d448a0.tar.xz |
* 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.
Diffstat (limited to 'OpenSim')
3 files changed, 21 insertions, 2 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 331d7c3..d0e56ab 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -199,7 +199,9 @@ namespace OpenSim.Framework | |||
199 | set | 199 | set |
200 | { | 200 | { |
201 | m_sunHour = value; | 201 | m_sunHour = value; |
202 | configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString()); | 202 | |
203 | if (useFixedSun) | ||
204 | configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString()); | ||
203 | } | 205 | } |
204 | } | 206 | } |
205 | 207 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 6c63c36..96ae065 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -183,7 +183,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
183 | // Time of day / fixed sun | 183 | // Time of day / fixed sun |
184 | m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; | 184 | m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; |
185 | m_scene.RegionInfo.EstateSettings.sunHour = SunHour; | 185 | m_scene.RegionInfo.EstateSettings.sunHour = SunHour; |
186 | 186 | //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); | |
187 | //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); | ||
187 | sendRegionInfoPacketToAll(); | 188 | sendRegionInfoPacketToAll(); |
188 | } | 189 | } |
189 | 190 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index 6e8c28a..889be97 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | |||
@@ -94,6 +94,9 @@ namespace OpenSim.Region.Environment.Modules | |||
94 | private LLVector3 Position = new LLVector3(0,0,0); | 94 | private LLVector3 Position = new LLVector3(0,0,0); |
95 | private LLVector3 Velocity = new LLVector3(0,0,0); | 95 | private LLVector3 Velocity = new LLVector3(0,0,0); |
96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); | 96 | private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); |
97 | private float LindenEstateHour = 6f; | ||
98 | private bool sunFixed = false; | ||
99 | private long estateTicksOffset = 0; | ||
97 | 100 | ||
98 | private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); | 101 | private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); |
99 | 102 | ||
@@ -101,9 +104,21 @@ namespace OpenSim.Region.Environment.Modules | |||
101 | private ulong CurrentTime | 104 | private ulong CurrentTime |
102 | { | 105 | { |
103 | get { | 106 | get { |
107 | |||
104 | return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000); | 108 | return (ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset)/10000000); |
105 | } | 109 | } |
106 | } | 110 | } |
111 | private float GetLindenEstateHourFromCurrentTime() | ||
112 | { | ||
113 | float ticksleftover = ((float)((ulong)(((System.DateTime.Now.Ticks) - TicksToEpoch + TicksOffset) / 10000000))) % ((float)SecondsPerSunCycle); | ||
114 | //m_log.Debug("[TICKS]: " + ticksleftover.ToString()); | ||
115 | float hour = (24 * (ticksleftover / SecondsPerSunCycle)) + 6; | ||
116 | //m_log.Debug("[LINDENHOUR]: " + hour.ToString()); | ||
117 | //m_log.Debug("[SunCycle]: " + (ticksleftover / 3600)); | ||
118 | //m_log.Debug("[DayLength]: " + m_day_length.ToString()); | ||
119 | |||
120 | return hour; | ||
121 | } | ||
107 | 122 | ||
108 | // Called immediately after the module is loaded for a given region | 123 | // Called immediately after the module is loaded for a given region |
109 | // i.e. Immediately after instance creation. | 124 | // i.e. Immediately after instance creation. |
@@ -256,6 +271,7 @@ namespace OpenSim.Region.Environment.Modules | |||
256 | 271 | ||
257 | // set estate settings for region access to sun position | 272 | // set estate settings for region access to sun position |
258 | m_scene.RegionInfo.EstateSettings.sunPosition = Position; | 273 | m_scene.RegionInfo.EstateSettings.sunPosition = Position; |
274 | m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime(); | ||
259 | } | 275 | } |
260 | 276 | ||
261 | /// <summary> | 277 | /// <summary> |