diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 5c53f78..f6ec481 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -87,6 +87,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
87 | protected override void OnNewClient(IClientAPI client) | 87 | protected override void OnNewClient(IClientAPI client) |
88 | { | 88 | { |
89 | client.OnTeleportHomeRequest += TeleportHome; | 89 | client.OnTeleportHomeRequest += TeleportHome; |
90 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | ||
90 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 91 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
91 | } | 92 | } |
92 | 93 | ||
@@ -228,6 +229,58 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
228 | 229 | ||
229 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 230 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
230 | } | 231 | } |
232 | |||
233 | /// <summary> | ||
234 | /// Tries to teleport agent to landmark. | ||
235 | /// </summary> | ||
236 | /// <param name="remoteClient"></param> | ||
237 | /// <param name="regionHandle"></param> | ||
238 | /// <param name="position"></param> | ||
239 | public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) | ||
240 | { | ||
241 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}", | ||
242 | (lm.Gatekeeper == string.Empty ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position); | ||
243 | if (lm.Gatekeeper == string.Empty) | ||
244 | { | ||
245 | base.RequestTeleportLandmark(remoteClient, lm); | ||
246 | return; | ||
247 | } | ||
248 | |||
249 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | ||
250 | |||
251 | // Local region? | ||
252 | if (info != null) | ||
253 | { | ||
254 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, | ||
255 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | ||
256 | return; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | // Foreign region | ||
261 | Scene scene = (Scene)(remoteClient.Scene); | ||
262 | GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); | ||
263 | GridRegion gatekeeper = new GridRegion(); | ||
264 | gatekeeper.ServerURI = lm.Gatekeeper; | ||
265 | GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); | ||
266 | if (finalDestination != null) | ||
267 | { | ||
268 | ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); | ||
269 | IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); | ||
270 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | ||
271 | if (transferMod != null && sp != null && eq != null) | ||
272 | transferMod.DoTeleport(sp, gatekeeper, finalDestination, lm.Position, | ||
273 | Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark), eq); | ||
274 | } | ||
275 | |||
276 | } | ||
277 | |||
278 | // can't find the region: Tell viewer and abort | ||
279 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); | ||
280 | |||
281 | } | ||
282 | |||
283 | |||
231 | #endregion | 284 | #endregion |
232 | 285 | ||
233 | #region IUserAgentVerificationModule | 286 | #region IUserAgentVerificationModule |