diff options
author | John Hurliman | 2009-09-30 15:28:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-09-30 15:28:23 -0700 |
commit | acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009 (patch) | |
tree | 305349e1bd0a5849fd7f96483e24d5e07b24b8f4 /OpenSim/Region/Framework/Scenes/Hypergrid | |
parent | * Adding Scale to EntityBase * Fixing the incorrect initialization of EntityB... (diff) | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.zip opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.gz opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.bz2 opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Hypergrid')
4 files changed, 53 insertions, 269 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 5d65f98..b6fa41d 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Framework.Communications.Clients; | 36 | using OpenSim.Framework.Communications.Clients; |
37 | using OpenSim.Region.Framework.Scenes.Serialization; | 37 | using OpenSim.Region.Framework.Scenes.Serialization; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | //using HyperGrid.Framework; | 40 | //using HyperGrid.Framework; |
40 | //using OpenSim.Region.Communications.Hypergrid; | 41 | //using OpenSim.Region.Communications.Hypergrid; |
@@ -47,10 +48,21 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
49 | // This maps between inventory server urls and inventory server clients | 50 | // This maps between inventory server urls and inventory server clients |
50 | private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); | 51 | // private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); |
51 | |||
52 | 52 | ||
53 | private Scene m_scene; | 53 | private Scene m_scene; |
54 | |||
55 | private IHyperlinkService m_hyper; | ||
56 | IHyperlinkService HyperlinkService | ||
57 | { | ||
58 | get | ||
59 | { | ||
60 | if (m_hyper == null) | ||
61 | m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>(); | ||
62 | return m_hyper; | ||
63 | } | ||
64 | } | ||
65 | |||
54 | #endregion | 66 | #endregion |
55 | 67 | ||
56 | #region Constructor | 68 | #region Constructor |
@@ -72,30 +84,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
72 | return null; | 84 | return null; |
73 | } | 85 | } |
74 | 86 | ||
75 | private string UserInventoryURL(UUID userID) | 87 | // private string UserInventoryURL(UUID userID) |
76 | { | 88 | // { |
77 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 89 | // CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); |
78 | if (uinfo != null) | 90 | // if (uinfo != null) |
79 | return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI; | 91 | // return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI; |
80 | return null; | 92 | // return null; |
81 | } | 93 | // } |
82 | 94 | ||
83 | private bool IsLocalUser(UUID userID) | ||
84 | { | ||
85 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | ||
86 | |||
87 | if (uinfo != null) | ||
88 | { | ||
89 | if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile)) | ||
90 | { | ||
91 | m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | ||
92 | return true; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | ||
97 | return false; | ||
98 | } | ||
99 | 95 | ||
100 | public AssetBase FetchAsset(string url, UUID assetID) | 96 | public AssetBase FetchAsset(string url, UUID assetID) |
101 | { | 97 | { |
@@ -171,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
171 | 167 | ||
172 | public void Get(UUID assetID, UUID ownerID) | 168 | public void Get(UUID assetID, UUID ownerID) |
173 | { | 169 | { |
174 | if (!IsLocalUser(ownerID)) | 170 | if (!HyperlinkService.IsLocalUser(ownerID)) |
175 | { | 171 | { |
176 | // Get the item from the remote asset server onto the local AssetCache | 172 | // Get the item from the remote asset server onto the local AssetCache |
177 | // and place an entry in m_assetMap | 173 | // and place an entry in m_assetMap |
@@ -229,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
229 | 225 | ||
230 | public void Post(UUID assetID, UUID ownerID) | 226 | public void Post(UUID assetID, UUID ownerID) |
231 | { | 227 | { |
232 | if (!IsLocalUser(ownerID)) | 228 | if (!HyperlinkService.IsLocalUser(ownerID)) |
233 | { | 229 | { |
234 | // Post the item from the local AssetCache onto the remote asset server | 230 | // Post the item from the local AssetCache onto the remote asset server |
235 | // and place an entry in m_assetMap | 231 | // and place an entry in m_assetMap |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs deleted file mode 100644 index a576feb..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs +++ /dev/null | |||
@@ -1,232 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Net; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | ||
36 | { | ||
37 | public class HGHyperlink | ||
38 | { | ||
39 | private static readonly ILog m_log = | ||
40 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
41 | private static Random random = new Random(); | ||
42 | |||
43 | public static RegionInfo TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, uint xloc, uint yloc) | ||
44 | { | ||
45 | string host = "127.0.0.1"; | ||
46 | string portstr; | ||
47 | string regionName = ""; | ||
48 | uint port = 9000; | ||
49 | string[] parts = mapName.Split(new char[] { ':' }); | ||
50 | if (parts.Length >= 1) | ||
51 | { | ||
52 | host = parts[0]; | ||
53 | } | ||
54 | if (parts.Length >= 2) | ||
55 | { | ||
56 | portstr = parts[1]; | ||
57 | if (!UInt32.TryParse(portstr, out port)) | ||
58 | regionName = parts[1]; | ||
59 | } | ||
60 | // always take the last one | ||
61 | if (parts.Length >= 3) | ||
62 | { | ||
63 | regionName = parts[2]; | ||
64 | } | ||
65 | |||
66 | // Sanity check. Don't ever link to this sim. | ||
67 | IPAddress ipaddr = null; | ||
68 | try | ||
69 | { | ||
70 | ipaddr = Util.GetHostFromDNS(host); | ||
71 | } | ||
72 | catch { } | ||
73 | |||
74 | if ((ipaddr != null) && | ||
75 | !((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port))) | ||
76 | { | ||
77 | RegionInfo regInfo; | ||
78 | bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo); | ||
79 | if (success) | ||
80 | { | ||
81 | regInfo.RegionName = mapName; | ||
82 | return regInfo; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | return null; | ||
87 | } | ||
88 | |||
89 | public static RegionInfo TryLinkRegion(Scene m_scene, IClientAPI client, string mapName) | ||
90 | { | ||
91 | uint xloc = (uint)(random.Next(0, Int16.MaxValue)); | ||
92 | return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0); | ||
93 | } | ||
94 | |||
95 | public static bool TryCreateLink(Scene m_scene, IClientAPI client, uint xloc, uint yloc, | ||
96 | string externalRegionName, uint externalPort, string externalHostName, out RegionInfo regInfo) | ||
97 | { | ||
98 | m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); | ||
99 | |||
100 | regInfo = new RegionInfo(); | ||
101 | regInfo.RegionName = externalRegionName; | ||
102 | regInfo.HttpPort = externalPort; | ||
103 | regInfo.ExternalHostName = externalHostName; | ||
104 | regInfo.RegionLocX = xloc; | ||
105 | regInfo.RegionLocY = yloc; | ||
106 | |||
107 | try | ||
108 | { | ||
109 | regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); | ||
110 | } | ||
111 | catch (Exception e) | ||
112 | { | ||
113 | m_log.Warn("[HGrid]: Wrong format for link-region: " + e.Message); | ||
114 | return false; | ||
115 | } | ||
116 | regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString(); | ||
117 | |||
118 | // Finally, link it | ||
119 | try | ||
120 | { | ||
121 | m_scene.CommsManager.GridService.RegisterRegion(regInfo); | ||
122 | } | ||
123 | catch (Exception e) | ||
124 | { | ||
125 | m_log.Warn("[HGrid]: Unable to link region: " + e.Message); | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | uint x, y; | ||
130 | if (!Check4096(m_scene, regInfo, out x, out y)) | ||
131 | { | ||
132 | m_scene.CommsManager.GridService.DeregisterRegion(regInfo); | ||
133 | if (client != null) | ||
134 | client.SendAlertMessage("Region is too far (" + x + ", " + y + ")"); | ||
135 | m_log.Info("[HGrid]: Unable to link, region is too far (" + x + ", " + y + ")"); | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | if (!CheckCoords(m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, x, y)) | ||
140 | { | ||
141 | m_scene.CommsManager.GridService.DeregisterRegion(regInfo); | ||
142 | if (client != null) | ||
143 | client.SendAlertMessage("Region has incompatible coordinates (" + x + ", " + y + ")"); | ||
144 | m_log.Info("[HGrid]: Unable to link, region has incompatible coordinates (" + x + ", " + y + ")"); | ||
145 | return false; | ||
146 | } | ||
147 | |||
148 | m_log.Debug("[HGrid]: link region succeeded"); | ||
149 | return true; | ||
150 | } | ||
151 | |||
152 | public static bool TryUnlinkRegion(Scene m_scene, string mapName) | ||
153 | { | ||
154 | RegionInfo regInfo = null; | ||
155 | if (mapName.Contains(":")) | ||
156 | { | ||
157 | string host = "127.0.0.1"; | ||
158 | //string portstr; | ||
159 | //string regionName = ""; | ||
160 | uint port = 9000; | ||
161 | string[] parts = mapName.Split(new char[] { ':' }); | ||
162 | if (parts.Length >= 1) | ||
163 | { | ||
164 | host = parts[0]; | ||
165 | } | ||
166 | // if (parts.Length >= 2) | ||
167 | // { | ||
168 | // portstr = parts[1]; | ||
169 | // if (!UInt32.TryParse(portstr, out port)) | ||
170 | // regionName = parts[1]; | ||
171 | // } | ||
172 | // always take the last one | ||
173 | // if (parts.Length >= 3) | ||
174 | // { | ||
175 | // regionName = parts[2]; | ||
176 | // } | ||
177 | regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(host, port); | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(mapName); | ||
182 | } | ||
183 | if (regInfo != null) | ||
184 | { | ||
185 | return m_scene.CommsManager.GridService.DeregisterRegion(regInfo); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | m_log.InfoFormat("[HGrid]: Region {0} not found", mapName); | ||
190 | return false; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | /// <summary> | ||
195 | /// Cope with this viewer limitation. | ||
196 | /// </summary> | ||
197 | /// <param name="regInfo"></param> | ||
198 | /// <returns></returns> | ||
199 | public static bool Check4096(Scene m_scene, RegionInfo regInfo, out uint x, out uint y) | ||
200 | { | ||
201 | ulong realHandle; | ||
202 | if (UInt64.TryParse(regInfo.regionSecret, out realHandle)) | ||
203 | { | ||
204 | Utils.LongToUInts(realHandle, out x, out y); | ||
205 | x = x / Constants.RegionSize; | ||
206 | y = y / Constants.RegionSize; | ||
207 | |||
208 | if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - (int)x) >= 4096) || | ||
209 | (Math.Abs((int)m_scene.RegionInfo.RegionLocY - (int)y) >= 4096)) | ||
210 | { | ||
211 | return false; | ||
212 | } | ||
213 | return true; | ||
214 | } | ||
215 | else | ||
216 | { | ||
217 | m_scene.CommsManager.GridService.RegisterRegion(regInfo); | ||
218 | m_log.Debug("[HGrid]: Gnomes. Region deregistered."); | ||
219 | x = y = 0; | ||
220 | return false; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | public static bool CheckCoords(uint thisx, uint thisy, uint x, uint y) | ||
225 | { | ||
226 | if ((thisx == x) && (thisy == y)) | ||
227 | return false; | ||
228 | return true; | ||
229 | } | ||
230 | |||
231 | } | ||
232 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs index bf55df7..b1981b6 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs | |||
@@ -29,6 +29,7 @@ using OpenMetaverse; | |||
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenSim.Framework.Communications.Cache; | 30 | using OpenSim.Framework.Communications.Cache; |
31 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 31 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
32 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | 34 | namespace OpenSim.Region.Framework.Scenes.Hypergrid |
34 | { | 35 | { |
@@ -50,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
50 | 51 | ||
51 | if (UserProfile != null) | 52 | if (UserProfile != null) |
52 | { | 53 | { |
53 | RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); | 54 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); |
54 | //if (regionInfo != null) | 55 | //if (regionInfo != null) |
55 | //{ | 56 | //{ |
56 | // UserProfile.HomeRegionID = regionInfo.RegionID; | 57 | // UserProfile.HomeRegionID = regionInfo.RegionID; |
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; | |||
38 | using OpenSim.Framework.Communications.Cache; | 38 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Framework.Capabilities; | 39 | using OpenSim.Framework.Capabilities; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Services.Interfaces; | ||
42 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
41 | 43 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | 44 | namespace 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 |