本文整理汇总了C#中OpenSim.Region.Framework.Scenes.ScenePresence.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# ScenePresence.Reset方法的具体用法?C# ScenePresence.Reset怎么用?C# ScenePresence.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.ScenePresence
的用法示例。
在下文中一共展示了ScenePresence.Reset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoTeleport
//.........这里部分代码省略.........
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
sp.CopyTo(agent);
agent.Position = position;
SetCallbackURL(agent, sp.Scene.RegionInfo);
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
if (!UpdateAgent(reg, finalDestination, agent))
{
// Region doesn't take it
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
return;
}
sp.ControllingClient.SendTeleportProgress(teleportFlags | (uint)TeleportFlags.DisableCancel, "sending_dest");
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
if (eq != null)
{
eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
0, teleportFlags, capsPath, sp.UUID);
}
else
{
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
}
// Let's set this to true tentatively. This does not trigger OnChildAgent
sp.IsChildAgent = true;
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we close things here.
if (!WaitForCallback(sp.UUID))
{
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
return;
}
// For backwards compatibility
if (version == "Unknown" || version == string.Empty)
{
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
}
// May need to logout or other cleanup
AgentHasMovedAway(sp, logout);
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent();
// sp.Scene.CleanDroppedAttachments();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{
Thread.Sleep(5000);
sp.Close();
sp.Scene.IncomingCloseAgent(sp.UUID);
}
else
{
// now we have a child agent in this region.
sp.IsInTransit = false; // not sure :(
sp.Reset();
}
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (sp.Scene.NeedSceneCacheClear(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
sp.UUID);
}
}
else
{
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
}
}
示例2: DoTeleport
//.........这里部分代码省略.........
agent.Position = position;
SetCallbackURL(agent, sp.Scene.RegionInfo);
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
if (!UpdateAgent(reg, finalDestination, agent))
{
// Region doesn't take it
Fail(sp, finalDestination);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
if (eq != null)
{
eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
0, teleportFlags, capsPath, sp.UUID, teleportFlags);
}
else
{
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
}
// Let's set this to true tentatively. This does not trigger OnChildAgent
sp.IsChildAgent = true;
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we send the attachments and close things here.
//OpenSim sucks at callbacks, disable it for now
if (!WaitForCallback(sp.UUID))
{
/*//Make sure the client hasn't TPed back in this time.
ScenePresence SP = m_aScene.GetScenePresence(sp.UUID);
if (SP != null && SP.IsChildAgent)
{
//Disabling until this actually helps and doesn't kill clients
//Fail(sp, finalDestination);
return;
}
else if (SP == null)
{
//Err.. this happens somehow.
return;
}*/
}
/*//Make sure the client hasn't TPed back in this time.
ScenePresence newSP = m_aScene.GetScenePresence(sp.UUID);
if (newSP != null && !newSP.IsChildAgent)
{
//They are root again, don't cross them!
return;
}
else if (newSP == null)
{
//Err.. this happens somehow.
return;
}*/
// 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();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{
Thread.Sleep(5000);
sp.Close();
sp.Scene.IncomingCloseAgent(sp.UUID);
}
else
// now we have a child agent in this region.
sp.Reset();
//If they canceled too late, remove them so the next tp does not fail.
if (m_cancelingAgents.Contains(sp.UUID))
m_cancelingAgents.Remove(sp.UUID);
}
else
{
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
}
}
示例3: TransferAgent_V1
//.........这里部分代码省略.........
{
m_interRegionTeleportCancels.Value++;
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
sp.Name, finalDestination.RegionName, sp.Scene.Name);
CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
// We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator,
// where that neighbour simulator could otherwise request a child agent create on the source which then
// closes our existing agent which is still signalled as root.
sp.IsChildAgent = true;
// OK, send TPFinish to the client, so that it starts the process of contacting the destination region
if (m_eqModule != null)
{
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
}
else
{
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
}
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we close things here.
if (!m_entityTransferStateMachine.WaitForAgentArrivedAtDestination(sp.UUID))
{
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name);
return;
}
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.",
sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion.");
return;
}
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
// For backwards compatibility
if (version == "Unknown" || version == string.Empty)
{
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
}
// May need to logout or other cleanup
AgentHasMovedAway(sp, logout);
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{
if (!sp.Scene.IncomingPreCloseClient(sp))
return;
// We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before
// they regard the new region as the current region after receiving the AgentMovementComplete
// response. If close is sent before then, it will cause the viewer to quit instead.
//
// This sleep can be increased if necessary. However, whilst it's active,
// an agent cannot teleport back to this region if it has teleported away.
Thread.Sleep(2000);
sp.Scene.CloseAgent(sp.UUID, false);
}
else
{
// now we have a child agent in this region.
sp.Reset();
}
}
示例4: TransferAgent_V2
//.........这里部分代码省略.........
// where that neighbour simulator could otherwise request a child agent create on the source which then
// closes our existing agent which is still signalled as root.
//sp.IsChildAgent = true;
// New protocol: send TP Finish directly, without prior ES or EAC. That's what happens in the Linden grid
if (m_eqModule != null)
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
else
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
// Let's send a full update of the agent.
AgentData agent = new AgentData();
sp.CopyTo(agent);
agent.Position = agentCircuit.startpos;
agent.SenderWantsToWaitForRoot = true;
//SetCallbackURL(agent, sp.Scene.RegionInfo);
// Reset the do not close flag. This must be done before the destination opens child connections (here
// triggered by UpdateAgent) to avoid race conditions. However, we also want to reset it as late as possible
// to avoid a situation where an unexpectedly early call to Scene.NewUserConnection() wrongly results
// in no close.
sp.DoNotCloseAfterTeleport = false;
// Send the Update. If this returns true, we know the client has contacted the destination
// via CompleteMovementIntoRegion, so we can let go.
// If it returns false, something went wrong, and we need to abort.
if (!UpdateAgent(reg, finalDestination, agent, sp))
{
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name);
return;
}
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}",
sp.Name, finalDestination.RegionName, sp.Scene.Name);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
return;
}
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
// Need to signal neighbours whether child agents may need closing irrespective of whether this
// one needed closing. We also need to close child agents as quickly as possible to avoid complicated
// race conditions with rapid agent releporting (e.g. from A1 to a non-neighbour B, back
// to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex
// distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are
// abandoned without proper close by viewer but then re-used by an incoming connection.
sp.CloseChildAgents(newRegionX, newRegionY);
// May need to logout or other cleanup
AgentHasMovedAway(sp, logout);
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{
if (!sp.Scene.IncomingPreCloseClient(sp))
return;
// RED ALERT!!!!
// PLEASE DO NOT DECREASE THIS WAIT TIME UNDER ANY CIRCUMSTANCES.
// THE VIEWERS SEEM TO NEED SOME TIME AFTER RECEIVING MoveAgentIntoRegion
// BEFORE THEY SETTLE IN THE NEW REGION.
// DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR
// IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
Thread.Sleep(15000);
// OK, it got this agent. Let's close everything
// If we shouldn't close the agent due to some other region renewing the connection
// then this will be handled in IncomingCloseAgent under lock conditions
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name);
sp.Scene.CloseAgent(sp.UUID, false);
}
else
{
// now we have a child agent in this region.
sp.Reset();
}
}
示例5: RequestTeleportToLocation
/// <summary>
/// Try to teleport an agent to a new region.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="RegionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position,
Vector3 lookAt, uint teleportFlags)
{
if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID))
return;
bool destRegionUp = true;
IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>();
// Reset animations; the viewer does that in teleports.
avatar.Animator.ResetAnimations();
if (regionHandle == m_regionInfo.RegionHandle)
{
m_log.DebugFormat(
"[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation {0} within {1}",
position, m_regionInfo.RegionName);
// Teleport within the same region
if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0)
{
Vector3 emergencyPos = new Vector3(128, 128, 128);
m_log.WarnFormat(
"[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
position, avatar.Name, avatar.UUID, emergencyPos);
position = emergencyPos;
}
// TODO: Get proper AVG Height
float localAVHeight = 1.56f;
float posZLimit = 22;
// TODO: Check other Scene HeightField
if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <=(int)Constants.RegionSize)
{
posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y];
}
float newPosZ = posZLimit + localAVHeight;
if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
{
position.Z = newPosZ;
}
// Only send this if the event queue is null
if (eq == null)
avatar.ControllingClient.SendTeleportLocationStart();
avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
avatar.Teleport(position);
}
else
{
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
if (reg != null)
{
m_log.DebugFormat(
"[SCENE COMMUNICATION SERVICE]: RequestTeleportToLocation to {0} in {1}",
position, reg.RegionName);
if (eq == null)
avatar.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.
IPEndPoint endPoint = reg.ExternalEndPoint;
if (endPoint.Address == null)
{
// Couldn't resolve the name. Can't TP, because the viewer wants IP addresses.
destRegionUp = false;
}
if (destRegionUp)
{
uint newRegionX = (uint)(reg.RegionHandle >> 40);
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions
if (avatar.ParentID != (uint)0)
avatar.StandUp();
if (!avatar.ValidateAttachments())
{
//.........这里部分代码省略.........
示例6: DoTeleport
//.........这里部分代码省略.........
else
{
agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
}
// Expect avatar crossing is a heavy-duty function at the destination.
// That is where MakeRoot is called, which fetches appearance and inventory.
// Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
//m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
// position, false);
//{
// avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
// // We should close that agent we just created over at destination...
// List<ulong> lst = new List<ulong>();
// lst.Add(reg.RegionHandle);
// SendCloseChildAgentAsync(avatar.UUID, lst);
// return;
//}
SetInTransit(sp.UUID);
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
sp.CopyTo(agent);
agent.Position = position;
SetCallbackURL(agent, sp.Scene.RegionInfo);
UpdateAgent(reg, finalDestination, agent);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
if (eq != null)
{
eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
0, teleportFlags, capsPath, sp.UUID);
}
else
{
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
}
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we send the attachments and close things here.
if (!WaitForCallback(sp.UUID))
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
ResetFromTransit(sp.UUID);
// Yikes! We should just have a ref to scene here.
//sp.Scene.InformClientOfNeighbours(sp);
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
return;
}
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
KillEntity(sp.Scene, sp.LocalId);
sp.MakeChildAgent();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
{
Thread.Sleep(5000);
sp.Close();
sp.Scene.IncomingCloseAgent(sp.UUID);
}
else
// now we have a child agent in this region.
sp.Reset();
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (sp.Scene.NeedSceneCacheClear(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
sp.UUID);
}
}
else
{
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
}
}
示例7: DoTeleport
public void DoTeleport(
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
Vector3 position, Vector3 lookAt, uint teleportFlags)
{
// Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
// of whether the destination region completes the teleport.
if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
return;
}
if (reg == null || finalDestination == null)
{
sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
RegionInfo sourceRegion = sp.Scene.RegionInfo;
if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination))
{
sp.ControllingClient.SendTeleportFailed(
string.Format(
"Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY,
sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
MaxTransferDistance));
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
uint newRegionX = (uint)(reg.RegionHandle >> 40);
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8);
ulong destinationHandle = finalDestination.RegionHandle;
// 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.
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
if (endPoint.Address == null)
{
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
if (!sp.ValidateAttachments())
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.",
sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName);
// if (!sp.ValidateAttachments())
// {
// sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
// return;
// }
string reason;
string version;
if (!Scene.SimulationService.QueryAccess(
finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
{
sp.ControllingClient.SendTeleportFailed(reason);
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
return;
}
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions
if (sp.ParentID != (uint)0)
sp.StandUp();
// At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
// the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
sp.ControllingClient.SendTeleportStart(teleportFlags);
//.........这里部分代码省略.........