From 151350467ffa3b5518f5f6250119587bd1ad3110 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 17 Sep 2021 01:55:24 +0100 Subject: [PATCH] TPs are root agents only --- .../Shared/Api/Implementation/LSL_Api.cs | 84 +++++++++---------- 1 file changed, 38 insertions(+), 46 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 51e2572e3c..2ceaa41f1a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5027,24 +5027,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); - if (presence != null && presence.PresenceType != PresenceType.Npc) - { - // agent must not be a god - if (presence.GodController.UserLevel >= 200) return; + if (presence == null || presence.IsDeleted || presence.IsChildAgent || presence.IsNPC || presence.IsInTransit) + return; - // agent must be over the owners land - if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) + // agent must not be a god + if (presence.GodController.UserLevel >= 200) return; + + // agent must be over the owners land + if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) + { + if (!World.TeleportClientHome(agentId, presence.ControllingClient)) { - if (!World.TeleportClientHome(agentId, presence.ControllingClient)) + // They can't be teleported home for some reason + GridRegion regionInfo = World.GridService.GetRegionByUUID(UUID.Zero, new UUID("2b02daac-e298-42fa-9a75-f488d37896e6")); + if (regionInfo != null) { - // They can't be teleported home for some reason - GridRegion regionInfo = World.GridService.GetRegionByUUID(UUID.Zero, new UUID("2b02daac-e298-42fa-9a75-f488d37896e6")); - if (regionInfo != null) - { - World.RequestTeleportLocation( - presence.ControllingClient, regionInfo.RegionHandle, new Vector3(128, 128, 23), Vector3.Zero, - (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); - } + World.RequestTeleportLocation( + presence.ControllingClient, regionInfo.RegionHandle, new Vector3(128, 128, 23), Vector3.Zero, + (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); } } } @@ -5060,38 +5060,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(agent, out agentId)) { ScenePresence presence = World.GetScenePresence(agentId); - if (presence != null && presence.PresenceType != PresenceType.Npc) + if (presence == null || presence.IsDeleted || presence.IsChildAgent || presence.IsNPC || presence.IsSatOnObject || presence.IsInTransit) + return; + + if (m_item.PermsGranter == agentId) { - if (presence.ParentID != 0) // Sitting - return; - - if (m_item.PermsGranter == agentId) - { - if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) - { - DoLLTeleport(presence, destination, targetPos, targetLookAt); - return; - } - } - - // agent must be wearing the object - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) { DoLLTeleport(presence, destination, targetPos, targetLookAt); return; } + } - // agent must not be a god - if (presence.IsViewerUIGod) - return; + // agent must be wearing the object + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + { + DoLLTeleport(presence, destination, targetPos, targetLookAt); + return; + } - // agent must be over the owners land - ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); - ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID) - { - DoLLTeleport(presence, destination, targetPos, targetLookAt); - } + // agent must not be a god + if (presence.IsViewerUIGod) + return; + + // agent must be over the owners land + ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); + ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition); + if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID) + { + DoLLTeleport(presence, destination, targetPos, targetLookAt); } } } @@ -5109,12 +5106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; ScenePresence presence = World.GetScenePresence(agentId); - - if (presence == null || presence.PresenceType == PresenceType.Npc) - return; - - // Can't TP sitting avatars - if (presence.ParentID != 0) // Sitting + if (presence == null || presence.IsDeleted || presence.IsChildAgent || presence.IsNPC || presence.IsSatOnObject || presence.IsInTransit) return; if (m_item.PermsGranter == agentId)