mantis 8770: let osGetSunParam(day_length) return the same as llGetDayLength() ie day length at prim location

This commit is contained in:
UbitUmarov
2020-09-12 16:14:01 +01:00
parent 7c44bb1780
commit 64fea8f20c
3 changed files with 20 additions and 10 deletions

View File

@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return GetSunParam(param);
}
public double osGetSunParam(string param)
public LSL_Float osGetSunParam(LSL_String param)
{
CheckThreatLevel();
return GetSunParam(param);
@@ -1646,15 +1646,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private double GetSunParam(string param)
{
double value = 0.0;
ISunModule module = World.RequestModuleInterface<ISunModule>();
if (module != null)
param = param.ToLower();
switch(param)
{
value = module.GetSunParameter(param);
case "day_length":
if (m_envModule == null)
return 14400;
return m_envModule.GetDayLength(m_host.AbsolutePosition);
case "year_length":
return 365;
case "day_night_offset":
return 0;
case "update_interval":
return 0.1;
case "day_time_sun_hour_scale":
return 1;
default:
break;
}
return value;
return 0;
}
public void osSunSetParam(string param, double value)

View File

@@ -250,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour);
void osSetEstateSunSettings(bool sunFixed, double sunHour);
LSL_Float osGetCurrentSunHour();
double osGetSunParam(string param);
LSL_Float osGetSunParam(LSL_String param);
double osSunGetParam(string param); // Deprecated
void osSetSunParam(string param, double value);
void osSunSetParam(string param, double value); // Deprecated

View File

@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetCurrentSunHour();
}
public double osGetSunParam(string param)
public LSL_Float osGetSunParam(LSL_String param)
{
return m_OSSL_Functions.osGetSunParam(param);
}