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/Framework/Scenes/EventManager.cs | 13 +++++------- OpenSim/Region/Framework/Scenes/Scene.cs | 28 +------------------------ 2 files changed, 6 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4c49b71..6b08e0f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes public event ScriptTimerEvent OnScriptTimerEvent; */ - public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); + public delegate void EstateToolsSunUpdate(ulong regionHandle); public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); public event EstateToolsSunUpdate OnEstateToolsSunUpdate; @@ -2507,13 +2507,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Updates the system as to how the position of the sun should be handled. + /// Called when the sun's position parameters have changed in the Region and/or Estate /// - /// - /// True if the Sun Position is fixed - /// True if the Estate Settings should be used instead of region - /// The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1 - public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) + /// The region that changed + public void TriggerEstateToolsSunUpdate(ulong regionHandle) { EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; if (handlerEstateToolsSunUpdate != null) @@ -2522,7 +2519,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(regionHandle, FixedTime, useEstateTime, FixedSunHour); + d(regionHandle); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cca295c..11b63b7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5345,33 +5345,7 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerEstateSunUpdate() { - float sun; - if (RegionInfo.RegionSettings.UseEstateSun) - { - sun = (float)RegionInfo.EstateSettings.SunPosition; - if (RegionInfo.EstateSettings.UseGlobalTime) - { - sun = EventManager.GetCurrentTimeAsSunLindenHour() - 6.0f; - } - - // - EventManager.TriggerEstateToolsSunUpdate( - RegionInfo.RegionHandle, - RegionInfo.EstateSettings.FixedSun, - RegionInfo.RegionSettings.UseEstateSun, - sun); - } - else - { - // Use the Sun Position from the Region Settings - sun = (float)RegionInfo.RegionSettings.SunPosition - 6.0f; - - EventManager.TriggerEstateToolsSunUpdate( - RegionInfo.RegionHandle, - RegionInfo.RegionSettings.FixedSun, - RegionInfo.RegionSettings.UseEstateSun, - sun); - } + EventManager.TriggerEstateToolsSunUpdate(RegionInfo.RegionHandle); } private void HandleReloadEstate(string module, string[] cmd) -- cgit v1.1