public void HandleTeleportRequest(Message m) { var req = (TeleportRequest)m; if (req.CircuitAgentID != req.AgentID || req.CircuitSessionID != req.SessionID) { return; } AgentCircuit circuit; ViewerAgent agent; if (TryGetAgentCircuit(m, out agent, out circuit)) { /* TODO: we need the specific local list for HG destinations */ if (!agent.TeleportTo(circuit.Scene, req.RegionID, req.Position, req.LookAt, TeleportFlags.ViaLocation)) { var failedmsg = new TeleportFailed { AgentID = agent.ID, Reason = agent.GetLanguageString(agent.CurrentCulture, "TeleportNotPossibleToRegion", "Teleport to region not possible") }; agent.SendMessageAlways(failedmsg, req.CircuitSceneID); } } }
public void HandleTeleportLocationRequest(Message m) { var req = (TeleportLocationRequest)m; if (req.CircuitAgentID != req.AgentID || req.CircuitSessionID != req.SessionID) { return; } AgentCircuit circuit; ViewerAgent agent; if (TryGetAgentCircuit(m, out agent, out circuit)) { RegionInfo hgRegionInfo; #if DEBUG m_Log.DebugFormat("Teleport location request at location {0} for agent {1} ({2})", req.GridPosition, agent.NamedOwner.FullName, agent.Owner.ID); #endif /* check whether HG destination is addressed */ if (agent.TryGetDestination(req.GridPosition, out hgRegionInfo)) { #if DEBUG m_Log.DebugFormat("Teleporting to {0}@{1}", hgRegionInfo.Name, hgRegionInfo.GridURI); #endif if (!agent.TeleportTo(circuit.Scene, hgRegionInfo.GridURI, hgRegionInfo.ID, req.Position, req.LookAt, TeleportFlags.ViaLocation)) { var failedmsg = new TeleportFailed { AgentID = agent.ID, Reason = agent.GetLanguageString(agent.CurrentCulture, "TeleportNotPossibleToRegion", "Teleport to region not possible") }; agent.SendMessageAlways(failedmsg, req.CircuitSceneID); } } else if (!agent.TeleportTo(circuit.Scene, req.GridPosition, req.Position, req.LookAt, TeleportFlags.ViaLocation)) { var failedmsg = new TeleportFailed { AgentID = agent.ID, Reason = this.GetLanguageString(agent.CurrentCulture, "TeleportNotPossibleToRegion", "Teleport to region not possible") }; agent.SendMessageAlways(failedmsg, req.CircuitSceneID); } } }