diff options
author | root | 2011-06-30 00:26:03 +0100 |
---|---|---|
committer | root | 2011-06-30 00:26:03 +0100 |
commit | 5f927dc104aac48707c0ea2ff77a3410c3857ecc (patch) | |
tree | 123324ae910db49349e7b07749f49cd172a3d037 /OpenSim/Region/CoreModules/Framework | |
parent | Remove friends debug spam (diff) | |
parent | Don't follow inventory links of links. (diff) | |
download | opensim-SC-5f927dc104aac48707c0ea2ff77a3410c3857ecc.zip opensim-SC-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.gz opensim-SC-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.bz2 opensim-SC-5f927dc104aac48707c0ea2ff77a3410c3857ecc.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
3 files changed, 49 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 02efcd8..a00e240 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -50,6 +50,11 @@ 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 | /// <summary> | ||
54 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. | ||
55 | /// </summary> | ||
56 | public int MaxTransferDistance { get; set; } | ||
57 | |||
53 | protected bool m_Enabled = false; | 58 | protected bool m_Enabled = false; |
54 | protected Scene m_aScene; | 59 | protected Scene m_aScene; |
55 | protected List<Scene> m_Scenes = new List<Scene>(); | 60 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -78,13 +83,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
78 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 83 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
79 | if (name == Name) | 84 | if (name == Name) |
80 | { | 85 | { |
81 | m_agentsInTransit = new List<UUID>(); | 86 | InitialiseCommon(source); |
82 | m_Enabled = true; | 87 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
83 | m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
84 | } | 88 | } |
85 | } | 89 | } |
86 | } | 90 | } |
87 | 91 | ||
92 | /// <summary> | ||
93 | /// Initialize config common for this module and any descendents. | ||
94 | /// </summary> | ||
95 | /// <param name="source"></param> | ||
96 | protected virtual void InitialiseCommon(IConfigSource source) | ||
97 | { | ||
98 | IConfig transferConfig = source.Configs["EntityTransfer"]; | ||
99 | if (transferConfig != null) | ||
100 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | ||
101 | |||
102 | m_agentsInTransit = new List<UUID>(); | ||
103 | m_Enabled = true; | ||
104 | } | ||
105 | |||
88 | public virtual void PostInitialise() | 106 | public virtual void PostInitialise() |
89 | { | 107 | { |
90 | } | 108 | } |
@@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
114 | return; | 132 | return; |
115 | } | 133 | } |
116 | 134 | ||
117 | |||
118 | public virtual void RemoveRegion(Scene scene) | 135 | public virtual void RemoveRegion(Scene scene) |
119 | { | 136 | { |
120 | if (!m_Enabled) | 137 | if (!m_Enabled) |
@@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
129 | { | 146 | { |
130 | if (!m_Enabled) | 147 | if (!m_Enabled) |
131 | return; | 148 | return; |
132 | |||
133 | } | 149 | } |
134 | 150 | ||
135 | #endregion | 151 | #endregion |
@@ -205,8 +221,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
205 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 221 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); |
206 | return; | 222 | return; |
207 | } | 223 | } |
208 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", | 224 | |
209 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); | 225 | uint curX = 0, curY = 0; |
226 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | ||
227 | int curCellX = (int)(curX / Constants.RegionSize); | ||
228 | int curCellY = (int)(curY / Constants.RegionSize); | ||
229 | int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize); | ||
230 | int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize); | ||
231 | |||
232 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); | ||
233 | // | ||
234 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", | ||
235 | // destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); | ||
210 | 236 | ||
211 | // Check that these are not the same coordinates | 237 | // Check that these are not the same coordinates |
212 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | 238 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && |
@@ -217,6 +243,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
217 | return; | 243 | return; |
218 | } | 244 | } |
219 | 245 | ||
246 | if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance) | ||
247 | { | ||
248 | sp.ControllingClient.SendTeleportFailed( | ||
249 | string.Format( | ||
250 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
251 | finalDestination.RegionName, destCellX, destCellY, | ||
252 | sp.Scene.RegionInfo.RegionName, curCellX, curCellY, | ||
253 | MaxTransferDistance)); | ||
254 | |||
255 | return; | ||
256 | } | ||
257 | |||
220 | // | 258 | // |
221 | // This is it | 259 | // This is it |
222 | // | 260 | // |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8858ad5..6daae62 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
67 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 67 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
68 | if (name == Name) | 68 | if (name == Name) |
69 | { | 69 | { |
70 | m_agentsInTransit = new List<UUID>(); | 70 | InitialiseCommon(source); |
71 | 71 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | |
72 | m_Enabled = true; | ||
73 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
74 | } | 72 | } |
75 | } | 73 | } |
76 | } | 74 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index cfd8ffb..27eb178 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
297 | if (m_UserCache.ContainsKey(id)) | 297 | if (m_UserCache.ContainsKey(id)) |
298 | return; | 298 | return; |
299 | 299 | ||
300 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); | ||
301 | |||
300 | UserData user = new UserData(); | 302 | UserData user = new UserData(); |
301 | user.Id = id; | 303 | user.Id = id; |
302 | |||
303 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); | 304 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); |
304 | 305 | ||
305 | if (account != null) | 306 | if (account != null) |