diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 150 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 12 |
2 files changed, 53 insertions, 109 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f1399af..9a6dfe1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -681,11 +681,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
681 | 681 | ||
682 | #region Agent Crossings | 682 | #region Agent Crossings |
683 | 683 | ||
684 | public bool Cross(ScenePresence agent, bool isFlying) | 684 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) |
685 | { | 685 | { |
686 | Scene scene = agent.Scene; | 686 | version = String.Empty; |
687 | Vector3 pos = agent.AbsolutePosition; | 687 | newpos = new Vector3(pos.X, pos.Y, pos.Z); |
688 | Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z); | ||
689 | uint neighbourx = scene.RegionInfo.RegionLocX; | 688 | uint neighbourx = scene.RegionInfo.RegionLocX; |
690 | uint neighboury = scene.RegionInfo.RegionLocY; | 689 | uint neighboury = scene.RegionInfo.RegionLocY; |
691 | const float boundaryDistance = 1.7f; | 690 | const float boundaryDistance = 1.7f; |
@@ -706,53 +705,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
706 | } | 705 | } |
707 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 706 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
708 | { | 707 | { |
709 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | 708 | neighboury--; |
710 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) | 709 | newpos.Y = Constants.RegionSize - enterDistance; |
711 | { | ||
712 | neighboury--; | ||
713 | newpos.Y = Constants.RegionSize - enterDistance; | ||
714 | } | ||
715 | else | ||
716 | { | ||
717 | agent.IsInTransit = true; | ||
718 | |||
719 | neighboury = b.TriggerRegionY; | ||
720 | neighbourx = b.TriggerRegionX; | ||
721 | |||
722 | Vector3 newposition = pos; | ||
723 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
724 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
725 | agent.ControllingClient.SendAgentAlertMessage( | ||
726 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
727 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
728 | return true; | ||
729 | } | ||
730 | } | ||
731 | |||
732 | Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W); | ||
733 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) | ||
734 | { | ||
735 | neighbourx--; | ||
736 | newpos.X = Constants.RegionSize - enterDistance; | ||
737 | } | 710 | } |
738 | else | ||
739 | { | ||
740 | agent.IsInTransit = true; | ||
741 | |||
742 | neighboury = ba.TriggerRegionY; | ||
743 | neighbourx = ba.TriggerRegionX; | ||
744 | |||
745 | |||
746 | Vector3 newposition = pos; | ||
747 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
748 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
749 | agent.ControllingClient.SendAgentAlertMessage( | ||
750 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
751 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
752 | 711 | ||
753 | 712 | neighbourx--; | |
754 | return true; | 713 | newpos.X = Constants.RegionSize - enterDistance; |
755 | } | ||
756 | 714 | ||
757 | } | 715 | } |
758 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) | 716 | else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) |
@@ -763,26 +721,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
763 | 721 | ||
764 | if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 722 | if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
765 | { | 723 | { |
766 | Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | 724 | neighboury--; |
767 | if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) | 725 | newpos.Y = Constants.RegionSize - enterDistance; |
768 | { | ||
769 | neighboury--; | ||
770 | newpos.Y = Constants.RegionSize - enterDistance; | ||
771 | } | ||
772 | else | ||
773 | { | ||
774 | agent.IsInTransit = true; | ||
775 | |||
776 | neighboury = ba.TriggerRegionY; | ||
777 | neighbourx = ba.TriggerRegionX; | ||
778 | Vector3 newposition = pos; | ||
779 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
780 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
781 | agent.ControllingClient.SendAgentAlertMessage( | ||
782 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
783 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
784 | return true; | ||
785 | } | ||
786 | } | 726 | } |
787 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | 727 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) |
788 | { | 728 | { |
@@ -790,35 +730,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
790 | neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); | 730 | neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); |
791 | newpos.Y = enterDistance; | 731 | newpos.Y = enterDistance; |
792 | } | 732 | } |
793 | |||
794 | |||
795 | } | 733 | } |
796 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) | 734 | else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) |
797 | { | 735 | { |
798 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); | 736 | Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); |
799 | if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) | 737 | neighboury--; |
800 | { | 738 | newpos.Y = Constants.RegionSize - enterDistance; |
801 | neighboury--; | ||
802 | newpos.Y = Constants.RegionSize - enterDistance; | ||
803 | } | ||
804 | else | ||
805 | { | ||
806 | agent.IsInTransit = true; | ||
807 | |||
808 | neighboury = b.TriggerRegionY; | ||
809 | neighbourx = b.TriggerRegionX; | ||
810 | Vector3 newposition = pos; | ||
811 | newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; | ||
812 | newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; | ||
813 | agent.ControllingClient.SendAgentAlertMessage( | ||
814 | String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); | ||
815 | InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); | ||
816 | return true; | ||
817 | } | ||
818 | } | 739 | } |
819 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) | 740 | else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) |
820 | { | 741 | { |
821 | |||
822 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); | 742 | Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); |
823 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); | 743 | neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); |
824 | newpos.Y = enterDistance; | 744 | newpos.Y = enterDistance; |
@@ -849,19 +769,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
849 | } | 769 | } |
850 | */ | 770 | */ |
851 | 771 | ||
852 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 772 | xDest = neighbourx; |
773 | yDest = neighboury; | ||
853 | 774 | ||
854 | int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); | 775 | int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); |
855 | 776 | ||
777 | ulong neighbourHandle = Utils.UIntsToLong((uint)x, (uint)y); | ||
778 | |||
856 | ExpiringCache<ulong, DateTime> r; | 779 | ExpiringCache<ulong, DateTime> r; |
857 | DateTime banUntil; | 780 | DateTime banUntil; |
858 | 781 | ||
859 | if (m_bannedRegions.TryGetValue(agent.ControllingClient.AgentId, out r)) | 782 | if (m_bannedRegions.TryGetValue(agentID, out r)) |
860 | { | 783 | { |
861 | if (r.TryGetValue(neighbourHandle, out banUntil)) | 784 | if (r.TryGetValue(neighbourHandle, out banUntil)) |
862 | { | 785 | { |
863 | if (DateTime.Now < banUntil) | 786 | if (DateTime.Now < banUntil) |
864 | return false; | 787 | return null; |
865 | r.Remove(neighbourHandle); | 788 | r.Remove(neighbourHandle); |
866 | } | 789 | } |
867 | } | 790 | } |
@@ -873,28 +796,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
873 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 796 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
874 | 797 | ||
875 | string reason; | 798 | string reason; |
876 | string version; | 799 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) |
877 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason)) | ||
878 | { | 800 | { |
879 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | ||
880 | if (r == null) | 801 | if (r == null) |
881 | { | 802 | { |
882 | r = new ExpiringCache<ulong, DateTime>(); | 803 | r = new ExpiringCache<ulong, DateTime>(); |
883 | r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); | 804 | r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); |
884 | 805 | ||
885 | m_bannedRegions.Add(agent.ControllingClient.AgentId, r, TimeSpan.FromSeconds(45)); | 806 | m_bannedRegions.Add(agentID, r, TimeSpan.FromSeconds(45)); |
886 | } | 807 | } |
887 | else | 808 | else |
888 | { | 809 | { |
889 | r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); | 810 | r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); |
890 | } | 811 | } |
812 | return null; | ||
813 | } | ||
814 | |||
815 | return neighbourRegion; | ||
816 | } | ||
817 | |||
818 | public bool Cross(ScenePresence agent, bool isFlying) | ||
819 | { | ||
820 | uint x; | ||
821 | uint y; | ||
822 | Vector3 newpos; | ||
823 | string version; | ||
824 | |||
825 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); | ||
826 | if (neighbourRegion == null) | ||
827 | { | ||
828 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | ||
891 | return false; | 829 | return false; |
892 | } | 830 | } |
893 | 831 | ||
894 | agent.IsInTransit = true; | 832 | agent.IsInTransit = true; |
895 | 833 | ||
896 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | 834 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; |
897 | d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); | 835 | d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); |
898 | 836 | ||
899 | return true; | 837 | return true; |
900 | } | 838 | } |
@@ -951,13 +889,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
951 | icon.EndInvoke(iar); | 889 | icon.EndInvoke(iar); |
952 | } | 890 | } |
953 | 891 | ||
954 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); | ||
955 | |||
956 | /// <summary> | 892 | /// <summary> |
957 | /// This Closes child agents on neighbouring regions | 893 | /// This Closes child agents on neighbouring regions |
958 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 894 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
959 | /// </summary> | 895 | /// </summary> |
960 | protected ScenePresence CrossAgentToNewRegionAsync( | 896 | public ScenePresence CrossAgentToNewRegionAsync( |
961 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 897 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, |
962 | bool isFlying, string version) | 898 | bool isFlying, string version) |
963 | { | 899 | { |
@@ -1731,17 +1667,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1731 | { | 1667 | { |
1732 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); | 1668 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); |
1733 | 1669 | ||
1670 | // Need to turn off the physics flags, otherwise the object will continue to attempt to | ||
1671 | // move out of the region creating an infinite loop of failed attempts to cross | ||
1672 | grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); | ||
1673 | |||
1734 | // We are going to move the object back to the old position so long as the old position | 1674 | // We are going to move the object back to the old position so long as the old position |
1735 | // is in the region | 1675 | // is in the region |
1736 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); | 1676 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); |
1737 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); | 1677 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); |
1738 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f); | 1678 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f); |
1739 | 1679 | ||
1740 | grp.RootPart.GroupPosition = oldGroupPosition; | 1680 | grp.AbsolutePosition = oldGroupPosition; |
1741 | |||
1742 | // Need to turn off the physics flags, otherwise the object will continue to attempt to | ||
1743 | // move out of the region creating an infinite loop of failed attempts to cross | ||
1744 | grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); | ||
1745 | 1681 | ||
1746 | grp.ScheduleGroupForFullUpdate(); | 1682 | grp.ScheduleGroupForFullUpdate(); |
1747 | } | 1683 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a47bc9a..82a035b 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -560,12 +560,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
560 | return null; | 560 | return null; |
561 | 561 | ||
562 | userID = remoteClient.AgentId; | 562 | userID = remoteClient.AgentId; |
563 | |||
564 | // m_log.DebugFormat( | ||
565 | // "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}", | ||
566 | // action, remoteClient.Name, userID); | ||
563 | } | 567 | } |
564 | else | 568 | else |
565 | { | 569 | { |
566 | // All returns / deletes go to the object owner | 570 | // All returns / deletes go to the object owner |
567 | // | 571 | // |
568 | userID = so.RootPart.OwnerID; | 572 | userID = so.RootPart.OwnerID; |
573 | |||
574 | // m_log.DebugFormat( | ||
575 | // "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}", | ||
576 | // action, userID); | ||
569 | } | 577 | } |
570 | 578 | ||
571 | if (userID == UUID.Zero) // Can't proceed | 579 | if (userID == UUID.Zero) // Can't proceed |
@@ -651,11 +659,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
651 | } | 659 | } |
652 | 660 | ||
653 | // Override and put into where it came from, if it came | 661 | // Override and put into where it came from, if it came |
654 | // from anywhere in inventory | 662 | // from anywhere in inventory and the owner is taking it back. |
655 | // | 663 | // |
656 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 664 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
657 | { | 665 | { |
658 | if (so.RootPart.FromFolderID != UUID.Zero) | 666 | if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) |
659 | { | 667 | { |
660 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | 668 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); |
661 | if (f != null) | 669 | if (f != null) |