From ddbf81fa07aac8098d9fa8d979969fffd5436f75 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 13 Mar 2009 23:45:02 +0000 Subject: Thank you, mcortez, for a patch that fixes a number of long standing issues with the sun module. Fixes Mantis #3295 --- .../Shared/Api/Implementation/OSSL_Api.cs | 27 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 34 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e96dd26..6b3afe0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -754,6 +754,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + /// + /// Changes the Region Sun Settings, then Triggers a Sun Update + /// + /// True to use Estate Sun instead of Region Sun + /// True to keep the sun stationary + /// The "Sun Hour" that is desired, 0...24, with 0 just after SunRise + public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) + { + CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); + + m_host.AddScriptLPS(1); + //Check to make sure that the script's owner is the estate manager/master + //World.Permissions.GenericEstatePermission( + if (World.Permissions.IsGod(m_host.OwnerID)) + { + World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; + World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 + World.RegionInfo.RegionSettings.FixedSun = sunFixed; + World.RegionInfo.RegionSettings.Save(); + + World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); + } + } + + + + public double osList2Double(LSL_Types.list src, int index) { // There is really no double type in OSSL. C# and other diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 6eccf51..3656f92 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -95,7 +95,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetStateEvents(int events); double osList2Double(LSL_Types.list src, int index); + void osSetRegionWaterHeight(double height); + void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); string osGetScriptEngineName(); string osGetSimulatorVersion(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 318ec2f..d316ac9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -62,6 +62,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osSetRegionWaterHeight(height); } + public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) + { + m_OSSL_Functions.osSetRegionSunSettings(useEstateSun, sunFixed, sunHour); + } + public double osList2Double(LSL_Types.list src, int index) { return m_OSSL_Functions.osList2Double(src, index); -- cgit v1.1