From 9b337b089c1811e316c7d4cba04cc434f16c950c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 12 Apr 2015 19:30:55 -0700 Subject: Add osCheckODE() function so scripts can configure for running with legacy physics engine. Function returns 'true' of the physics engine is configured to be 'OpenDynamicsEngine'. The presumption is that all other physics engines work the same (like SL) or it is a bug. Does not require ossl functions to be enabled. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 15 +++++++++++++++ .../Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 3 files changed, 21 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a757da1..7ecaf55 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1627,6 +1627,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Integer osCheckODE() + { + m_host.AddScriptLPS(1); + LSL_Integer ret = 0; // false + if (m_ScriptEngine.World.PhysicsScene != null) + { + string physEngine = m_ScriptEngine.World.PhysicsScene.EngineType; + if (physEngine == "OpenDynamicsEngine") + { + ret = 1; // true + } + } + return ret; + } + public string osGetPhysicsEngineType() { // High because it can be used to target attacks to known weaknesses diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 38d4574..b903667 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetScriptEngineName(); string osGetSimulatorVersion(); + LSL_Integer osCheckODE(); string osGetPhysicsEngineType(); Object osParseJSONNew(string JSON); Hashtable osParseJSON(string JSON); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 352a35d..6030325 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetScriptEngineName(); } + public LSL_Integer osCheckODE() + { + return m_OSSL_Functions.osCheckODE(); + } + public string osGetPhysicsEngineType() { return m_OSSL_Functions.osGetPhysicsEngineType(); -- cgit v1.1