Fix llTeleportAgentGlobalCoords

avinationmerge
Melanie 2013-06-02 23:53:20 +02:00
parent e2d4cb870e
commit 57c8d82c9e
1 changed files with 16 additions and 11 deletions

View File

@ -4679,24 +4679,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256);
if (UUID.TryParse(agent, out agentId))
{
// This function is owner only!
if (m_host.OwnerID != agentId)
return;
ScenePresence presence = World.GetScenePresence(agentId);
// Can't TP sitting avatars
if (presence.ParentID != 0) // Sitting
return;
if (presence != null && presence.PresenceType != PresenceType.Npc)
{
// agent must not be a god
if (presence.GodLevel >= 200) return;
if (m_item.PermsGranter == agentId)
{
// If attached using llAttachToAvatarTemp, cowardly refuse
if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero)
return;
// agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
{
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}
else // or must be wearing the prim
{
if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
{
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}