diff options
author | Melanie | 2013-06-02 23:53:20 +0200 |
---|---|---|
committer | Melanie | 2013-06-02 23:53:20 +0200 |
commit | 57c8d82c9e3d55581982a75a02d1f54bc547fb50 (patch) | |
tree | 7c12399b7b32a79eaa7db32dacc681c7f77b997d | |
parent | Unsit seated avatars when an object is deleted (diff) | |
download | opensim-SC_OLD-57c8d82c9e3d55581982a75a02d1f54bc547fb50.zip opensim-SC_OLD-57c8d82c9e3d55581982a75a02d1f54bc547fb50.tar.gz opensim-SC_OLD-57c8d82c9e3d55581982a75a02d1f54bc547fb50.tar.bz2 opensim-SC_OLD-57c8d82c9e3d55581982a75a02d1f54bc547fb50.tar.xz |
Fix llTeleportAgentGlobalCoords
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5af2a8d..5ea14c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4679,24 +4679,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4679 | m_host.AddScriptLPS(1); | 4679 | m_host.AddScriptLPS(1); |
4680 | UUID agentId = new UUID(); | 4680 | UUID agentId = new UUID(); |
4681 | 4681 | ||
4682 | ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); | 4682 | ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256); |
4683 | 4683 | ||
4684 | if (UUID.TryParse(agent, out agentId)) | 4684 | if (UUID.TryParse(agent, out agentId)) |
4685 | { | 4685 | { |
4686 | // This function is owner only! | ||
4687 | if (m_host.OwnerID != agentId) | ||
4688 | return; | ||
4689 | |||
4686 | ScenePresence presence = World.GetScenePresence(agentId); | 4690 | ScenePresence presence = World.GetScenePresence(agentId); |
4691 | |||
4692 | // Can't TP sitting avatars | ||
4693 | if (presence.ParentID != 0) // Sitting | ||
4694 | return; | ||
4695 | |||
4687 | if (presence != null && presence.PresenceType != PresenceType.Npc) | 4696 | if (presence != null && presence.PresenceType != PresenceType.Npc) |
4688 | { | 4697 | { |
4689 | // agent must not be a god | 4698 | if (m_item.PermsGranter == agentId) |
4690 | if (presence.GodLevel >= 200) return; | ||
4691 | |||
4692 | // agent must be over the owners land | ||
4693 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) | ||
4694 | { | ||
4695 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | ||
4696 | } | ||
4697 | else // or must be wearing the prim | ||
4698 | { | 4699 | { |
4699 | if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) | 4700 | // If attached using llAttachToAvatarTemp, cowardly refuse |
4701 | if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero) | ||
4702 | return; | ||
4703 | |||
4704 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) | ||
4700 | { | 4705 | { |
4701 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | 4706 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4702 | } | 4707 | } |