From 78fd487a705c91720991a7572b860567f36366c4 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Tue, 10 Apr 2012 21:49:43 +0200 Subject: New OS scripting functions osSetTerrainTexture and osSetTerrainHeight as originally proposed in SL Jira (https://jira.secondlife.com/browse/SVC-244). --- .../Shared/Api/Implementation/OSSL_Api.cs | 55 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++ 3 files changed, 68 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a5dcba4..339166b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3049,5 +3049,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.TRUE; } + + /// + /// Sets terrain estate texture + /// + /// + /// + /// + public void osSetTerrainTexture(int level, LSL_Key texture) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); + + 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)) + { + if (level < 0 || level > 3) + return; + + UUID textureID = new UUID(); + if (!UUID.TryParse(texture, out textureID)) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainBaseTexture(level, textureID); + } + } + + /// + /// Sets terrain heights of estate + /// + /// + /// + /// + /// + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); + + 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)) + { + if (corner < 0 || corner > 3) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 30bd3ef..545bbee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer osInviteToGroup(LSL_Key agentId); LSL_Integer osEjectFromGroup(LSL_Key agentId); + + void osSetTerrainTexture(int level, LSL_Key texture); + void osSetTerrainTextureHeight(int corner, double low, double high); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4..b94b9bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osEjectFromGroup(agentId); } + + public void osSetTerrainTexture(int level, LSL_Key texture) + { + m_OSSL_Functions.osSetTerrainTexture(level, texture); + } + + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); + } } } -- cgit v1.1 From 08e509978d81cb3451c205ed59648e3f5da91344 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 10 Apr 2012 21:25:05 +0100 Subject: Mantis 55025 Implement script time. Signed-off-by: nebadon --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c38a52e..078a22a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10367,7 +10367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: - ret.Add(new LSL_Float(0)); + ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: ret.Add(new LSL_Integer(1)); @@ -10435,9 +10435,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: - // Average cpu time per simulator frame expended on all scripts in the object - // Not currently available at Object level - ret.Add(new LSL_Float(0)); + // Average cpu time in seconds per simulator frame expended on all scripts in the object + ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: // according to the SL wiki A prim or linkset will have prim -- cgit v1.1