diff options
author | Diva Canto | 2011-06-03 10:26:58 -0700 |
---|---|---|
committer | Diva Canto | 2011-06-03 10:26:58 -0700 |
commit | e33cedfd427779a3df844150869eb07b664849df (patch) | |
tree | 69a87386a2b722c7ea92074bcd5cf7a0b7fd6eaa /OpenSim | |
parent | HG Landmarks being created. WARNING: new config var under [HGInventoryAccessM... (diff) | |
download | opensim-SC_OLD-e33cedfd427779a3df844150869eb07b664849df.zip opensim-SC_OLD-e33cedfd427779a3df844150869eb07b664849df.tar.gz opensim-SC_OLD-e33cedfd427779a3df844150869eb07b664849df.tar.bz2 opensim-SC_OLD-e33cedfd427779a3df844150869eb07b664849df.tar.xz |
HG Landmarks now working.
Diffstat (limited to 'OpenSim')
7 files changed, 89 insertions, 28 deletions
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index f433235..103f756 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs | |||
@@ -35,6 +35,7 @@ namespace OpenSim.Framework | |||
35 | public Vector3 Position; | 35 | public Vector3 Position; |
36 | public ulong RegionHandle; | 36 | public ulong RegionHandle; |
37 | public UUID RegionID; | 37 | public UUID RegionID; |
38 | public string Gatekeeper = string.Empty; | ||
38 | public int Version; | 39 | public int Version; |
39 | 40 | ||
40 | public AssetLandmark(AssetBase a) | 41 | public AssetLandmark(AssetBase a) |
@@ -51,6 +52,8 @@ namespace OpenSim.Framework | |||
51 | string[] parts = temp.Split('\n'); | 52 | string[] parts = temp.Split('\n'); |
52 | int.TryParse(parts[0].Substring(17, 1), out Version); | 53 | int.TryParse(parts[0].Substring(17, 1), out Version); |
53 | UUID.TryParse(parts[1].Substring(10, 36), out RegionID); | 54 | UUID.TryParse(parts[1].Substring(10, 36), out RegionID); |
55 | if (parts.Length >= 5) | ||
56 | Gatekeeper = parts[4].Replace("gatekeeper ", ""); | ||
54 | // The position is a vector with spaces as separators ("10.3 32.5 43"). | 57 | // The position is a vector with spaces as separators ("10.3 32.5 43"). |
55 | // Parse each scalar separately to take into account the system's culture setting. | 58 | // Parse each scalar separately to take into account the system's culture setting. |
56 | string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' '); | 59 | string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' '); |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 137f432..659d42f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework | |||
83 | IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags); | 83 | IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags); |
84 | 84 | ||
85 | public delegate void TeleportLandmarkRequest( | 85 | public delegate void TeleportLandmarkRequest( |
86 | IClientAPI remoteClient, UUID regionID, Vector3 position); | 86 | IClientAPI remoteClient, AssetLandmark lm); |
87 | 87 | ||
88 | public delegate void DisconnectUser(); | 88 | public delegate void DisconnectUser(); |
89 | 89 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d8fcb62..3a9e4b7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -8301,6 +8301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8301 | AssetLandmark lm; | 8301 | AssetLandmark lm; |
8302 | if (lmid != UUID.Zero) | 8302 | if (lmid != UUID.Zero) |
8303 | { | 8303 | { |
8304 | |||
8304 | //AssetBase lma = m_assetCache.GetAsset(lmid, false); | 8305 | //AssetBase lma = m_assetCache.GetAsset(lmid, false); |
8305 | AssetBase lma = m_assetService.Get(lmid.ToString()); | 8306 | AssetBase lma = m_assetService.Get(lmid.ToString()); |
8306 | 8307 | ||
@@ -8341,13 +8342,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8341 | TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; | 8342 | TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; |
8342 | if (handlerTeleportLandmarkRequest != null) | 8343 | if (handlerTeleportLandmarkRequest != null) |
8343 | { | 8344 | { |
8344 | handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); | 8345 | handlerTeleportLandmarkRequest(this, lm); |
8345 | } | 8346 | } |
8346 | else | 8347 | else |
8347 | { | 8348 | { |
8348 | //no event handler so cancel request | 8349 | //no event handler so cancel request |
8349 | |||
8350 | |||
8351 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); | 8350 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); |
8352 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | 8351 | tpCancel.Info.AgentID = tpReq.Info.AgentID; |
8353 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | 8352 | tpCancel.Info.SessionID = tpReq.Info.SessionID; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ec084fb..1341533 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
52 | 52 | ||
53 | protected bool m_Enabled = false; | 53 | protected bool m_Enabled = false; |
54 | protected Scene m_aScene; | 54 | protected Scene m_aScene; |
55 | protected List<Scene> m_Scenes = new List<Scene>(); | ||
55 | protected List<UUID> m_agentsInTransit; | 56 | protected List<UUID> m_agentsInTransit; |
56 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = | 57 | private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions = |
57 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); | 58 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); |
@@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
96 | if (m_aScene == null) | 97 | if (m_aScene == null) |
97 | m_aScene = scene; | 98 | m_aScene = scene; |
98 | 99 | ||
100 | m_Scenes.Add(scene); | ||
99 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | 101 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
100 | scene.EventManager.OnNewClient += OnNewClient; | 102 | scene.EventManager.OnNewClient += OnNewClient; |
101 | } | 103 | } |
@@ -103,6 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
103 | protected virtual void OnNewClient(IClientAPI client) | 105 | protected virtual void OnNewClient(IClientAPI client) |
104 | { | 106 | { |
105 | client.OnTeleportHomeRequest += TeleportHome; | 107 | client.OnTeleportHomeRequest += TeleportHome; |
108 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | ||
106 | } | 109 | } |
107 | 110 | ||
108 | public virtual void Close() | 111 | public virtual void Close() |
@@ -118,6 +121,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
118 | return; | 121 | return; |
119 | if (scene == m_aScene) | 122 | if (scene == m_aScene) |
120 | m_aScene = null; | 123 | m_aScene = null; |
124 | |||
125 | m_Scenes.Remove(scene); | ||
121 | } | 126 | } |
122 | 127 | ||
123 | public virtual void RegionLoaded(Scene scene) | 128 | public virtual void RegionLoaded(Scene scene) |
@@ -127,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
127 | 132 | ||
128 | } | 133 | } |
129 | 134 | ||
130 | |||
131 | #endregion | 135 | #endregion |
132 | 136 | ||
133 | #region Agent Teleports | 137 | #region Agent Teleports |
@@ -556,6 +560,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
556 | 560 | ||
557 | #endregion | 561 | #endregion |
558 | 562 | ||
563 | #region Landmark Teleport | ||
564 | /// <summary> | ||
565 | /// Tries to teleport agent to landmark. | ||
566 | /// </summary> | ||
567 | /// <param name="remoteClient"></param> | ||
568 | /// <param name="regionHandle"></param> | ||
569 | /// <param name="position"></param> | ||
570 | public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm) | ||
571 | { | ||
572 | GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); | ||
573 | |||
574 | if (info == null) | ||
575 | { | ||
576 | // can't find the region: Tell viewer and abort | ||
577 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); | ||
578 | return; | ||
579 | } | ||
580 | ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, | ||
581 | Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); | ||
582 | } | ||
583 | |||
584 | #endregion | ||
585 | |||
559 | #region Teleport Home | 586 | #region Teleport Home |
560 | 587 | ||
561 | public virtual void TeleportHome(UUID id, IClientAPI client) | 588 | public virtual void TeleportHome(UUID id, IClientAPI client) |
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 |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 844054c..7964b4f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
126 | { | 126 | { |
127 | suffix = " @ " + m_ThisGatekeeper; | 127 | suffix = " @ " + m_ThisGatekeeper; |
128 | Vector3 pos = presence.AbsolutePosition; | 128 | Vector3 pos = presence.AbsolutePosition; |
129 | return String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\ngatekeeper {5}", | 129 | return String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\ngatekeeper {5}\n", |
130 | presence.Scene.RegionInfo.RegionID, | 130 | presence.Scene.RegionInfo.RegionID, |
131 | pos.X, pos.Y, pos.Z, | 131 | pos.X, pos.Y, pos.Z, |
132 | presence.RegionHandle, | 132 | presence.RegionHandle, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b179683..77301d8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2749,7 +2749,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2749 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) | 2749 | public virtual void SubscribeToClientTeleportEvents(IClientAPI client) |
2750 | { | 2750 | { |
2751 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2751 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2752 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | ||
2753 | } | 2752 | } |
2754 | 2753 | ||
2755 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) | 2754 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
@@ -2875,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2875 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) | 2874 | public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) |
2876 | { | 2875 | { |
2877 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | 2876 | client.OnTeleportLocationRequest -= RequestTeleportLocation; |
2878 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | 2877 | //client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; |
2879 | //client.OnTeleportHomeRequest -= TeleportClientHome; | 2878 | //client.OnTeleportHomeRequest -= TeleportClientHome; |
2880 | } | 2879 | } |
2881 | 2880 | ||
@@ -3925,26 +3924,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3925 | } | 3924 | } |
3926 | } | 3925 | } |
3927 | 3926 | ||
3928 | /// <summary> | ||
3929 | /// Tries to teleport agent to landmark. | ||
3930 | /// </summary> | ||
3931 | /// <param name="remoteClient"></param> | ||
3932 | /// <param name="regionHandle"></param> | ||
3933 | /// <param name="position"></param> | ||
3934 | public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position) | ||
3935 | { | ||
3936 | GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID); | ||
3937 | |||
3938 | if (info == null) | ||
3939 | { | ||
3940 | // can't find the region: Tell viewer and abort | ||
3941 | remoteClient.SendTeleportFailed("The teleport destination could not be found."); | ||
3942 | return; | ||
3943 | } | ||
3944 | |||
3945 | RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); | ||
3946 | } | ||
3947 | |||
3948 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 3927 | public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
3949 | { | 3928 | { |
3950 | if (m_teleportModule != null) | 3929 | if (m_teleportModule != null) |