diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 06b95b9501..64882daffc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -128,6 +128,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected IMaterialsModule m_materialsModule = null; + protected IEnvironmentModule m_envModule = null; protected Dictionary m_userInfoCache = new Dictionary(); protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. @@ -313,6 +314,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_SoundModule = m_ScriptEngine.World.RequestModuleInterface(); m_materialsModule = m_ScriptEngine.World.RequestModuleInterface(); + m_envModule = m_ScriptEngine.World.RequestModuleInterface< IEnvironmentModule>(); + AsyncCommands = new AsyncCommandManager(m_ScriptEngine); } @@ -5694,14 +5697,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ParentGroup.RootPart.aggregateScriptEvents(); } - public LSL_Vector llGetSunDirection() - { - m_host.AddScriptLPS(1); - - Vector3 sun = World.RegionInfo.RegionSettings.SunVector; - return new LSL_Vector(sun); - } - public LSL_Vector llGetTextureOffset(int face) { m_host.AddScriptLPS(1); @@ -17432,6 +17427,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetAnimationOverride(LSL_String animState) { + m_host.AddScriptLPS(1); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence == null) return String.Empty; @@ -17483,9 +17480,139 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } + public LSL_Integer llGetDayLength() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return 14400; + + return m_envModule.GetRegionDayLength(); + } + + public LSL_Integer llGetRegionDayLength() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return 14400; + + return m_envModule.GetRegionDayLength(); + } + + public LSL_Integer llGetDayOffset() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return 57600; + + return m_envModule.GetRegionDayOffset(); + } + + public LSL_Integer llGetRegionDayOffset() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return 57600; + + return m_envModule.GetRegionDayOffset(); + } + + public LSL_Vector llGetSunDirection() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Vector3.Zero; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionSunDir(z); + } + + public LSL_Vector llGetRegionSunDirection() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Vector3.Zero; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionSunDir(z); + } + + public LSL_Vector llGetMoonDirection() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Vector3.Zero; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionMoonDir(z); + } + + public LSL_Vector llGetRegionMoonDirection() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Vector3.Zero; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionMoonDir(z); + } + + public LSL_Rotation llGetSunRotation() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Quaternion.Identity; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionSunRot(z); + } + + public LSL_Rotation llGetRegionSunRotation() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Quaternion.Identity; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionSunRot(z); + } + + public LSL_Rotation llGetMoonRotation() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Quaternion.Identity; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionMoonRot(z); + } + + public LSL_Rotation llGetRegionMoonRotation() + { + m_host.AddScriptLPS(1); + + if (m_envModule == null) + return Quaternion.Identity; + + float z = m_host.GetWorldPosition().Z; + return m_envModule.GetRegionMoonRot(z); + } + public LSL_List llJson2List(LSL_String json) { - if(String.IsNullOrEmpty(json)) + m_host.AddScriptLPS(1); + + if (String.IsNullOrEmpty(json)) return new LSL_List(); if(json == "[]") return new LSL_List(); @@ -18372,5 +18499,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 205e5d58a3..8f0b8439e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -205,7 +205,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llGetStartParameter(); LSL_Integer llGetStatus(int status); LSL_String llGetSubString(string src, int start, int end); - LSL_Vector llGetSunDirection(); LSL_String llGetTexture(int face); LSL_Vector llGetTextureOffset(int face); LSL_Float llGetTextureRot(int side); @@ -461,5 +460,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llList2Json(LSL_String type, LSL_List values); LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value); LSL_String llJsonValueType(LSL_String json, LSL_List specifiers); + + + LSL_Integer llGetDayLength(); + LSL_Integer llGetRegionDayLength(); + LSL_Integer llGetDayOffset(); + LSL_Integer llGetRegionDayOffset(); + LSL_Vector llGetSunDirection(); + LSL_Vector llGetRegionSunDirection(); + LSL_Vector llGetMoonDirection(); + LSL_Vector llGetRegionMoonDirection(); + LSL_Rotation llGetSunRotation(); + LSL_Rotation llGetRegionSunRotation(); + LSL_Rotation llGetMoonRotation(); + LSL_Rotation llGetRegionMoonRotation(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index ff5b4c3473..2cb9b5a93d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -821,11 +821,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetSubString(src, start, end); } - public LSL_Vector llGetSunDirection() - { - return m_LSL_Functions.llGetSunDirection(); - } - public LSL_String llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); @@ -2110,5 +2105,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llJsonValueType(json, specifiers); } + + public LSL_Integer llGetDayLength() + { + return m_LSL_Functions.llGetDayLength(); + } + + public LSL_Integer llGetRegionDayLength() + { + return m_LSL_Functions.llGetRegionDayLength(); + } + + public LSL_Integer llGetDayOffset() + { + return m_LSL_Functions.llGetDayOffset(); + } + + public LSL_Integer llGetRegionDayOffset() + { + return m_LSL_Functions.llGetRegionDayOffset(); + } + + public LSL_Vector llGetSunDirection() + { + return m_LSL_Functions.llGetSunDirection(); + } + + public LSL_Vector llGetRegionSunDirection() + { + return m_LSL_Functions.llGetRegionSunDirection(); + } + + public LSL_Vector llGetMoonDirection() + { + return m_LSL_Functions.llGetMoonDirection(); + } + + public LSL_Vector llGetRegionMoonDirection() + { + return m_LSL_Functions.llGetRegionMoonDirection(); + } + + public LSL_Rotation llGetSunRotation() + { + return m_LSL_Functions.llGetSunRotation(); + } + + public LSL_Rotation llGetRegionSunRotation() + { + return m_LSL_Functions.llGetRegionSunRotation(); + } + + public LSL_Rotation llGetMoonRotation() + { + return m_LSL_Functions.llGetMoonRotation(); + } + + public LSL_Rotation llGetRegionMoonRotation() + { + return m_LSL_Functions.llGetRegionMoonRotation(); + } } }