add OSSL osGetPhysicsEngineName(). this returns a string with name and version. does no permition checks or it whould be less usefull ( only ubOde returns value)

LSLKeyTest
UbitUmarov 2016-07-04 08:29:26 +01:00
parent e00603f78a
commit ac72598c6b
6 changed files with 33 additions and 4 deletions

View File

@ -112,6 +112,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
/// </summary> /// </summary>
public string EngineType { get; protected set; } public string EngineType { get; protected set; }
public string EngineName { get; protected set; }
// The only thing that should register for this event is the SceneGraph // The only thing that should register for this event is the SceneGraph
// Anything else could cause problems. // Anything else could cause problems.
public event physicsCrash OnPhysicsCrash; public event physicsCrash OnPhysicsCrash;

View File

@ -29,6 +29,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
get { return "ubODE"; } get { return "ubODE"; }
} }
public string Version
{
get { return "1.0"; }
}
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
@ -75,7 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if(m_scenes.ContainsKey(scene)) // ??? if(m_scenes.ContainsKey(scene)) // ???
return; return;
ODEScene newodescene = new ODEScene(scene, m_config, Name, OSOdeLib); ODEScene newodescene = new ODEScene(scene, m_config, Name, Version, OSOdeLib);
m_scenes[scene] = newodescene; m_scenes[scene] = newodescene;
} }

View File

@ -324,13 +324,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
IConfig physicsconfig = null; IConfig physicsconfig = null;
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool pOSOdeLib) public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion, bool pOSOdeLib)
{ {
OdeLock = new Object(); OdeLock = new Object();
EngineType = pname; EngineType = pname;
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
EngineName = pname + " " + pversion;
m_config = psourceconfig; m_config = psourceconfig;
m_OSOdeLib = pOSOdeLib; m_OSOdeLib = pOSOdeLib;

View File

@ -1724,6 +1724,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret; return ret;
} }
public string osGetPhysicsEngineName()
{
// not doing security checks
// this whould limit the use of this
m_host.AddScriptLPS(1);
string ret = "NoEngine";
if (m_ScriptEngine.World.PhysicsScene != null)
{
ret = m_ScriptEngine.World.PhysicsScene.EngineName;
// An old physics engine might have an uninitialized engine type
if (ret == null)
ret = "UnknownEngine";
}
return ret;
}
public string osGetSimulatorVersion() public string osGetSimulatorVersion()
{ {
// High because it can be used to target attacks to known weaknesses // High because it can be used to target attacks to known weaknesses

View File

@ -262,6 +262,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetSimulatorVersion(); string osGetSimulatorVersion();
LSL_Integer osCheckODE(); LSL_Integer osCheckODE();
string osGetPhysicsEngineType(); string osGetPhysicsEngineType();
string osGetPhysicsEngineName();
Object osParseJSONNew(string JSON); Object osParseJSONNew(string JSON);
Hashtable osParseJSON(string JSON); Hashtable osParseJSON(string JSON);

View File

@ -435,6 +435,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetPhysicsEngineType(); return m_OSSL_Functions.osGetPhysicsEngineType();
} }
public string osGetPhysicsEngineName()
{
return m_OSSL_Functions.osGetPhysicsEngineName();
}
public string osGetSimulatorVersion() public string osGetSimulatorVersion()
{ {
return m_OSSL_Functions.osGetSimulatorVersion(); return m_OSSL_Functions.osGetSimulatorVersion();