diff options
author | Justin Clark-Casey (justincc) | 2013-03-14 22:22:10 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-14 22:22:10 +0000 |
commit | 3c9bea1e3fbe0bb457bcc227d0420125c00ce832 (patch) | |
tree | 94a39e1ac159431f9195b53872812213cbba00ce /OpenSim/Region/ScriptEngine | |
parent | refactor: Use LSL_Vector(Vector3) constructor in llGetCenterOfMass() (diff) | |
download | opensim-SC_OLD-3c9bea1e3fbe0bb457bcc227d0420125c00ce832.zip opensim-SC_OLD-3c9bea1e3fbe0bb457bcc227d0420125c00ce832.tar.gz opensim-SC_OLD-3c9bea1e3fbe0bb457bcc227d0420125c00ce832.tar.bz2 opensim-SC_OLD-3c9bea1e3fbe0bb457bcc227d0420125c00ce832.tar.xz |
Fix minor race conditions in llTeleportAgent(), llTeleportAgentGlobalCoords(), llEjectFromLand() and llOverMyLand() where the wrong parcel could be identified for very fast moving avatars.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aca0132..8415feb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4202,9 +4202,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4202 | if (destination == String.Empty) | 4202 | if (destination == String.Empty) |
4203 | destination = World.RegionInfo.RegionName; | 4203 | destination = World.RegionInfo.RegionName; |
4204 | 4204 | ||
4205 | Vector3 pos = presence.AbsolutePosition; | ||
4206 | |||
4205 | // agent must be over the owners land | 4207 | // agent must be over the owners land |
4206 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4208 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
4207 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4208 | { | 4209 | { |
4209 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | 4210 | DoLLTeleport(presence, destination, targetPos, targetLookAt); |
4210 | } | 4211 | } |
@@ -4234,9 +4235,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4234 | // agent must not be a god | 4235 | // agent must not be a god |
4235 | if (presence.GodLevel >= 200) return; | 4236 | if (presence.GodLevel >= 200) return; |
4236 | 4237 | ||
4238 | Vector3 pos = presence.AbsolutePosition; | ||
4239 | |||
4237 | // agent must be over the owners land | 4240 | // agent must be over the owners land |
4238 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4241 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
4239 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4240 | { | 4242 | { |
4241 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | 4243 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4242 | } | 4244 | } |
@@ -5865,8 +5867,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5865 | ScenePresence presence = World.GetScenePresence(agentID); | 5867 | ScenePresence presence = World.GetScenePresence(agentID); |
5866 | if (presence != null) | 5868 | if (presence != null) |
5867 | { | 5869 | { |
5870 | Vector3 pos = presence.AbsolutePosition; | ||
5871 | |||
5868 | // agent must be over the owners land | 5872 | // agent must be over the owners land |
5869 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | 5873 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); |
5870 | if (land == null) | 5874 | if (land == null) |
5871 | return; | 5875 | return; |
5872 | 5876 | ||
@@ -5888,19 +5892,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5888 | ScenePresence presence = World.GetScenePresence(key); | 5892 | ScenePresence presence = World.GetScenePresence(key); |
5889 | if (presence != null) // object is an avatar | 5893 | if (presence != null) // object is an avatar |
5890 | { | 5894 | { |
5891 | if (m_host.OwnerID | 5895 | Vector3 pos = presence.AbsolutePosition; |
5892 | == World.LandChannel.GetLandObject( | 5896 | |
5893 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 5897 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) |
5894 | return 1; | 5898 | return 1; |
5895 | } | 5899 | } |
5896 | else // object is not an avatar | 5900 | else // object is not an avatar |
5897 | { | 5901 | { |
5898 | SceneObjectPart obj = World.GetSceneObjectPart(key); | 5902 | SceneObjectPart obj = World.GetSceneObjectPart(key); |
5903 | |||
5899 | if (obj != null) | 5904 | if (obj != null) |
5900 | if (m_host.OwnerID | 5905 | { |
5901 | == World.LandChannel.GetLandObject( | 5906 | Vector3 pos = obj.AbsolutePosition; |
5902 | obj.AbsolutePosition.X, obj.AbsolutePosition.Y).LandData.OwnerID) | 5907 | |
5908 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
5903 | return 1; | 5909 | return 1; |
5910 | } | ||
5904 | } | 5911 | } |
5905 | } | 5912 | } |
5906 | 5913 | ||
@@ -5979,7 +5986,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5979 | // or | 5986 | // or |
5980 | // if the object is owned by a person with estate access. | 5987 | // if the object is owned by a person with estate access. |
5981 | 5988 | ||
5982 | ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); | 5989 | Vector3 pos = av.AbsolutePosition; |
5990 | |||
5991 | ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
5983 | if (parcel != null) | 5992 | if (parcel != null) |
5984 | { | 5993 | { |
5985 | if (m_host.OwnerID == parcel.LandData.OwnerID || | 5994 | if (m_host.OwnerID == parcel.LandData.OwnerID || |
@@ -5991,9 +6000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5991 | } | 6000 | } |
5992 | } | 6001 | } |
5993 | } | 6002 | } |
5994 | |||
5995 | } | 6003 | } |
5996 | |||
5997 | } | 6004 | } |
5998 | 6005 | ||
5999 | public LSL_Vector llGroundSlope(LSL_Vector offset) | 6006 | public LSL_Vector llGroundSlope(LSL_Vector offset) |