aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorVegaslon2014-10-09 09:46:17 -0400
committerJustin Clark-Casey (justincc)2014-10-11 00:04:25 +0100
commit79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8 (patch)
tree11b0b365abdc0f037ba1aef3c115510ad7c56710 /OpenSim/Region/ScriptEngine
parentminor: add --default-user option to "load oar" help long description. Do oth... (diff)
downloadopensim-SC_OLD-79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8.zip
opensim-SC_OLD-79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8.tar.gz
opensim-SC_OLD-79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8.tar.bz2
opensim-SC_OLD-79a4d1ea8d6e51ed3d001b70e7da325a89ce92c8.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs53
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs9
3 files changed, 64 insertions, 0 deletions
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
872 872
873 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); 873 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true);
874 } 874 }
875 ///<summary>
876 /// Allows a script IN the target prim to force an avatar to sit on it using normal methods
877 /// as if called by the client.
878 /// Silent fail if agent (or target if overloaded) not found.
879 /// Does work if passed key (or keys if overloaded).
880 /// </summary>
881 /// <param name="avatar"></param>
882 public void osForceSit(string avatar)
883 {
884 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceSit");
885
886 m_host.AddScriptLPS(1);
887
888 ForceSit(avatar, m_host.UUID);
889 }
890 /// <summary>
891 /// Overload method of osForceSit(string avatar) to allow a script NOT in the target prim to force
892 /// an avatar to sit on the target prim using normal methods as if called by the client.
893 /// </summary>
894 /// <param name="avatar"></param>
895 /// <param name="target"></param>
896 public void osForceSit(string avatar, string target)
897 {
898 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceSit");
899
900 m_host.AddScriptLPS(1);
901
902 UUID targetID = new UUID(target);
903
904 ForceSit(avatar, targetID);
905
906
907 }
908
909 public void ForceSit(string avatar, UUID targetID)
910 {
911 UUID agentID;
912
913 if (!UUID.TryParse(avatar, out agentID))
914 return;
915
916 ScenePresence presence = World.GetScenePresence(agentID);
917
918 SceneObjectPart part = World.GetSceneObjectPart(targetID);
919
920 if (presence != null &&
921 part != null &&
922 part.SitTargetAvatar == UUID.Zero)
923 presence.HandleAgentRequestSit(presence.ControllingClient,
924 agentID,
925 targetID,
926 part.SitTargetPosition);
927 }
875 928
876 // Functions that get information from the agent itself. 929 // Functions that get information from the agent itself.
877 // 930 //
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
363 LSL_Float osGetHealth(string avatar); 363 LSL_Float osGetHealth(string avatar);
364 void osCauseHealing(string avatar, double healing); 364 void osCauseHealing(string avatar, double healing);
365 void osCauseDamage(string avatar, double damage); 365 void osCauseDamage(string avatar, double damage);
366 void osForceSit(string avatar);
367 void osForceSit(string avatar, string target);
366 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); 368 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
367 void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); 369 void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
368 void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); 370 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
919 { 919 {
920 m_OSSL_Functions.osCauseHealing(avatar, healing); 920 m_OSSL_Functions.osCauseHealing(avatar, healing);
921 } 921 }
922
923 public void osForceSit(string avatar)
924 {
925 m_OSSL_Functions.osForceSit(avatar);
926 }
927 public void osForceSit(string avatar, string target)
928 {
929 m_OSSL_Functions.osForceSit(avatar, target);
930 }
922 931
923 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) 932 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
924 { 933 {