From 50536c66a0f2e72d68df25c84a2286337dd9b357 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 1 Feb 2009 17:41:33 +0000 Subject: [PATCH] Thank you kindly, TLaukkan (Tommil) for a patch that: Added osTeleportAgent with region coordinates to support hyper grid scripted teleports. --- .../Shared/Api/Implementation/OSSL_Api.cs | 29 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 35 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9e76ee2ed2..3e7ffab998 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -513,6 +513,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + // Teleport functions + public void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { + // High because there is no security check. High griefer potential + // + CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); + + ulong regionHandle = Util.UIntsToLong((regionX * (uint)Constants.RegionSize), (regionY * (uint)Constants.RegionSize)); + + m_host.AddScriptLPS(1); + UUID agentId = new UUID(); + if (UUID.TryParse(agent, out agentId)) + { + ScenePresence presence = World.GetScenePresence(agentId); + if (presence != null) + { + // agent must be over owners land to avoid abuse + if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) + { + presence.ControllingClient.SendTeleportLocationStart(); + World.RequestTeleportLocation(presence.ControllingClient, regionHandle, + new Vector3((float)position.x, (float)position.y, (float)position.z), + new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); + ScriptSleep(5000); + } + } + } + } + public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index a8d98dc50f..79b30c780e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -66,6 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces // Teleport commands void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); // Animation commands diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 01b2d86f68..3817a078ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -131,6 +131,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); } + public void osTeleportAgent(string agent, long regionX, long regionY, vector position, vector lookat) + { + m_OSSL_Functions.osTeleportAgent(agent, (uint) regionX, (uint) regionY, position, lookat); + } + public void osTeleportAgent(string agent, vector position, vector lookat) { m_OSSL_Functions.osTeleportAgent(agent, position, lookat);