Added forwarding of teleport request, if the teleport is within the same region,

from CM to PSA. Both the hosting CM and PSA will trigger the same region
teleport code, PSA will then sync the new position to other CMs.
dsg
Huaiyu (Kitty) Liu 2011-05-25 15:47:00 -07:00
parent 384e39f225
commit 8fa03afb5c
10 changed files with 70 additions and 0 deletions

View File

@ -83,6 +83,9 @@ namespace OpenSim.Framework
public delegate void TeleportLocationRequest( public delegate void TeleportLocationRequest(
IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags); IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags);
//DSG:
public delegate void SameRegionTeleportlRequest(IClientAPI remoteClient, byte[] tpLocReq);
public delegate void TeleportLandmarkRequest( public delegate void TeleportLandmarkRequest(
IClientAPI remoteClient, UUID regionID, Vector3 position); IClientAPI remoteClient, UUID regionID, Vector3 position);
@ -784,6 +787,9 @@ namespace OpenSim.Framework
event RequestMapBlocks OnRequestMapBlocks; event RequestMapBlocks OnRequestMapBlocks;
event RequestMapName OnMapNameRequest; event RequestMapName OnMapNameRequest;
event TeleportLocationRequest OnTeleportLocationRequest; event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
event DisconnectUser OnDisconnectUser; event DisconnectUser OnDisconnectUser;
event RequestAvatarProperties OnRequestAvatarProperties; event RequestAvatarProperties OnRequestAvatarProperties;
event SetAlwaysRun OnSetAlwaysRun; event SetAlwaysRun OnSetAlwaysRun;

View File

@ -143,6 +143,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event TeleportLandmarkRequest OnTeleportLandmarkRequest; public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;
@ -8471,6 +8474,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion #endregion
TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest;
//DSG: KittyL -- added to support same region teleport
if (tpLocReq.Info.RegionHandle == m_scene.RegionInfo.RegionHandle)
{
SameRegionTeleportlRequest handlerSameRegionTeleportlRequest = OnSameRegionTeleportlRequest;
if (handlerSameRegionTeleportlRequest != null)
{
byte[] xb = new byte[tpLocReq.Length];
int i = 0;
xb = tpLocReq.ToBytes();
handlerSameRegionTeleportlRequest(this, xb);
//return true;
}
}
if (handlerTeleportLocationRequest != null) if (handlerTeleportLocationRequest != null)
{ {
handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,

View File

@ -79,6 +79,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event TeleportLandmarkRequest OnTeleportLandmarkRequest; public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;

View File

@ -202,6 +202,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
RemoveLocalClient(kvp.Key, m_scene); RemoveLocalClient(kvp.Key, m_scene);
// Remove the agent update handler from the client // Remove the agent update handler from the client
kvp.Value.OnAgentUpdateRaw -= HandleAgentUpdateRaw; kvp.Value.OnAgentUpdateRaw -= HandleAgentUpdateRaw;
kvp.Value.OnSameRegionTeleportlRequest -= HandleAgentSameRegionTeleport;
} }
} }
catch (Exception e) catch (Exception e)
@ -848,6 +849,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// Register for interesting client events which will be forwarded to auth sim // Register for interesting client events which will be forwarded to auth sim
// These are the raw packet data blocks from the client, intercepted and sent up to the sim // These are the raw packet data blocks from the client, intercepted and sent up to the sim
client.OnAgentUpdateRaw += HandleAgentUpdateRaw; client.OnAgentUpdateRaw += HandleAgentUpdateRaw;
client.OnSameRegionTeleportlRequest += HandleAgentSameRegionTeleport;
//DSG SYNC: do not subscribe to OnChatFromClientRaw: RegionSyncModule + Scene.EventManager will handle this. //DSG SYNC: do not subscribe to OnChatFromClientRaw: RegionSyncModule + Scene.EventManager will handle this.
//client.OnChatFromClientRaw += HandleChatFromClientRaw; //client.OnChatFromClientRaw += HandleChatFromClientRaw;
client.OnAgentRequestSit += HandleAgentRequestSit; client.OnAgentRequestSit += HandleAgentRequestSit;
@ -932,6 +934,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentUpdate, agentData)); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentUpdate, agentData));
} }
//KittyL: Added to support teleporting within the same region
public void HandleAgentSameRegionTeleport(object sender, byte[] tpLocReq)
{
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentSameRegionTeleport, tpLocReq));
}
public void HandleAgentRequestSit(object sender, UUID agentID, UUID targetID, Vector3 offset) public void HandleAgentRequestSit(object sender, UUID agentID, UUID targetID, Vector3 offset)
{ {
// m_log.DebugFormat("{0} HandleAgentRequestSit for {1}", LogHeader(), agentID.ToString()); // m_log.DebugFormat("{0} HandleAgentRequestSit for {1}", LogHeader(), agentID.ToString());
@ -1133,6 +1141,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// These are the raw packet data blocks from the client, intercepted and sent up to the sim // These are the raw packet data blocks from the client, intercepted and sent up to the sim
client.OnAgentUpdateRaw += HandleAgentUpdateRaw; client.OnAgentUpdateRaw += HandleAgentUpdateRaw;
client.OnChatFromClientRaw += HandleChatFromClientRaw; client.OnChatFromClientRaw += HandleChatFromClientRaw;
//KittyL: added to support same region teleport
client.OnSameRegionTeleportlRequest += HandleAgentSameRegionTeleport;
presence.IsSyncedAvatar = false; presence.IsSyncedAvatar = false;
} }
} }

View File

@ -420,6 +420,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return; return;
} }
} }
case RegionSyncMessage.MsgType.AgentSameRegionTeleport:
//KittyL: added to support same region teleporting
int lent = 0;
TeleportLocationRequestPacket tpLocReq = new TeleportLocationRequestPacket(msg.Data, ref lent);
RegionSyncAvatar avatar;
bool avFound;
lock (m_syncRoot)
{
avFound = m_syncedAvatars.TryGetValue(tpLocReq.AgentData.AgentID, out avatar);
}
if (!avFound)
{
RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Received agent update for avatar not owned by this client view {0}", tpLocReq.AgentData.AgentID));
return;
}
m_scene.RequestTeleportLocation(avatar, m_scene.RegionInfo.RegionHandle, tpLocReq.Info.Position,
tpLocReq.Info.LookAt, 16);
return;
case RegionSyncMessage.MsgType.AgentRemove: case RegionSyncMessage.MsgType.AgentRemove:
{ {
// Get the data from message and error check // Get the data from message and error check

View File

@ -66,6 +66,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
ActorConnect, ActorConnect,
AgentAdd, AgentAdd,
AgentUpdate, AgentUpdate,
AgentSameRegionTeleport,
AgentRemove, AgentRemove,
AgentRequestSit, AgentRequestSit,
AgentSit, AgentSit,

View File

@ -76,6 +76,9 @@ namespace OpenSim.Region.Examples.SimpleModule
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event TeleportLandmarkRequest OnTeleportLandmarkRequest; public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;

View File

@ -676,6 +676,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun; public event SetAlwaysRun OnSetAlwaysRun;

View File

@ -184,6 +184,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event TeleportLandmarkRequest OnTeleportLandmarkRequest; public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;

View File

@ -88,6 +88,9 @@ namespace OpenSim.Tests.Common.Mock
public event RequestMapBlocks OnRequestMapBlocks; public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest; public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest; public event TeleportLocationRequest OnTeleportLocationRequest;
//DSG:
public event SameRegionTeleportlRequest OnSameRegionTeleportlRequest;
//end of DSG
public event TeleportLandmarkRequest OnTeleportLandmarkRequest; public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser; public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties; public event RequestAvatarProperties OnRequestAvatarProperties;