diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
4 files changed, 58 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1341533..457ee33 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -50,6 +50,17 @@ 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 | private int m_MaxTransferDistance = 4095; | ||
57 | public int MaxTransferDistance | ||
58 | { | ||
59 | get { return m_MaxTransferDistance; } | ||
60 | set { m_MaxTransferDistance = value; } | ||
61 | } | ||
62 | |||
63 | |||
53 | protected bool m_Enabled = false; | 64 | protected bool m_Enabled = false; |
54 | protected Scene m_aScene; | 65 | protected Scene m_aScene; |
55 | protected List<Scene> m_Scenes = new List<Scene>(); | 66 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -78,13 +89,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
78 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 89 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
79 | if (name == Name) | 90 | if (name == Name) |
80 | { | 91 | { |
81 | m_agentsInTransit = new List<UUID>(); | 92 | InitialiseCommon(source); |
82 | m_Enabled = true; | 93 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
83 | m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
84 | } | 94 | } |
85 | } | 95 | } |
86 | } | 96 | } |
87 | 97 | ||
98 | /// <summary> | ||
99 | /// Initialize config common for this module and any descendents. | ||
100 | /// </summary> | ||
101 | /// <param name="source"></param> | ||
102 | protected virtual void InitialiseCommon(IConfigSource source) | ||
103 | { | ||
104 | IConfig transferConfig = source.Configs["EntityTransfer"]; | ||
105 | if (transferConfig != null) | ||
106 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | ||
107 | |||
108 | m_agentsInTransit = new List<UUID>(); | ||
109 | m_Enabled = true; | ||
110 | } | ||
111 | |||
88 | public virtual void PostInitialise() | 112 | public virtual void PostInitialise() |
89 | { | 113 | { |
90 | } | 114 | } |
@@ -114,7 +138,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
114 | return; | 138 | return; |
115 | } | 139 | } |
116 | 140 | ||
117 | |||
118 | public virtual void RemoveRegion(Scene scene) | 141 | public virtual void RemoveRegion(Scene scene) |
119 | { | 142 | { |
120 | if (!m_Enabled) | 143 | if (!m_Enabled) |
@@ -129,7 +152,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
129 | { | 152 | { |
130 | if (!m_Enabled) | 153 | if (!m_Enabled) |
131 | return; | 154 | return; |
132 | |||
133 | } | 155 | } |
134 | 156 | ||
135 | #endregion | 157 | #endregion |
@@ -204,8 +226,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
204 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 226 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); |
205 | return; | 227 | return; |
206 | } | 228 | } |
207 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", | 229 | |
208 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); | 230 | uint curX = 0, curY = 0; |
231 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | ||
232 | int curCellX = (int)(curX / Constants.RegionSize); | ||
233 | int curCellY = (int)(curY / Constants.RegionSize); | ||
234 | int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize); | ||
235 | int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize); | ||
236 | |||
237 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); | ||
238 | // | ||
239 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", | ||
240 | // destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); | ||
209 | 241 | ||
210 | // Check that these are not the same coordinates | 242 | // Check that these are not the same coordinates |
211 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | 243 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && |
@@ -216,6 +248,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
216 | return; | 248 | return; |
217 | } | 249 | } |
218 | 250 | ||
251 | if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance) | ||
252 | { | ||
253 | sp.ControllingClient.SendTeleportFailed( | ||
254 | string.Format( | ||
255 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
256 | finalDestination.RegionName, destCellX, destCellY, | ||
257 | sp.Scene.RegionInfo.RegionName, curCellX, curCellY, | ||
258 | MaxTransferDistance)); | ||
259 | |||
260 | return; | ||
261 | } | ||
262 | |||
219 | // | 263 | // |
220 | // This is it | 264 | // This is it |
221 | // | 265 | // |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4d77ef4..a87279a 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/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2930303..66fbcb9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -978,7 +978,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
978 | { | 978 | { |
979 | } | 979 | } |
980 | 980 | ||
981 | public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) | 981 | public virtual bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) |
982 | { | 982 | { |
983 | InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); | 983 | InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); |
984 | if (assetRequestItem == null) | 984 | if (assetRequestItem == null) |
@@ -1057,7 +1057,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1057 | InventoryItemBase item = new InventoryItemBase(itemID, agentID); | 1057 | InventoryItemBase item = new InventoryItemBase(itemID, agentID); |
1058 | item = invService.GetItem(item); | 1058 | item = invService.GetItem(item); |
1059 | 1059 | ||
1060 | if (item.CreatorData != null && item.CreatorData != string.Empty) | 1060 | if (item != null && item.CreatorData != null && item.CreatorData != string.Empty) |
1061 | UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 1061 | UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); |
1062 | 1062 | ||
1063 | return item; | 1063 | return item; |
@@ -1065,4 +1065,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1065 | 1065 | ||
1066 | #endregion | 1066 | #endregion |
1067 | } | 1067 | } |
1068 | } | 1068 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index accd094..a4861ec 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) |