diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 114 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f4be267..8776524 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -807,6 +807,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
807 | //World.Permissions.GenericEstatePermission( | 807 | //World.Permissions.GenericEstatePermission( |
808 | if (World.Permissions.IsGod(m_host.OwnerID)) | 808 | if (World.Permissions.IsGod(m_host.OwnerID)) |
809 | { | 809 | { |
810 | while (sunHour > 24.0) | ||
811 | sunHour -= 24.0; | ||
812 | |||
813 | while (sunHour < 0) | ||
814 | sunHour += 24.0; | ||
815 | |||
816 | |||
810 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 817 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
811 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 818 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
812 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 819 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
@@ -816,6 +823,87 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
816 | } | 823 | } |
817 | } | 824 | } |
818 | 825 | ||
826 | /// <summary> | ||
827 | /// Changes the Estate Sun Settings, then Triggers a Sun Update | ||
828 | /// </summary> | ||
829 | /// <param name="sunFixed">True to keep the sun stationary, false to use global time</param> | ||
830 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | ||
831 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | ||
832 | { | ||
833 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | ||
834 | |||
835 | m_host.AddScriptLPS(1); | ||
836 | //Check to make sure that the script's owner is the estate manager/master | ||
837 | //World.Permissions.GenericEstatePermission( | ||
838 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
839 | { | ||
840 | while (sunHour > 24.0) | ||
841 | sunHour -= 24.0; | ||
842 | |||
843 | while (sunHour < 0) | ||
844 | sunHour += 24.0; | ||
845 | |||
846 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | ||
847 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | ||
848 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
849 | World.RegionInfo.EstateSettings.Save(); | ||
850 | |||
851 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
852 | } | ||
853 | } | ||
854 | |||
855 | /// <summary> | ||
856 | /// Return the current Sun Hour 0...24, with 0 being roughly sun-rise | ||
857 | /// </summary> | ||
858 | /// <returns></returns> | ||
859 | public double osGetCurrentSunHour() | ||
860 | { | ||
861 | CheckThreatLevel(ThreatLevel.None, "osGetCurrentSunHour"); | ||
862 | |||
863 | m_host.AddScriptLPS(1); | ||
864 | |||
865 | // Must adjust for the fact that Region Sun Settings are still LL offset | ||
866 | double sunHour = World.RegionInfo.RegionSettings.SunPosition - 6; | ||
867 | |||
868 | // See if the sun module has registered itself, if so it's authoritative | ||
869 | ISunModule module = World.RequestModuleInterface<ISunModule>(); | ||
870 | if (module != null) | ||
871 | { | ||
872 | sunHour = module.GetCurrentSunHour(); | ||
873 | } | ||
874 | |||
875 | return sunHour; | ||
876 | } | ||
877 | |||
878 | public double osSunGetParam(string param) | ||
879 | { | ||
880 | CheckThreatLevel(ThreatLevel.None, "osSunGetParam"); | ||
881 | m_host.AddScriptLPS(1); | ||
882 | |||
883 | double value = 0.0; | ||
884 | |||
885 | ISunModule module = World.RequestModuleInterface<ISunModule>(); | ||
886 | if (module != null) | ||
887 | { | ||
888 | value = module.GetSunParameter(param); | ||
889 | } | ||
890 | |||
891 | return value; | ||
892 | } | ||
893 | |||
894 | public void osSunSetParam(string param, double value) | ||
895 | { | ||
896 | CheckThreatLevel(ThreatLevel.None, "osSunSetParam"); | ||
897 | m_host.AddScriptLPS(1); | ||
898 | |||
899 | ISunModule module = World.RequestModuleInterface<ISunModule>(); | ||
900 | if (module != null) | ||
901 | { | ||
902 | module.SetSunParameter(param, value); | ||
903 | } | ||
904 | |||
905 | } | ||
906 | |||
819 | 907 | ||
820 | 908 | ||
821 | 909 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 3656f92..7a7b922 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -98,6 +98,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
98 | 98 | ||
99 | void osSetRegionWaterHeight(double height); | 99 | void osSetRegionWaterHeight(double height); |
100 | void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); | 100 | void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); |
101 | void osSetEstateSunSettings(bool sunFixed, double sunHour); | ||
102 | double osGetCurrentSunHour(); | ||
103 | double osSunGetParam(string param); | ||
104 | void osSunSetParam(string param, double value); | ||
105 | |||
101 | 106 | ||
102 | string osGetScriptEngineName(); | 107 | string osGetScriptEngineName(); |
103 | string osGetSimulatorVersion(); | 108 | 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 d316ac9..a50b6f2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -67,6 +67,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
67 | m_OSSL_Functions.osSetRegionSunSettings(useEstateSun, sunFixed, sunHour); | 67 | m_OSSL_Functions.osSetRegionSunSettings(useEstateSun, sunFixed, sunHour); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | ||
71 | { | ||
72 | m_OSSL_Functions.osSetEstateSunSettings(sunFixed, sunHour); | ||
73 | } | ||
74 | |||
75 | public double osGetCurrentSunHour() | ||
76 | { | ||
77 | return m_OSSL_Functions.osGetCurrentSunHour(); | ||
78 | } | ||
79 | |||
80 | public double osSunGetParam(string param) | ||
81 | { | ||
82 | return m_OSSL_Functions.osSunGetParam(param); | ||
83 | } | ||
84 | |||
85 | public void osSunSetParam(string param, double value) | ||
86 | { | ||
87 | m_OSSL_Functions.osSunSetParam(param, value); | ||
88 | } | ||
89 | |||
90 | |||
70 | public double osList2Double(LSL_Types.list src, int index) | 91 | public double osList2Double(LSL_Types.list src, int index) |
71 | { | 92 | { |
72 | return m_OSSL_Functions.osList2Double(src, index); | 93 | return m_OSSL_Functions.osList2Double(src, index); |