a few changes to tp home
parent
fc075c61ed
commit
796a8efe25
|
@ -391,7 +391,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
|
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
|
||||||
{
|
{
|
||||||
if(!sp.AllowMovement)
|
if(!sp.AllowMovement)
|
||||||
|
@ -486,7 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
position.Z = posZLimit;
|
position.Z = posZLimit;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
if(!sp.CheckLocalTPLandingPoint(ref position))
|
||||||
|
{
|
||||||
|
sp.ControllingClient.SendTeleportFailed("Not allowed at destination");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (sp.Flying)
|
if (sp.Flying)
|
||||||
teleportFlags |= (uint)TeleportFlags.IsFlying;
|
teleportFlags |= (uint)TeleportFlags.IsFlying;
|
||||||
|
|
||||||
|
@ -1389,45 +1394,67 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
public virtual bool TeleportHome(UUID id, IClientAPI client)
|
public virtual bool TeleportHome(UUID id, IClientAPI client)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
bool isSame = false;
|
||||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
if (client != null && id == client.AgentId)
|
||||||
|
|
||||||
//OpenSim.Services.Interfaces.PresenceInfo pinfo = Scene.PresenceService.GetAgent(client.SessionId);
|
|
||||||
GridUserInfo uinfo = Scene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
|
|
||||||
|
|
||||||
if (uinfo != null)
|
|
||||||
{
|
{
|
||||||
if (uinfo.HomeRegionID == UUID.Zero)
|
isSame = true;
|
||||||
{
|
m_log.DebugFormat(
|
||||||
// can't find the Home region: Tell viewer and abort
|
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id);
|
||||||
m_log.ErrorFormat("{0} No grid user info found for {1} {2}. Cannot send home.",
|
|
||||||
LogHeader, client.Name, client.AgentId);
|
|
||||||
client.SendTeleportFailed("You don't have a home position set.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
GridRegion regionInfo = Scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
|
||||||
if (regionInfo == null)
|
|
||||||
{
|
|
||||||
// can't find the Home region: Tell viewer and abort
|
|
||||||
client.SendTeleportFailed("Your home region could not be found.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})",
|
|
||||||
client.Name, regionInfo.RegionName, regionInfo.RegionCoordX, regionInfo.RegionCoordY);
|
|
||||||
|
|
||||||
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
|
|
||||||
((Scene)(client.Scene)).RequestTeleportLocation(
|
|
||||||
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
|
|
||||||
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId);
|
||||||
|
|
||||||
|
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id);
|
||||||
|
if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive)
|
||||||
|
{
|
||||||
|
if (isSame)
|
||||||
|
client.SendTeleportFailed("Internal error, agent presence not found");
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp.IsInTransit)
|
||||||
|
{
|
||||||
|
if (isSame)
|
||||||
|
client.SendTeleportFailed("Already processing a teleport");
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent still in teleport");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//OpenSim.Services.Interfaces.PresenceInfo pinfo = Scene.PresenceService.GetAgent(client.SessionId);
|
||||||
|
GridUserInfo uinfo = Scene.GridUserService.GetGridUserInfo(id.ToString());
|
||||||
|
if(uinfo == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[ENTITY TRANSFER MODULE] Griduser info not found for {1}. Cannot send home.", id);
|
||||||
|
if (isSame)
|
||||||
|
client.SendTeleportFailed("Your home region could not be found.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uinfo.HomeRegionID == UUID.Zero)
|
||||||
{
|
{
|
||||||
// can't find the Home region: Tell viewer and abort
|
// can't find the Home region: Tell viewer and abort
|
||||||
client.SendTeleportFailed("Your home region could not be found.");
|
m_log.ErrorFormat("[ENTITY TRANSFER MODULE] no home set {0}", id);
|
||||||
|
if (isSame)
|
||||||
|
client.SendTeleportFailed("home position set not");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
GridRegion regionInfo = Scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||||
|
if (regionInfo == null)
|
||||||
|
{
|
||||||
|
// can't find the Home region: Tell viewer and abort
|
||||||
|
m_log.ErrorFormat("[ENTITY TRANSFER MODULE] {0} home region {1} not found", id, uinfo.HomeRegionID);
|
||||||
|
if (isSame)
|
||||||
|
client.SendTeleportFailed("Your home region could not be found.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Teleport(sp, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
|
||||||
|
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -38,13 +38,14 @@ using OpenSim.Services.Connectors.Hypergrid;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
|
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
|
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")]
|
||||||
|
@ -436,9 +437,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
public override bool TeleportHome(UUID id, IClientAPI client)
|
public override bool TeleportHome(UUID id, IClientAPI client)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
|
||||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
|
||||||
|
|
||||||
// Let's find out if this is a foreign user or a local user
|
// Let's find out if this is a foreign user or a local user
|
||||||
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
|
IUserManagement uMan = Scene.RequestModuleInterface<IUserManagement>();
|
||||||
if (uMan != null && uMan.IsLocalGridUser(id))
|
if (uMan != null && uMan.IsLocalGridUser(id))
|
||||||
|
@ -448,23 +446,53 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return base.TeleportHome(id, client);
|
return base.TeleportHome(id, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Foreign user wants to go home
|
bool issame = false;
|
||||||
//
|
if (client != null && id == client.AgentId)
|
||||||
AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
|
||||||
if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("HomeURI")))
|
|
||||||
{
|
{
|
||||||
client.SendTeleportFailed("Your information has been lost");
|
issame = true;
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
|
m_log.DebugFormat(
|
||||||
|
"[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[HG ENTITY TRANSFER MODULE]: Request to teleport {0} home by {1} {2}", id, client.Name, client.AgentId);
|
||||||
|
|
||||||
|
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(id);
|
||||||
|
if (sp == null || sp.IsDeleted || sp.IsChildAgent || sp.ControllingClient == null || !sp.ControllingClient.IsActive)
|
||||||
|
{
|
||||||
|
if (issame)
|
||||||
|
client.SendTeleportFailed("Internal error, agent presence not found");
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString());
|
if (sp.IsInTransit)
|
||||||
|
{
|
||||||
|
if (issame)
|
||||||
|
client.SendTeleportFailed("Already processing a teleport");
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent still in teleport");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Foreign user wants to go home
|
||||||
|
//
|
||||||
|
AgentCircuitData aCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||||
|
if (aCircuit == null || !aCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||||
|
{
|
||||||
|
if (issame)
|
||||||
|
client.SendTeleportFailed("Agent Home information has been lost");
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
string homeURI = aCircuit.ServiceURLs["HomeURI"].ToString();
|
||||||
|
|
||||||
|
IUserAgentService userAgentService = new UserAgentServiceConnector(homeURI);
|
||||||
Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
|
Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
|
||||||
|
|
||||||
GridRegion finalDestination = null;
|
GridRegion finalDestination = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt);
|
finalDestination = userAgentService.GetHomeRegion(id, out position, out lookAt);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -473,20 +501,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
if (finalDestination == null)
|
if (finalDestination == null)
|
||||||
{
|
{
|
||||||
client.SendTeleportFailed("Your home region could not be found");
|
if (issame)
|
||||||
|
client.SendTeleportFailed("Home region could not be found");
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
|
if (sp.IsDeleted || sp.IsChildAgent || sp.IsInTransit)
|
||||||
if (sp == null)
|
|
||||||
{
|
{
|
||||||
client.SendTeleportFailed("Internal error");
|
if (issame)
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
|
client.SendTeleportFailed("Agent lost or started other tp");
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent lost or started other tp");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRegion homeGatekeeper = MakeRegion(aCircuit);
|
GridRegion homeGatekeeper = MakeGateKeeperRegion(homeURI);
|
||||||
|
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
|
||||||
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
|
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
|
||||||
|
@ -525,8 +554,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
// Foreign region
|
// Foreign region
|
||||||
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
|
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
|
||||||
GridRegion gatekeeper = new GridRegion();
|
GridRegion gatekeeper = MakeGateKeeperRegion(lm.Gatekeeper);
|
||||||
gatekeeper.ServerURI = lm.Gatekeeper;
|
if (gatekeeper == null)
|
||||||
|
{
|
||||||
|
remoteClient.SendTeleportFailed("Could not parse landmark destiny URI");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
|
string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
|
||||||
|
|
||||||
string message;
|
string message;
|
||||||
|
@ -741,20 +775,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
private GridRegion MakeGateKeeperRegion(string wantedURI)
|
||||||
{
|
{
|
||||||
GridRegion region = new GridRegion();
|
Uri uri;
|
||||||
|
if(!Uri.TryCreate(wantedURI, UriKind.Absolute, out uri))
|
||||||
Uri uri = null;
|
|
||||||
if (!aCircuit.ServiceURLs.ContainsKey("HomeURI") ||
|
|
||||||
(aCircuit.ServiceURLs.ContainsKey("HomeURI") && !Uri.TryCreate(aCircuit.ServiceURLs["HomeURI"].ToString(), UriKind.Absolute, out uri)))
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
GridRegion region = new GridRegion();
|
||||||
|
|
||||||
region.ExternalHostName = uri.Host;
|
region.ExternalHostName = uri.Host;
|
||||||
region.HttpPort = (uint)uri.Port;
|
region.HttpPort = (uint)uri.Port;
|
||||||
region.ServerURI = aCircuit.ServiceURLs["HomeURI"].ToString();
|
region.ServerURI = wantedURI; //uri.AbsoluteUri for some reason default ports are needed
|
||||||
region.RegionName = string.Empty;
|
region.RegionName = string.Empty;
|
||||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
||||||
|
region.RegionFlags = OpenSim.Framework.RegionFlags.Hyperlink;
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,13 +225,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ScenePresence p = scene.GetScenePresence(prey);
|
ScenePresence p = scene.GetScenePresence(prey);
|
||||||
if (p != null && !p.IsChildAgent )
|
if (p != null && !p.IsChildAgent && !p.IsDeleted && !p.IsInTransit)
|
||||||
{
|
{
|
||||||
if(!p.IsDeleted && !p.IsInTransit)
|
p.ControllingClient.SendTeleportStart(16);
|
||||||
{
|
scene.TeleportClientHome(prey, client);
|
||||||
p.ControllingClient.SendTeleportStart(16);
|
|
||||||
scene.TeleportClientHome(prey, p.ControllingClient);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,13 +253,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
if (s.RegionInfo.EstateSettings.EstateID != estateID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scene.ForEachScenePresence(delegate(ScenePresence p) {
|
scene.ForEachScenePresence(delegate(ScenePresence p)
|
||||||
if (p != null && !p.IsChildAgent)
|
|
||||||
{
|
{
|
||||||
p.ControllingClient.SendTeleportStart(16);
|
if (p != null && !p.IsChildAgent && !p.IsDeleted && !p.IsInTransit)
|
||||||
scene.TeleportClientHome(p.ControllingClient.AgentId, p.ControllingClient);
|
{
|
||||||
}
|
p.ControllingClient.SendTeleportStart(16);
|
||||||
});
|
scene.TeleportClientHome(p.ControllingClient.AgentId, client);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EstateConnector.SendTeleportHomeAllUsers(estateID);
|
m_EstateConnector.SendTeleportHomeAllUsers(estateID);
|
||||||
|
|
Loading…
Reference in New Issue