From 79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8 Mon Sep 17 00:00:00 2001
From: Vegaslon
Date: Thu, 9 Oct 2014 09:46:17 -0400
Subject: Implements osForceSit(string avatar) & overload osForceSit(string
avatar, string target)
Allows a script IN the target prim to force an avatar to sit on it using normal methods as if called by the client.
Overload method of osForceSit() to allow a script NOT in the target prim to force an avatar to sit on the target prim using normal methods as if called by the client.
This patch is based on previous work from
http://opensimulator.org/mantis/view.php?id=4492
and also includes the suggestions from justincc including change of threat level
Thank you Christos Lightling.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 53 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 ++++
3 files changed, 64 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index d11d377..d3ba675 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -872,6 +872,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true);
}
+ ///
+ /// Allows a script IN the target prim to force an avatar to sit on it using normal methods
+ /// as if called by the client.
+ /// Silent fail if agent (or target if overloaded) not found.
+ /// Does work if passed key (or keys if overloaded).
+ ///
+ ///
+ public void osForceSit(string avatar)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceSit");
+
+ m_host.AddScriptLPS(1);
+
+ ForceSit(avatar, m_host.UUID);
+ }
+ ///
+ /// Overload method of osForceSit(string avatar) to allow a script NOT in the target prim to force
+ /// an avatar to sit on the target prim using normal methods as if called by the client.
+ ///
+ ///
+ ///
+ public void osForceSit(string avatar, string target)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceSit");
+
+ m_host.AddScriptLPS(1);
+
+ UUID targetID = new UUID(target);
+
+ ForceSit(avatar, targetID);
+
+
+ }
+
+ public void ForceSit(string avatar, UUID targetID)
+ {
+ UUID agentID;
+
+ if (!UUID.TryParse(avatar, out agentID))
+ return;
+
+ ScenePresence presence = World.GetScenePresence(agentID);
+
+ SceneObjectPart part = World.GetSceneObjectPart(targetID);
+
+ if (presence != null &&
+ part != null &&
+ part.SitTargetAvatar == UUID.Zero)
+ presence.HandleAgentRequestSit(presence.ControllingClient,
+ agentID,
+ targetID,
+ part.SitTargetPosition);
+ }
// Functions that get information from the agent itself.
//
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 41d13ea..83a0808 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -363,6 +363,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Float osGetHealth(string avatar);
void osCauseHealing(string avatar, double healing);
void osCauseDamage(string avatar, double damage);
+ void osForceSit(string avatar);
+ void osForceSit(string avatar, string target);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index b436c52..da88cc4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -919,6 +919,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osCauseHealing(avatar, healing);
}
+
+ public void osForceSit(string avatar)
+ {
+ m_OSSL_Functions.osForceSit(avatar);
+ }
+ public void osForceSit(string avatar, string target)
+ {
+ m_OSSL_Functions.osForceSit(avatar, target);
+ }
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
{
--
cgit v1.1