diff options
author | UbitUmarov | 2017-06-26 02:49:20 +0100 |
---|---|---|
committer | UbitUmarov | 2017-06-26 02:49:20 +0100 |
commit | 0c5f412ed40663689aad2aadf9313e0dd782f4ac (patch) | |
tree | 9346abf7dd5ce1e737217ea17dfd4fa7056ea3dd /OpenSim | |
parent | some shortcuts on local osTeleport, reduce its time penalty, do it with scrip... (diff) | |
download | opensim-SC_OLD-0c5f412ed40663689aad2aadf9313e0dd782f4ac.zip opensim-SC_OLD-0c5f412ed40663689aad2aadf9313e0dd782f4ac.tar.gz opensim-SC_OLD-0c5f412ed40663689aad2aadf9313e0dd782f4ac.tar.bz2 opensim-SC_OLD-0c5f412ed40663689aad2aadf9313e0dd782f4ac.tar.xz |
put back restriction that on osTeleport the target must be on land owned by the script owner or this is a estate manager/owner, or target did gave script permission.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 93 |
1 files changed, 78 insertions, 15 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5339fc3..ce48e63 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -852,6 +852,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
852 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); | 852 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); |
853 | } | 853 | } |
854 | 854 | ||
855 | private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos) | ||
856 | { | ||
857 | if (m_item.PermsGranter == agentId) | ||
858 | { | ||
859 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) | ||
860 | return true; | ||
861 | } | ||
862 | |||
863 | ILandObject land = World.LandChannel.GetLandObject(pos); | ||
864 | if(land == null) | ||
865 | return true; | ||
866 | |||
867 | LandData landdata = land.LandData; | ||
868 | if(landdata == null) | ||
869 | return true; | ||
870 | |||
871 | UUID hostOwner = m_host.OwnerID; | ||
872 | |||
873 | if(landdata.OwnerID == hostOwner) | ||
874 | return true; | ||
875 | |||
876 | if(World.RegionInfo.EstateSettings != null && World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(hostOwner)) | ||
877 | return true; | ||
878 | |||
879 | if(!landdata.IsGroupOwned) | ||
880 | return false; | ||
881 | |||
882 | UUID landGroup = landdata.GroupID; | ||
883 | if(landGroup == UUID.Zero) | ||
884 | return false; | ||
885 | |||
886 | if(landGroup == m_host.GroupID) | ||
887 | return true; | ||
888 | |||
889 | return false; | ||
890 | } | ||
891 | |||
855 | // Teleport functions | 892 | // Teleport functions |
856 | public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 893 | public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
857 | { | 894 | { |
@@ -859,15 +896,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
859 | // | 896 | // |
860 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); | 897 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
861 | 898 | ||
862 | TeleportAgent(agent, regionName, position, lookat); | 899 | TeleportAgent(agent, regionName, position, lookat, true); |
863 | } | 900 | } |
864 | 901 | ||
865 | private void TeleportAgent(string agent, string regionName, | 902 | private void TeleportAgent(string agent, string regionName, |
866 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 903 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner) |
867 | { | 904 | { |
868 | m_host.AddScriptLPS(1); | 905 | m_host.AddScriptLPS(1); |
869 | if(String.IsNullOrWhiteSpace(regionName)) | 906 | if(String.IsNullOrEmpty(regionName)) |
870 | return; | 907 | regionName = World.RegionInfo.RegionName; |
871 | 908 | ||
872 | UUID agentId; | 909 | UUID agentId; |
873 | if (UUID.TryParse(agent, out agentId)) | 910 | if (UUID.TryParse(agent, out agentId)) |
@@ -876,6 +913,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
876 | if (presence == null || presence.IsDeleted || presence.IsInTransit) | 913 | if (presence == null || presence.IsDeleted || presence.IsInTransit) |
877 | return; | 914 | return; |
878 | 915 | ||
916 | Vector3 pos = presence.AbsolutePosition; | ||
917 | if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
918 | { | ||
919 | ScriptSleep(500); | ||
920 | return; | ||
921 | } | ||
922 | |||
879 | if(regionName == World.RegionInfo.RegionName) | 923 | if(regionName == World.RegionInfo.RegionName) |
880 | { | 924 | { |
881 | // should be faster than going to threadpool | 925 | // should be faster than going to threadpool |
@@ -903,15 +947,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
903 | // | 947 | // |
904 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); | 948 | CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); |
905 | 949 | ||
906 | TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false); | 950 | TeleportAgent(agent, regionGridX, regionGridY, position, lookat, true); |
907 | } | 951 | } |
908 | 952 | ||
909 | private void TeleportAgent(string agent, int regionGridX, int regionGridY, | 953 | private void TeleportAgent(string agent, int regionGridX, int regionGridY, |
910 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | 954 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner) |
911 | { | 955 | { |
956 | m_host.AddScriptLPS(1); | ||
957 | |||
912 | ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); | 958 | ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); |
913 | 959 | ||
914 | m_host.AddScriptLPS(1); | ||
915 | UUID agentId; | 960 | UUID agentId; |
916 | if (UUID.TryParse(agent, out agentId)) | 961 | if (UUID.TryParse(agent, out agentId)) |
917 | { | 962 | { |
@@ -919,6 +964,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
919 | if (presence == null || presence.IsDeleted || presence.IsInTransit) | 964 | if (presence == null || presence.IsDeleted || presence.IsInTransit) |
920 | return; | 965 | return; |
921 | 966 | ||
967 | Vector3 pos = presence.AbsolutePosition; | ||
968 | if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
969 | { | ||
970 | ScriptSleep(500); | ||
971 | return; | ||
972 | } | ||
973 | |||
922 | Util.FireAndForget( | 974 | Util.FireAndForget( |
923 | o => World.RequestTeleportLocation( | 975 | o => World.RequestTeleportLocation( |
924 | presence.ControllingClient, regionHandle, | 976 | presence.ControllingClient, regionHandle, |
@@ -931,8 +983,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
931 | 983 | ||
932 | public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 984 | public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
933 | { | 985 | { |
934 | m_host.AddScriptLPS(1); | 986 | TeleportAgent(agent, position, lookat, true); |
987 | } | ||
935 | 988 | ||
989 | private void TeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner) | ||
990 | { | ||
991 | m_host.AddScriptLPS(1); | ||
936 | UUID agentId; | 992 | UUID agentId; |
937 | if (UUID.TryParse(agent, out agentId)) | 993 | if (UUID.TryParse(agent, out agentId)) |
938 | { | 994 | { |
@@ -940,6 +996,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
940 | if (presence == null || presence.IsDeleted || presence.IsInTransit) | 996 | if (presence == null || presence.IsDeleted || presence.IsInTransit) |
941 | return; | 997 | return; |
942 | 998 | ||
999 | Vector3 pos = presence.AbsolutePosition; | ||
1000 | if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) | ||
1001 | { | ||
1002 | ScriptSleep(500); | ||
1003 | return; | ||
1004 | } | ||
1005 | |||
943 | World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position, | 1006 | World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position, |
944 | lookat, (uint)TPFlags.ViaLocation); | 1007 | lookat, (uint)TPFlags.ViaLocation); |
945 | ScriptSleep(500); | 1008 | ScriptSleep(500); |
@@ -951,19 +1014,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
951 | // Threat level None because this is what can already be done with the World Map in the viewer | 1014 | // Threat level None because this is what can already be done with the World Map in the viewer |
952 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 1015 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
953 | 1016 | ||
954 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); | 1017 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, false); |
955 | } | ||
956 | |||
957 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | ||
958 | { | ||
959 | osTeleportAgent(m_host.OwnerID.ToString(), position, lookat); | ||
960 | } | 1018 | } |
961 | 1019 | ||
962 | public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 1020 | public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
963 | { | 1021 | { |
964 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 1022 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
965 | 1023 | ||
966 | TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, true); | 1024 | TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, false); |
1025 | } | ||
1026 | |||
1027 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | ||
1028 | { | ||
1029 | TeleportAgent(m_host.OwnerID.ToString(), position, lookat, false); | ||
967 | } | 1030 | } |
968 | 1031 | ||
969 | ///<summary> | 1032 | ///<summary> |