diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c2e5c13..39e1a27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -690,10 +690,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
690 | // | 690 | // |
691 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 691 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
692 | 692 | ||
693 | TeleportAgent(agent, regionName, position, lookat); | 693 | TeleportAgent(agent, regionName, position, lookat, false); |
694 | } | 694 | } |
695 | 695 | ||
696 | private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 696 | private void TeleportAgent(string agent, string regionName, |
697 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
697 | { | 698 | { |
698 | m_host.AddScriptLPS(1); | 699 | m_host.AddScriptLPS(1); |
699 | UUID agentId = new UUID(); | 700 | UUID agentId = new UUID(); |
@@ -702,25 +703,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
702 | ScenePresence presence = World.GetScenePresence(agentId); | 703 | ScenePresence presence = World.GetScenePresence(agentId); |
703 | if (presence != null) | 704 | if (presence != null) |
704 | { | 705 | { |
705 | // agent must be over owners land to avoid abuse | 706 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
706 | if (m_host.OwnerID | 707 | // For osTeleportOwner, this restriction isn't necessary |
708 | if (relaxRestrictions || | ||
709 | m_host.OwnerID | ||
707 | == World.LandChannel.GetLandObject( | 710 | == World.LandChannel.GetLandObject( |
708 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 711 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
709 | { | 712 | { |
710 | // Check for hostname, attempt to make a HG link, | ||
711 | // and convert the regionName to the target region | ||
712 | if (regionName.Contains(".") && regionName.Contains(":")) | ||
713 | { | ||
714 | // Even though we use none of the results, we need to perform this call because it appears | ||
715 | // to have some the side effect of setting up hypergrid teleport locations. | ||
716 | World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
717 | // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
718 | |||
719 | string[] parts = regionName.Split(new char[] { ':' }); | ||
720 | if (parts.Length > 2) | ||
721 | regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; | ||
722 | regionName = "http://" + regionName; | ||
723 | } | ||
724 | World.RequestTeleportLocation(presence.ControllingClient, regionName, | 713 | World.RequestTeleportLocation(presence.ControllingClient, regionName, |
725 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 714 | new Vector3((float)position.x, (float)position.y, (float)position.z), |
726 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 715 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); |
@@ -737,10 +726,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
737 | // | 726 | // |
738 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 727 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
739 | 728 | ||
740 | TeleportAgent(agent, regionX, regionY, position, lookat); | 729 | TeleportAgent(agent, regionX, regionY, position, lookat, false); |
741 | } | 730 | } |
742 | 731 | ||
743 | private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 732 | private void TeleportAgent(string agent, int regionX, int regionY, |
733 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
744 | { | 734 | { |
745 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); | 735 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); |
746 | 736 | ||
@@ -751,8 +741,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
751 | ScenePresence presence = World.GetScenePresence(agentId); | 741 | ScenePresence presence = World.GetScenePresence(agentId); |
752 | if (presence != null) | 742 | if (presence != null) |
753 | { | 743 | { |
754 | // agent must be over owners land to avoid abuse | 744 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
755 | if (m_host.OwnerID | 745 | // For osTeleportOwner, this restriction isn't necessary |
746 | if (relaxRestrictions || | ||
747 | m_host.OwnerID | ||
756 | == World.LandChannel.GetLandObject( | 748 | == World.LandChannel.GetLandObject( |
757 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 749 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
758 | { | 750 | { |
@@ -775,7 +767,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
775 | // Threat level None because this is what can already be done with the World Map in the viewer | 767 | // Threat level None because this is what can already be done with the World Map in the viewer |
776 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 768 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
777 | 769 | ||
778 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); | 770 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); |
779 | } | 771 | } |
780 | 772 | ||
781 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 773 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
@@ -787,7 +779,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
787 | { | 779 | { |
788 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 780 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
789 | 781 | ||
790 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); | 782 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); |
791 | } | 783 | } |
792 | 784 | ||
793 | // Functions that get information from the agent itself. | 785 | // Functions that get information from the agent itself. |