OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.llTeleportAgent C# (CSharp) Method

llTeleportAgent() public method

public llTeleportAgent ( string agent, string destination, OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3 targetPos, OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3 targetLookAt ) : void
agent string
destination string
targetPos OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3
targetLookAt OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3
return void
        public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
        {
            m_host.AddScriptLPS(1);
            UUID agentId = new UUID();

            if (UUID.TryParse(agent, out agentId))
            {
                ScenePresence presence = World.GetScenePresence(agentId);
                if (presence != null && presence.PresenceType != PresenceType.Npc)
                {
                    if (destination == String.Empty)
                        destination = World.RegionInfo.RegionName;

                    if (m_item.PermsGranter == agentId)
                    {
                        if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
                        {
                            DoLLTeleport(presence, destination, targetPos, targetLookAt);
                        }
                    }

                    // agent must be wearing the object
                    if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
                    {
                        DoLLTeleport(presence, destination, targetPos, targetLookAt);
                    }
                    else
                    {
                        // agent must not be a god
                        if (presence.GodLevel >= 200) 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);
                        }
                    }
                }
            }
        }
LSL_Api