aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs37
1 files changed, 28 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 5c99d73..d7e62a8 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -38,6 +38,8 @@ using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Services.Interfaces;
42using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 43
42namespace OpenSim.Region.Framework.Scenes.Hypergrid 44namespace OpenSim.Region.Framework.Scenes.Hypergrid
43{ 45{
@@ -45,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
45 { 47 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 49
48 public readonly IHyperlink m_hg; 50 private IHyperlinkService m_hg;
51 IHyperlinkService HyperlinkService
52 {
53 get
54 {
55 if (m_hg == null)
56 m_hg = m_scene.RequestModuleInterface<IHyperlinkService>();
57 return m_hg;
58 }
59 }
49 60
50 public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) 61 public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan)
51 { 62 {
52 m_hg = hg;
53 } 63 }
54 64
55 65
@@ -77,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
77 if (regionHandle == m_regionInfo.RegionHandle) 87 if (regionHandle == m_regionInfo.RegionHandle)
78 { 88 {
79 // Teleport within the same region 89 // Teleport within the same region
80 if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0) 90 if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0)
81 { 91 {
82 Vector3 emergencyPos = new Vector3(128, 128, 128); 92 Vector3 emergencyPos = new Vector3(128, 128, 128);
83 93
@@ -89,7 +99,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
89 // TODO: Get proper AVG Height 99 // TODO: Get proper AVG Height
90 float localAVHeight = 1.56f; 100 float localAVHeight = 1.56f;
91 101
92 float posZLimit = (float)avatar.Scene.Heightmap[(int)position.X, (int)position.Y]; 102 float posZLimit = 22;
103
104 if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize)
105 {
106 posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y];
107 }
108
93 float newPosZ = posZLimit + localAVHeight; 109 float newPosZ = posZLimit + localAVHeight;
94 if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 110 if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
95 { 111 {
@@ -106,7 +122,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
106 } 122 }
107 else 123 else
108 { 124 {
109 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); 125 uint x = 0, y = 0;
126 Utils.LongToUInts(regionHandle, out x, out y);
127 GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
128
110 if (reg != null) 129 if (reg != null)
111 { 130 {
112 131
@@ -119,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
119 /// Hypergrid mod start 138 /// Hypergrid mod start
120 /// 139 ///
121 /// 140 ///
122 bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); 141 bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null);
123 bool isHomeUser = true; 142 bool isHomeUser = true;
124 ulong realHandle = regionHandle; 143 ulong realHandle = regionHandle;
125 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); 144 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID);
126 if (uinfo != null) 145 if (uinfo != null)
127 { 146 {
128 isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile); 147 isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID);
129 realHandle = m_hg.FindRegionHandle(regionHandle); 148 realHandle = m_hg.FindRegionHandle(regionHandle);
130 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); 149 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString());
131 } 150 }
@@ -338,7 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
338 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); 357 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
339 m_log.DebugFormat( 358 m_log.DebugFormat(
340 "[HGSceneCommService]: User {0} is going to another region, profile cache removed", 359 "[HGSceneCommService]: User {0} is going to another region, profile cache removed",
341 avatar.UUID); 360 avatar.UUID);
342 } 361 }
343 } 362 }
344 else 363 else