Update Sun options in OpenSim.ini.example. Minor cleanup in SunModule.cs.

0.6.0-stable
Jeff Ames 2008-10-28 02:34:03 +00:00
parent 9a36afec6e
commit 1342e89a8f
2 changed files with 12 additions and 13 deletions

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules
private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>();
// Current time in elpased seconds since Jan 1st 1970 // Current time in elapsed seconds since Jan 1st 1970
private ulong CurrentTime private ulong CurrentTime
{ {
get { get {
@ -145,14 +145,12 @@ namespace OpenSim.Region.Environment.Modules
LindenHourOffset = (long)((float)offsethours * (36000000000/m_day_length)); LindenHourOffset = (long)((float)offsethours * (36000000000/m_day_length));
m_log.Info("[SUN]: Directive from the Estate Tools to set the sun phase to LindenHour " + GetLindenEstateHourFromCurrentTime().ToString()); m_log.Info("[SUN]: Directive from the Estate Tools to set the sun phase to LindenHour " + GetLindenEstateHourFromCurrentTime().ToString());
} }
// 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(Scene scene, IConfigSource config)
{ {
m_log.Debug("[SUN] Initializing"); m_log.Debug("[SUN] Initializing");
m_scene = scene; m_scene = scene;
@ -176,7 +174,7 @@ namespace OpenSim.Region.Environment.Modules
// m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude);
// Mode: determines how the sun is handled // Mode: determines how the sun is handled
// m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude);
// Day length in decimal hours // Year length in days
m_year_length = config.Configs["Sun"].GetInt("year_length", d_year_length); m_year_length = config.Configs["Sun"].GetInt("year_length", d_year_length);
// Day length in decimal hours // Day length in decimal hours
m_day_length = config.Configs["Sun"].GetDouble("day_length", d_day_length); m_day_length = config.Configs["Sun"].GetDouble("day_length", d_day_length);
@ -304,6 +302,7 @@ namespace OpenSim.Region.Environment.Modules
m_scene.RegionInfo.RegionSettings.SunVector = Position; m_scene.RegionInfo.RegionSettings.SunVector = Position;
//m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime(); //m_scene.RegionInfo.EstateSettings.sunHour = GetLindenEstateHourFromCurrentTime();
} }
public void ForceSunUpdateToAllClients() public void ForceSunUpdateToAllClients()
{ {
GenSunPos(); // Generate shared values once GenSunPos(); // Generate shared values once
@ -319,13 +318,12 @@ namespace OpenSim.Region.Environment.Modules
m_scene.RegionInfo.RegionSettings.SunVector = Position; m_scene.RegionInfo.RegionSettings.SunVector = Position;
m_scene.RegionInfo.RegionSettings.SunPosition = GetLindenEstateHourFromCurrentTime(); m_scene.RegionInfo.RegionSettings.SunPosition = GetLindenEstateHourFromCurrentTime();
} }
/// <summary> /// <summary>
/// Calculate the sun's orbital position and its velocity. /// Calculate the sun's orbital position and its velocity.
/// </summary> /// </summary>
private void GenSunPos() private void GenSunPos()
{ {
TotalDistanceTravelled = SunSpeed * CurrentTime; // distance measured in radians TotalDistanceTravelled = SunSpeed * CurrentTime; // distance measured in radians
OrbitalPosition = (float) (TotalDistanceTravelled%SunCycle); // position measured in radians OrbitalPosition = (float) (TotalDistanceTravelled%SunCycle); // position measured in radians
@ -435,8 +433,6 @@ namespace OpenSim.Region.Environment.Modules
sunFixed = FixedTime; sunFixed = FixedTime;
if (sunFixed) if (sunFixed)
GenSunPos(); GenSunPos();
} }
} }
} }

View File

@ -487,11 +487,14 @@ asterisk_salt = paluempalum
; in the Sim. The defaults are what is shown below ; in the Sim. The defaults are what is shown below
;[Sun] ;[Sun]
; number of wall clock hours for an opensim day. 24.0 would mean realtime ; number of wall clock hours for an opensim day. 24.0 would mean realtime
;day_length = 0.5 ;day_length = 4
; Year length in days
; send a Sun update ever frame_rate # of frames. A lower number will ;year_length = 60
; Day to Night Ratio
;day_night_offset = 0.45
; send a Sun update every update_interval # of frames. A lower number will
; make for smoother sun transition at the cost of network ; make for smoother sun transition at the cost of network
;frame_rate = 100 ;update_interval = 100
[ScriptEngine.DotNetEngine] [ScriptEngine.DotNetEngine]