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

llTeleportAgentHome() public method

public llTeleportAgentHome ( string agent ) : void
agent string
return void
        public void llTeleportAgentHome(string agent)
        {
            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)
                {
                    // agent must not be a god
                    if (presence.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))
                        {
                            // 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));
                            }
                        }
                    }
                }
            }

            ScriptSleep(m_sleepMsOnSetDamage);
        }
LSL_Api