diff options
author | BlueWall | 2011-03-21 22:06:43 -0400 |
---|---|---|
committer | BlueWall | 2011-03-21 22:06:43 -0400 |
commit | e3c327a305dcf795f372b940f34538a19bf92218 (patch) | |
tree | b034355a12c4d87410809aa19bf6015e611e1e22 /OpenSim/Region/CoreModules/Framework | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Thanks Kevin Cozens for a patch that: (diff) | |
download | opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.zip opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.gz opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.bz2 opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.xz |
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
3 files changed, 47 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1337143..c88be7d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | 286 | ||
287 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero)) | 287 | string reason; |
288 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) | ||
288 | { | 289 | { |
289 | sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); | 290 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); |
290 | return; | 291 | return; |
291 | } | 292 | } |
292 | 293 | ||
@@ -317,14 +318,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
317 | agentCircuit.Id0 = currentAgentCircuit.Id0; | 318 | agentCircuit.Id0 = currentAgentCircuit.Id0; |
318 | } | 319 | } |
319 | 320 | ||
320 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 321 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
321 | { | 322 | { |
322 | // brand new agent, let's create a new caps seed | 323 | // brand new agent, let's create a new caps seed |
323 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 324 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
324 | } | 325 | } |
325 | 326 | ||
326 | string reason = String.Empty; | ||
327 | |||
328 | // Let's create an agent there if one doesn't exist yet. | 327 | // Let's create an agent there if one doesn't exist yet. |
329 | bool logout = false; | 328 | bool logout = false; |
330 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 329 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
@@ -337,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
337 | // OK, it got this agent. Let's close some child agents | 336 | // OK, it got this agent. Let's close some child agents |
338 | sp.CloseChildAgents(newRegionX, newRegionY); | 337 | sp.CloseChildAgents(newRegionX, newRegionY); |
339 | IClientIPEndpoint ipepClient; | 338 | IClientIPEndpoint ipepClient; |
340 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 339 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
341 | { | 340 | { |
342 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 341 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
343 | #region IP Translation for NAT | 342 | #region IP Translation for NAT |
@@ -400,6 +399,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
400 | if (!UpdateAgent(reg, finalDestination, agent)) | 399 | if (!UpdateAgent(reg, finalDestination, agent)) |
401 | { | 400 | { |
402 | // Region doesn't take it | 401 | // Region doesn't take it |
402 | m_log.WarnFormat( | ||
403 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", | ||
404 | sp.Name, finalDestination.RegionName); | ||
405 | |||
403 | Fail(sp, finalDestination); | 406 | Fail(sp, finalDestination); |
404 | return; | 407 | return; |
405 | } | 408 | } |
@@ -426,16 +429,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
426 | // that the client contacted the destination before we send the attachments and close things here. | 429 | // that the client contacted the destination before we send the attachments and close things here. |
427 | if (!WaitForCallback(sp.UUID)) | 430 | if (!WaitForCallback(sp.UUID)) |
428 | { | 431 | { |
429 | Fail(sp, finalDestination); | 432 | m_log.WarnFormat( |
433 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", | ||
434 | sp.Name, finalDestination.RegionName); | ||
435 | |||
436 | Fail(sp, finalDestination); | ||
430 | return; | 437 | return; |
431 | } | 438 | } |
432 | 439 | ||
433 | |||
434 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | 440 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it |
435 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | 441 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); |
436 | 442 | ||
437 | // Well, this is it. The agent is over there. | 443 | // Well, this is it. The agent is over there. |
438 | |||
439 | KillEntity(sp.Scene, sp.LocalId); | 444 | KillEntity(sp.Scene, sp.LocalId); |
440 | 445 | ||
441 | // May need to logout or other cleanup | 446 | // May need to logout or other cleanup |
@@ -448,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
448 | 453 | ||
449 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 454 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
450 | 455 | ||
451 | if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 456 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
452 | { | 457 | { |
453 | Thread.Sleep(5000); | 458 | Thread.Sleep(5000); |
454 | sp.Close(); | 459 | sp.Close(); |
@@ -522,14 +527,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
522 | return region; | 527 | return region; |
523 | } | 528 | } |
524 | 529 | ||
525 | protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 530 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
526 | { | 531 | { |
527 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 532 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
528 | } | 533 | } |
529 | 534 | ||
530 | protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 535 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
531 | { | 536 | { |
532 | return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); | 537 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); |
533 | } | 538 | } |
534 | 539 | ||
535 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) | 540 | protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) |
@@ -778,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
778 | 783 | ||
779 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 784 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
780 | 785 | ||
781 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos)) | 786 | string reason; |
787 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) | ||
782 | { | 788 | { |
783 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | 789 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); |
784 | if (r == null) | 790 | if (r == null) |
@@ -1045,7 +1051,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1045 | 1051 | ||
1046 | if (m_regionInfo != null) | 1052 | if (m_regionInfo != null) |
1047 | { | 1053 | { |
1048 | neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 1054 | neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
1049 | } | 1055 | } |
1050 | else | 1056 | else |
1051 | { | 1057 | { |
@@ -1272,8 +1278,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1272 | /// <param name="pRegionLocX"></param> | 1278 | /// <param name="pRegionLocX"></param> |
1273 | /// <param name="pRegionLocY"></param> | 1279 | /// <param name="pRegionLocY"></param> |
1274 | /// <returns></returns> | 1280 | /// <returns></returns> |
1275 | protected List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) | 1281 | protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
1276 | { | 1282 | { |
1283 | Scene pScene = avatar.Scene; | ||
1277 | RegionInfo m_regionInfo = pScene.RegionInfo; | 1284 | RegionInfo m_regionInfo = pScene.RegionInfo; |
1278 | 1285 | ||
1279 | Border[] northBorders = pScene.NorthBorders.ToArray(); | 1286 | Border[] northBorders = pScene.NorthBorders.ToArray(); |
@@ -1281,10 +1288,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1281 | Border[] eastBorders = pScene.EastBorders.ToArray(); | 1288 | Border[] eastBorders = pScene.EastBorders.ToArray(); |
1282 | Border[] westBorders = pScene.WestBorders.ToArray(); | 1289 | Border[] westBorders = pScene.WestBorders.ToArray(); |
1283 | 1290 | ||
1284 | // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. | 1291 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't |
1292 | // clear what should be done with a "far view" given that megaregions already extended the | ||
1293 | // view to include everything in the megaregion | ||
1285 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | 1294 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) |
1286 | { | 1295 | { |
1287 | return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | 1296 | int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; |
1297 | |||
1298 | int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1299 | int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); | ||
1300 | |||
1301 | int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1302 | int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); | ||
1303 | |||
1304 | List<GridRegion> neighbours = | ||
1305 | avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); | ||
1306 | |||
1307 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | ||
1308 | return neighbours; | ||
1288 | } | 1309 | } |
1289 | else | 1310 | else |
1290 | { | 1311 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 35dcd95..79e76b4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
130 | return region; | 130 | return region; |
131 | } | 131 | } |
132 | 132 | ||
133 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 133 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
134 | { | 134 | { |
135 | if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 135 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
136 | return true; | 136 | return true; |
137 | 137 | ||
138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 138 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7bb8789..798547a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -148,6 +148,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
148 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 148 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
149 | item = m_Scene.InventoryService.GetItem(item); | 149 | item = m_Scene.InventoryService.GetItem(item); |
150 | 150 | ||
151 | if (item.Owner != remoteClient.AgentId) | ||
152 | return UUID.Zero; | ||
153 | |||
151 | if (item != null) | 154 | if (item != null) |
152 | { | 155 | { |
153 | if ((InventoryType)item.InvType == InventoryType.Notecard) | 156 | if ((InventoryType)item.InvType == InventoryType.Notecard) |
@@ -524,6 +527,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
524 | 527 | ||
525 | if (item != null) | 528 | if (item != null) |
526 | { | 529 | { |
530 | item.Owner = remoteClient.AgentId; | ||
531 | |||
527 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 532 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
528 | 533 | ||
529 | if (rezAsset != null) | 534 | if (rezAsset != null) |