From db2fbf6516a055beb71de9b82a9773c29bf3a73d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 13:24:09 +0000
Subject: add more calls to effective permissions aggregation, some paths may
still be missing on objects changes, but remove the aggregation on check
paths, so all can be tested.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e769c6d..a17eb03 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2038,6 +2038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Inventory.AddInventoryItemExclusive(taskItem, false);
else
m_host.Inventory.AddInventoryItem(taskItem, false);
+ m_host.ParentGroup.AggregatePerms();
return taskItem;
}
--
cgit v1.1
From 0a5d6671cec0eaea00127e29d4237cc4614d111d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 06:37:29 +0000
Subject: fix llScriptDanger(); don't call old ScriptDamage on ossl health
functions
---
.../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a17eb03..4c3f7ee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3538,7 +3538,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Float health = new LSL_Float(-1);
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
- if (presence != null) health = presence.Health;
+ if (presence != null)
+ health = presence.Health;
return health;
}
@@ -3578,7 +3579,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
{
float health = presence.Health;
health += (float)healing;
@@ -3598,7 +3599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
{
if (health > 100.0)
health = 100.0;
@@ -3617,7 +3618,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
presence.HealRate = (float)healrate;
}
--
cgit v1.1
From 6a35a965ff7085b5962745437a10d798c0fb611d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 31 Mar 2017 20:55:48 +0100
Subject: add OSSL functions to override linksets total mass, center of mass
and inertia. replacing the crude automatic estimation based on prims known to
physics and density. Changed parameters are still not saved, and are lost on
region crossings. only suported by UbODE. EXPERIMENTAL feature, only test it
for now.. don't try to use in products.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 213 +++++++++++++++++++++
1 file changed, 213 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4c3f7ee..6c094ee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4404,5 +4404,218 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.ScriptSetVolumeDetect(detect != 0);
}
+ ///
+ /// Get inertial data
+ ///
+ ///
+ ///
+ ///
+ /// a LSL list with contents:
+ /// LSL_Float mass, the total mass of a linkset
+ /// LSL_Vector CenterOfMass, center mass relative to root prim
+ /// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass
+ /// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass
+ ///
+ public LSL_List osGetInertiaData()
+ {
+ LSL_List result = new LSL_List();
+ float TotalMass;
+ Vector3 CenterOfMass;
+ Vector3 Inertia;
+ Vector4 aux;
+
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return result;
+
+ sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux );
+ if(TotalMass > 0)
+ {
+ float t = 1.0f/TotalMass;
+ Inertia.X *= t;
+ Inertia.Y *= t;
+ Inertia.Z *= t;
+
+ aux.X *= t;
+ aux.Y *= t;
+ aux.Z *= t;
+ }
+
+ result.Add(new LSL_Float(TotalMass));
+ result.Add(new LSL_Vector(CenterOfMass.X, CenterOfMass.Y, CenterOfMass.Z));
+ result.Add(new LSL_Vector(Inertia.X, Inertia.Y, Inertia.Z));
+ result.Add(new LSL_Vector(aux.X, aux.Y, aux.Z));
+ return result;
+ }
+
+ ///
+ /// set inertial data
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// location of center of mass relative to root prim in local coords
+ /// moment of inertia relative to principal axis and center of mass,Ixx, Iyy, Izz divided by mass
+ /// rotation of the inertia, relative to local axis
+ ///
+ /// the inertia argument is is inertia divided by mass, so corresponds only to the geometric distribution of mass and both can be changed independently.
+ ///
+
+ public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0 || principalInertiaScaled.x < 0 || principalInertiaScaled.y < 0 || principalInertiaScaled.z < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float m = (float)mass;
+
+ Inertia.X = m * (float)principalInertiaScaled.x;
+ Inertia.Y = m * (float)principalInertiaScaled.y;
+ Inertia.Z = m * (float)principalInertiaScaled.z;
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.y, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
+ }
+
+ ///
+ /// set inertial data as a sphere
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// size of the Box
+ /// location of center of mass relative to root prim in local coords
+ /// rotation of the box, and so inertia, relative to local axis
+ ///
+ ///
+ public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float lx = (float)boxSize.x;
+ float ly = (float)boxSize.y;
+ float lz = (float)boxSize.z;
+ float m = (float)mass;
+ float t = m / 12.0f;
+
+ Inertia.X = t * (ly*ly + lz*lz);
+ Inertia.Y = t * (lx*lx + lz*lz);
+ Inertia.Z = t * (lx*lx + ly*ly);
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
+ }
+
+ ///
+ /// set inertial data as a sphere
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// radius of the sphere
+ /// location of center of mass relative to root prim in local coords
+ ///
+ ///
+ public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float r = (float)radius;
+ float m = (float)mass;
+ float t = 0.4f * m * r * r;
+
+ Inertia.X = t;
+ Inertia.Y = t;
+ Inertia.Z = t;
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, new Vector4(0f, 0f, 0f,1.0f));
+ }
+
+ ///
+ /// set inertial data as a cylinder
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// radius of the cylinder
+ /// lenght of the cylinder
+ /// location of center of mass relative to root prim in local coords
+ /// rotation of the cylinder, and so inertia, relative to local axis
+ ///
+ /// cylinder axis aligned with Z axis. For other orientations provide the rotation.
+ ///
+ public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float m = (float)mass;
+ float r = (float)radius;
+ r *= r;
+ Inertia.Z = 0.5f * m * r;
+ float t = (float)lenght;
+ t *= t;
+ t += 3.0f * r;
+ t *= 8.333333e-2f * m;
+
+ Inertia.X = t;
+ Inertia.Y = t;
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot);
+ }
+
+ ///
+ /// removes inertial data manual override
+ /// default automatic calculation is used again
+ ///
+ ///
+ public void osClearInertia()
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
+ }
}
}
--
cgit v1.1
From 2bb5e985740b7c6aa75cd31aa057d39d56f024b6 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 3 Apr 2017 17:19:28 +0100
Subject: add EXPERIMENTAL osObjectTeleport(LSL_Key objectUUID, LSL_Vector
targetPos, LSL_Rotation rotation, LSL_Integer stop)
---
.../Shared/Api/Implementation/OSSL_Api.cs | 46 ++++++++++++++++++++++
1 file changed, 46 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6c094ee..ddf5078 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4418,6 +4418,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List osGetInertiaData()
{
+ m_host.AddScriptLPS(1);
+
LSL_List result = new LSL_List();
float TotalMass;
Vector3 CenterOfMass;
@@ -4463,6 +4465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4499,6 +4502,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4538,6 +4543,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4575,6 +4581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4611,11 +4618,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osClearInertia()
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
}
+
+ ///
+ /// teleports a object (full linkset)
+ ///
+ /// the id of the linkset to teleport
+ /// target position
+ /// a rotation to apply
+ /// if TRUE (!=0) stop at destination
+ ///
+ /// only does teleport local to region
+ /// object owner must have rights to run scripts on target location
+ /// object owner must have rights to enter ojects on target location
+ /// target location parcel must have enought free prims capacity for the linkset prims
+ /// all avatars siting on the object must have access to target location
+ /// has a cool down time. retries before expire reset it
+ /// fail conditions are silent ignored
+ ///
+ public void osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop)
+ {
+ CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
+ m_host.AddScriptLPS(1);
+
+ UUID objUUID;
+ if (!UUID.TryParse(objectUUID, out objUUID))
+ {
+ OSSLShoutError("osObjectTeleport() invalid object Key");
+ return;
+ }
+
+ SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ UUID myid = m_host.ParentGroup.UUID;
+
+ sog.ObjectTeleport(myid, targetPos, rotation, stop != 0);
+ // a delay here may break vehicles
+ }
}
}
--
cgit v1.1
From ca250e0b0b564efaaeb5c0b80760126cfd710c5e Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 14:34:25 +0100
Subject: mantis 8740: rename osObjectTeleport as osTeleportObject, replaced
the stop parameter by flags, add flags OSTPOBJ_STOPATTARRGET and
OSTPOBJ_SETROT
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index ddf5078..b50ae28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4632,17 +4632,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// the id of the linkset to teleport
/// target position
/// a rotation to apply
- /// if TRUE (!=0) stop at destination
+ /// several flags/param>
///
/// only does teleport local to region
- /// object owner must have rights to run scripts on target location
+ /// if object has scripts, owner must have rights to run scripts on target location
/// object owner must have rights to enter ojects on target location
/// target location parcel must have enought free prims capacity for the linkset prims
/// all avatars siting on the object must have access to target location
/// has a cool down time. retries before expire reset it
/// fail conditions are silent ignored
///
- public void osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop)
+ public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
m_host.AddScriptLPS(1);
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID myid = m_host.ParentGroup.UUID;
- sog.ObjectTeleport(myid, targetPos, rotation, stop != 0);
+ sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
}
--
cgit v1.1
From e237e1b2fa444b0bf0077036c9436f919e344e2b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 19:27:45 +0100
Subject: add LSL_Integer osGetLinkNumber(LSL_String name). uses a cache for
the string to linknumber map, cache invalidations may still be missing :(
---
.../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b50ae28..0275cf4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4663,5 +4663,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
+
+ public LSL_Integer osGetLinkNumber(LSL_String name)
+ {
+ m_host.AddScriptLPS(1);
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return -1;
+ return sog.GetLinkNumber(name);
+ }
}
}
--
cgit v1.1
From 2805cb9dec567cdfb7a25d771527510b7a6284af Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 5 Apr 2017 01:15:44 +0100
Subject: give osTeleportObject proper OSFunctionThreatLevel setting on
osslEnable.ini
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0275cf4..a6f6a80 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4644,13 +4644,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
- CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
+ CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
m_host.AddScriptLPS(1);
UUID objUUID;
if (!UUID.TryParse(objectUUID, out objUUID))
{
- OSSLShoutError("osObjectTeleport() invalid object Key");
+ OSSLShoutError("osTeleportObject() invalid object Key");
return;
}
--
cgit v1.1
From c0904a32cb281bad39497b091e758f2433adc196 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 5 Apr 2017 15:11:19 +0100
Subject: OSSL CheckThreatLevel() with no arguments only tests if OSSL is
enabled. Faster test for safe functions that are always allowed with OSSL
enabled. other name could be CheckOSSLenabled, but this name preserves
functions template.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 32 +++++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a6f6a80..b3bd8c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -260,7 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
}
- // Returns of the function is allowed. Throws a script exception if not allowed.
+ // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed..
+ // for safe funtions always active
+ public void CheckThreatLevel()
+ {
+ if (!m_OSFunctionsEnabled)
+ OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
+ }
+
+ // Returns if the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
@@ -1716,7 +1724,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer osCheckODE()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
LSL_Integer ret = 0; // false
if (m_ScriptEngine.World.PhysicsScene != null)
{
@@ -1757,10 +1767,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osGetPhysicsEngineName()
{
- // not doing security checks
- // this whould limit the use of this
-
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
string ret = "NoEngine";
if (m_ScriptEngine.World.PhysicsScene != null)
{
@@ -1771,6 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return ret;
}
+
public string osGetSimulatorVersion()
{
// High because it can be used to target attacks to known weaknesses
@@ -4364,6 +4374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osCollisionSound(string impact_sound, double impact_volume)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
if(impact_sound == "")
@@ -4396,6 +4407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// still not very usefull, detector is lost on rez, restarts, etc
public void osVolumeDetect(int detect)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
@@ -4418,6 +4430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List osGetInertiaData()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
LSL_List result = new LSL_List();
@@ -4465,7 +4478,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4502,6 +4517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
@@ -4543,7 +4559,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4581,7 +4599,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4618,7 +4638,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osClearInertia()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4666,7 +4688,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer osGetLinkNumber(LSL_String name)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return -1;
--
cgit v1.1
From 0f7ffc56cee22aa95af58d19d3ea2193cea07340 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 15 Apr 2017 10:46:18 +0100
Subject: several changes for osTeleportObject
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b3bd8c4..e12cedf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4664,7 +4664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// has a cool down time. retries before expire reset it
/// fail conditions are silent ignored
///
- public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
+ public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
m_host.AddScriptLPS(1);
@@ -4673,16 +4673,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(objectUUID, out objUUID))
{
OSSLShoutError("osTeleportObject() invalid object Key");
- return;
+ return -1;
}
SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
if(sog== null || sog.IsDeleted)
- return;
+ return -1;
UUID myid = m_host.ParentGroup.UUID;
- sog.TeleportObject(myid, targetPos, rotation, flags);
+ return sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
--
cgit v1.1