mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -174,9 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
position.Z = newPosZ;
|
||||
}
|
||||
|
||||
// Only send this if the event queue is null
|
||||
if (eq == null)
|
||||
sp.ControllingClient.SendTeleportLocationStart();
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Teleport(position);
|
||||
@@ -257,9 +255,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
ulong destinationHandle = finalDestination.RegionHandle;
|
||||
|
||||
if (eq == null)
|
||||
sp.ControllingClient.SendTeleportLocationStart();
|
||||
|
||||
// Let's do DNS resolution only once in this process, please!
|
||||
// This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
|
||||
// it's actually doing a lot of work.
|
||||
@@ -277,6 +272,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return;
|
||||
}
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
||||
// closing the child agents, so save it here (we need a copy as it is Clear()-ed).
|
||||
//List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList());
|
||||
@@ -307,7 +304,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
string reason = String.Empty;
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason))
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
||||
reason));
|
||||
@@ -319,6 +317,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
|
||||
|
||||
#region IP Translation for NAT
|
||||
IClientIPEndpoint ipepClient;
|
||||
if (sp.ClientView.TryGet(out ipepClient))
|
||||
@@ -396,6 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
agent.Position = position;
|
||||
SetCallbackURL(agent, sp.Scene.RegionInfo);
|
||||
|
||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
|
||||
|
||||
if (!UpdateAgent(reg, finalDestination, agent))
|
||||
{
|
||||
// Region doesn't take it
|
||||
@@ -434,8 +436,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
|
||||
// Well, this is it. The agent is over there.
|
||||
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
||||
@@ -483,8 +490,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
}
|
||||
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
logout = false;
|
||||
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
||||
@@ -500,6 +508,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
}
|
||||
|
||||
protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
{
|
||||
scene.SendKillObject(localID);
|
||||
@@ -1286,18 +1298,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return handles;
|
||||
}
|
||||
|
||||
private void Dump(string msg, List<ulong> handles)
|
||||
{
|
||||
m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
|
||||
foreach (ulong handle in handles)
|
||||
{
|
||||
uint x, y;
|
||||
Utils.LongToUInts(handle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
m_log.InfoFormat("({0}, {1})", x, y);
|
||||
}
|
||||
}
|
||||
// private void Dump(string msg, List<ulong> handles)
|
||||
// {
|
||||
// m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
|
||||
// foreach (ulong handle in handles)
|
||||
// {
|
||||
// uint x, y;
|
||||
// Utils.LongToUInts(handle, out x, out y);
|
||||
// x = x / Constants.RegionSize;
|
||||
// y = y / Constants.RegionSize;
|
||||
// m_log.InfoFormat("({0}, {1})", x, y);
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected override void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
if (logout)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
reason = string.Empty;
|
||||
logout = false;
|
||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
@@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
|
||||
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||
if (success)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
|
||||
logout = success; // flag for later logout from this grid; this is an HG TP
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user