diff options
author | Diva Canto | 2010-01-18 09:14:19 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-18 09:14:19 -0800 |
commit | bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea (patch) | |
tree | 3594ac376b196a87139450ada56c555ca776b2be /OpenSim/Region | |
parent | HG teleports through gatekeeper are working. (diff) | |
download | opensim-SC-bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea.zip opensim-SC-bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea.tar.gz opensim-SC-bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea.tar.bz2 opensim-SC-bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea.tar.xz |
* Fixed misspelling of field in GridService
* Moved TeleportClientHome to EntityTransferModule
Diffstat (limited to 'OpenSim/Region')
4 files changed, 43 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 622d057..fcc7a85 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private bool m_Enabled = false; | 53 | protected bool m_Enabled = false; |
54 | protected Scene m_aScene; | 54 | protected Scene m_aScene; |
55 | protected List<UUID> m_agentsInTransit; | 55 | protected List<UUID> m_agentsInTransit; |
56 | 56 | ||
@@ -94,6 +94,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
94 | m_aScene = scene; | 94 | m_aScene = scene; |
95 | 95 | ||
96 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | 96 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
97 | scene.EventManager.OnNewClient += OnNewClient; | ||
98 | } | ||
99 | |||
100 | protected void OnNewClient(IClientAPI client) | ||
101 | { | ||
102 | client.OnTeleportHomeRequest += TeleportHome; | ||
97 | } | 103 | } |
98 | 104 | ||
99 | public virtual void Close() | 105 | public virtual void Close() |
@@ -499,6 +505,33 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
499 | 505 | ||
500 | #endregion | 506 | #endregion |
501 | 507 | ||
508 | #region Teleport Home | ||
509 | |||
510 | public virtual void TeleportHome(UUID id, IClientAPI client) | ||
511 | { | ||
512 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | ||
513 | |||
514 | OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); | ||
515 | |||
516 | if (pinfo != null) | ||
517 | { | ||
518 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID); | ||
519 | if (regionInfo == null) | ||
520 | { | ||
521 | // can't find the Home region: Tell viewer and abort | ||
522 | client.SendTeleportFailed("Your home region could not be found."); | ||
523 | return; | ||
524 | } | ||
525 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... | ||
526 | ((Scene)(client.Scene)).RequestTeleportLocation( | ||
527 | client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt, | ||
528 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | ||
529 | } | ||
530 | } | ||
531 | |||
532 | #endregion | ||
533 | |||
534 | |||
502 | #region Agent Crossings | 535 | #region Agent Crossings |
503 | 536 | ||
504 | public void Cross(ScenePresence agent, bool isFlying) | 537 | public void Cross(ScenePresence agent, bool isFlying) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 6645293..101aea0 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -47,7 +47,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private bool m_Enabled = false; | ||
51 | private IHypergridService m_HypergridService; | 50 | private IHypergridService m_HypergridService; |
52 | private IHypergridService HyperGridService | 51 | private IHypergridService HyperGridService |
53 | { | 52 | { |
@@ -84,42 +83,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
84 | } | 83 | } |
85 | } | 84 | } |
86 | 85 | ||
87 | public override void PostInitialise() | ||
88 | { | ||
89 | } | ||
90 | |||
91 | public override void AddRegion(Scene scene) | ||
92 | { | ||
93 | if (!m_Enabled) | ||
94 | return; | ||
95 | |||
96 | if (m_aScene == null) | ||
97 | m_aScene = scene; | ||
98 | |||
99 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | ||
100 | } | ||
101 | |||
102 | public override void Close() | ||
103 | { | ||
104 | if (!m_Enabled) | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | |||
109 | public override void RemoveRegion(Scene scene) | ||
110 | { | ||
111 | if (!m_Enabled) | ||
112 | return; | ||
113 | if (scene == m_aScene) | ||
114 | m_aScene = null; | ||
115 | } | ||
116 | |||
117 | public override void RegionLoaded(Scene scene) | ||
118 | { | ||
119 | if (!m_Enabled) | ||
120 | return; | ||
121 | |||
122 | } | ||
123 | 86 | ||
124 | #endregion | 87 | #endregion |
125 | 88 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index a0505df..73c68f1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -30,6 +30,7 @@ using OpenSim.Services.Interfaces; | |||
30 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 30 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
31 | 31 | ||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
34 | 35 | ||
35 | namespace OpenSim.Region.Framework.Interfaces | 36 | namespace OpenSim.Region.Framework.Interfaces |
@@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, | 40 | void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, |
40 | Vector3 lookAt, uint teleportFlags); | 41 | Vector3 lookAt, uint teleportFlags); |
41 | 42 | ||
43 | void TeleportHome(UUID id, IClientAPI client); | ||
44 | |||
42 | void Cross(ScenePresence agent, bool isFlying); | 45 | void Cross(ScenePresence agent, bool isFlying); |
43 | 46 | ||
44 | void AgentArrivedAtDestination(UUID agent); | 47 | void AgentArrivedAtDestination(UUID agent); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5730b56..3cfb236 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2558,7 +2558,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2558 | { | 2558 | { |
2559 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2559 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2560 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 2560 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
2561 | client.OnTeleportHomeRequest += TeleportClientHome; | ||
2562 | } | 2561 | } |
2563 | 2562 | ||
2564 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) | 2563 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
@@ -2713,7 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2713 | { | 2712 | { |
2714 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | 2713 | client.OnTeleportLocationRequest -= RequestTeleportLocation; |
2715 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | 2714 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; |
2716 | client.OnTeleportHomeRequest -= TeleportClientHome; | 2715 | //client.OnTeleportHomeRequest -= TeleportClientHome; |
2717 | } | 2716 | } |
2718 | 2717 | ||
2719 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) | 2718 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) |
@@ -2760,20 +2759,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2760 | /// <param name="client">The IClientAPI for the client</param> | 2759 | /// <param name="client">The IClientAPI for the client</param> |
2761 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2760 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) |
2762 | { | 2761 | { |
2763 | OpenSim.Services.Interfaces.PresenceInfo pinfo = PresenceService.GetAgent(client.SessionId); | 2762 | if (m_teleportModule != null) |
2764 | 2763 | m_teleportModule.TeleportHome(agentId, client); | |
2765 | if (pinfo != null) | 2764 | else |
2766 | { | 2765 | { |
2767 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID); | 2766 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2768 | if (regionInfo == null) | 2767 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2769 | { | ||
2770 | // can't find the Home region: Tell viewer and abort | ||
2771 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2772 | return; | ||
2773 | } | ||
2774 | RequestTeleportLocation( | ||
2775 | client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt, | ||
2776 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | ||
2777 | } | 2768 | } |
2778 | } | 2769 | } |
2779 | 2770 | ||