Add support for new naming syntax of linked regions to osTeleportAgent and osTeleportOwner.

0.7.1-dev
Marck 2011-01-21 20:00:04 +01:00
parent 47a5d8d742
commit 4f9c3c73ad
2 changed files with 5 additions and 18 deletions

View File

@ -3770,15 +3770,15 @@ namespace OpenSim.Region.Framework.Scenes
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
Vector3 lookat, uint teleportFlags) Vector3 lookat, uint teleportFlags)
{ {
GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
if (regionInfo == null) if (regions == null || regions.Count == 0)
{ {
// can't find the region: Tell viewer and abort // can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return; return;
} }
RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
} }
/// <summary> /// <summary>

View File

@ -694,26 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null) if (presence != null)
{ {
// agent must be over owners land to avoid abuse // For osTeleportAgent, agent must be over owners land to avoid abuse
// For osTeleportOwner, this restriction isn't necessary
if (relaxRestrictions || if (relaxRestrictions ||
m_host.OwnerID m_host.OwnerID
== World.LandChannel.GetLandObject( == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{ {
// Check for hostname, attempt to make a HG link,
// and convert the regionName to the target region
if (regionName.Contains(".") && regionName.Contains(":"))
{
// Even though we use none of the results, we need to perform this call because it appears
// to have some the side effect of setting up hypergrid teleport locations.
World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
string[] parts = regionName.Split(new char[] { ':' });
if (parts.Length > 2)
regionName = parts[0] + ':' + parts[1] + "/ " + parts[2];
regionName = "http://" + regionName;
}
World.RequestTeleportLocation(presence.ControllingClient, regionName, World.RequestTeleportLocation(presence.ControllingClient, regionName,
new Vector3((float)position.x, (float)position.y, (float)position.z), 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); new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);