From 47a5d8d7420f86088d75e4b578e7e997ba2d11c8 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 21 Jan 2011 19:55:35 +0100 Subject: Make osTeleportOwner work in foreign regions by relaxing the restrictions on teleporting an agent. --- .../Shared/Api/Implementation/OSSL_Api.cs | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 688dfe4..402d3a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionName, position, lookat); + TeleportAgent(agent, regionName, position, lookat, false); } - private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, string regionName, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { m_host.AddScriptLPS(1); UUID agentId = new UUID(); @@ -694,7 +695,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over owners land to avoid abuse - if (m_host.OwnerID + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -728,10 +730,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionX, regionY, position, lookat); + TeleportAgent(agent, regionX, regionY, position, lookat, false); } - private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, int regionX, int regionY, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); @@ -742,8 +745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over owners land to avoid abuse - if (m_host.OwnerID + // For osTeleportAgent, agent must be over owners land to avoid abuse + // For osTeleportOwner, this restriction isn't necessary + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -766,7 +771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Threat level None because this is what can already be done with the World Map in the viewer CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); } public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) @@ -778,7 +783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); } // Functions that get information from the agent itself. -- cgit v1.1