public DateTime llTeleportAgentHome(LSL_Key _agent)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return DateTime.Now;
string agent = _agent.ToString();
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
IScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// agent must be over the owners land
IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
if (parcelManagement != null)
{
if (m_host.OwnerID != parcelManagement.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID &&
!World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false))
{
return PScriptSleep(5000);
}
}
//Send disable cancel so that the agent cannot attempt to stay in the region
presence.ControllingClient.SendTeleportStart((uint)TeleportFlags.DisableCancel);
IEntityTransferModule transferModule = World.RequestModuleInterface<IEntityTransferModule>();
if (transferModule != null)
transferModule.TeleportHome(agentId, presence.ControllingClient);
else
presence.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator.");
}
}
return PScriptSleep(5000);
}