Example #1
0
        private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land,  out string reason)
        {
            bool banned = land.IsBannedFromLand(agent.AgentID);
            bool restricted = land.IsRestrictedFromLand(agent.AgentID);

            if (banned || restricted)
            {
                ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y);
                if (nearestParcel != null)
                {
                    //Move agent to nearest allowed
                    Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
                    agent.startpos.X = newPosition.X;
                    agent.startpos.Y = newPosition.Y;
                }
                else
                {
                    if (banned)
                    {
                        reason = "Cannot regioncross into banned parcel.";
                    }
                    else
                    {
                        reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
                                   RegionInfo.RegionName);
                    }
                    return false;
                }
            }
            reason = "";
            return true;
        }
        // checks and enforces bans or restrictions
        // returns true if enforced
        public bool EnforceBans(ILandObject land, ScenePresence avatar)
        {
            Vector3 agentpos = avatar.AbsolutePosition;
            float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + LandChannel.BAN_LINE_SAFETY_HEIGHT;
            float zdif = avatar.AbsolutePosition.Z - h;
            if (zdif > 0 )
            {
                forcedPosition.Remove(avatar.UUID);
                avatar.lastKnownAllowedPosition = agentpos;
                return false;
            }

            bool ban = false;
            string reason = "";
            if (land.IsRestrictedFromLand(avatar.UUID))
            {
                reason = "You do not have access to the parcel";
                ban = true;
            }

            if (land.IsBannedFromLand(avatar.UUID))
            {
                if ( m_allowedForcefulBans)
                {
                   reason ="You are banned from parcel";
                   ban = true;
                }
                else if(!ban)
                {
                    if (forcedPosition.Contains(avatar.UUID))
                        avatar.ControllingClient.SendAlertMessage("You are banned from parcel, please leave by your own will");
                    forcedPosition.Remove(avatar.UUID);
                    avatar.lastKnownAllowedPosition = agentpos;
                    return false;
                }
            }
     
            if(ban)
            {
                if (!forcedPosition.Contains(avatar.UUID))
                    avatar.ControllingClient.SendAlertMessage(reason);

                if(zdif > -4f)
                {

                    agentpos.Z = h + 4.0f;
                    ForceAvatarToPosition(avatar, agentpos);
                    return true;
                }

                if (land.ContainsPoint((int)avatar.lastKnownAllowedPosition.X,
                            (int) avatar.lastKnownAllowedPosition.Y))
                {
                    Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
                    if (pos == null)
                    {
                         forcedPosition.Remove(avatar.UUID);
                         m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
                    }
                    else
                        ForceAvatarToPosition(avatar, (Vector3)pos);
                }
                else
                {
                    ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
                }
                return true;
            }
            else
            {
                forcedPosition.Remove(avatar.UUID);
                avatar.lastKnownAllowedPosition = agentpos;
                return false;
            }
        }
Example #3
0
        private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, out Vector3 newPosition, out string reason)
        {
            newPosition = Position;
            UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID);

            IScenePresence Sp = scene.GetScenePresence(userID);

            if (account == null)
            {
                reason = "Failed authentication.";
                return(false); //NO!
            }

            //Make sure that this user is inside the region as well
            if (Position.X < -2f || Position.Y < -2f ||
                Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2)
            {
                m_log.DebugFormat(
                    "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping",
                    Position, Name, userID);
                bool changedX = false;
                bool changedY = false;
                while (Position.X < 0)
                {
                    Position.X += scene.RegionInfo.RegionSizeX;
                    changedX    = true;
                }
                while (Position.X > scene.RegionInfo.RegionSizeX)
                {
                    Position.X -= scene.RegionInfo.RegionSizeX;
                    changedX    = true;
                }

                while (Position.Y < 0)
                {
                    Position.Y += scene.RegionInfo.RegionSizeY;
                    changedY    = true;
                }
                while (Position.Y > scene.RegionInfo.RegionSizeY)
                {
                    Position.Y -= scene.RegionInfo.RegionSizeY;
                    changedY    = true;
                }

                if (changedX)
                {
                    Position.X = scene.RegionInfo.RegionSizeX - Position.X;
                }
                if (changedY)
                {
                    Position.Y = scene.RegionInfo.RegionSizeY - Position.Y;
                }
            }

            //Check that we are not underground as well
            float posZLimit = scene.RequestModuleInterface <ITerrainChannel>()[(int)Position.X, (int)Position.Y] + (float)1.25;

            if (posZLimit >= (Position.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
            {
                Position.Z = posZLimit;
            }

            IAgentConnector AgentConnector = DataManager.DataManager.RequestPlugin <IAgentConnector>();
            IAgentInfo      agentInfo      = null;

            if (AgentConnector != null)
            {
                agentInfo = AgentConnector.GetAgent(userID);
            }

            ILandObject             ILO = null;
            IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILO = parcelManagement.GetLandObject(Position.X, Position.Y);
            }

            if (ILO == null)
            {
                //Can't find land, give them the first parcel in the region and find a good position for them
                ILO      = parcelManagement.AllParcels()[0];
                Position = parcelManagement.GetParcelCenterAtGround(ILO);
            }

            //parcel permissions
            if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block
            {
                if (Sp == null)
                {
                    reason = "Banned from this parcel.";
                    return(true);
                }

                if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                {
                    //We found a place for them, but we don't need to check any further
                    return(true);
                }
            }
            //Move them out of banned parcels
            ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags;

            if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup &&
                (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList &&
                (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList)
            {
                //One of these is in play then
                if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(true);
                    }
                    if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID)
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                            //We found a place for them, but we don't need to check any further
                            return(true);
                        }
                    }
                }
                else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(true);
                    }
                    //All but the people on the access list are banned
                    if (ILO.IsRestrictedFromLand(userID))
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                            //We found a place for them, but we don't need to check any further
                            return(true);
                        }
                    }
                }
                else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(true);
                    }
                    //All but the people on the pass/access list are banned
                    if (ILO.IsRestrictedFromLand(Sp.UUID))
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                            //We found a place for them, but we don't need to check any further
                            return(true);
                        }
                    }
                }
            }

            EstateSettings ES = scene.RegionInfo.EstateSettings;

            //Move them to the nearest landing point
            if (!ES.AllowDirectTeleport)
            {
                if (!scene.Permissions.IsGod(userID))
                {
                    Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
                    if (telehub != null)
                    {
                        if (telehub.SpawnPos.Count == 0)
                        {
                            Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                        }
                        else
                        {
                            int LastTelehubNum = 0;
                            if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum))
                            {
                                LastTelehubNum = 0;
                            }
                            Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                            LastTelehubNum++;
                            if (LastTelehubNum == telehub.SpawnPos.Count)
                            {
                                LastTelehubNum = 0;
                            }
                            LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum;
                        }
                    }
                }
            }
            if (!scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None))
            {
                if (ILO.LandData.LandingType == 2) //Blocked, force this person off this land
                {
                    //Find a new parcel for them
                    List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position);
                    if (Parcels.Count == 0)
                    {
                        IScenePresence SP;
                        scene.TryGetScenePresence(userID, out SP);
                        newPosition = parcelManagement.GetNearestRegionEdgePosition(SP);
                    }
                    else
                    {
                        bool found = false;
                        //We need to check here as well for bans, can't toss someone into a parcel they are banned from
                        foreach (ILandObject Parcel in Parcels)
                        {
                            if (!Parcel.IsBannedFromLand(userID))
                            {
                                //Now we have to check their userloc
                                if (ILO.LandData.LandingType == 2)
                                {
                                    continue;                           //Blocked, check next one
                                }
                                else if (ILO.LandData.LandingType == 1) //Use their landing spot
                                {
                                    newPosition = Parcel.LandData.UserLocation;
                                }
                                else //They allow for anywhere, so dump them in the center at the ground
                                {
                                    newPosition = parcelManagement.GetParcelCenterAtGround(Parcel);
                                }
                                found = true;
                            }
                        }
                        if (!found) //Dump them at the edge
                        {
                            if (Sp != null)
                            {
                                newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp);
                            }
                            else
                            {
                                reason = "Banned from this parcel.";
                                return(true);
                            }
                        }
                    }
                }
                else if (ILO.LandData.LandingType == 1) //Move to tp spot
                {
                    if (ILO.LandData.UserLocation != Vector3.Zero)
                    {
                        newPosition = ILO.LandData.UserLocation;
                    }
                    else // Dump them at the nearest region corner since they havn't set a landing point
                    {
                        newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp);
                    }
                }
            }

            //We assume that our own region isn't null....
            if (agentInfo != null)
            {
                //Can only enter prelude regions once!
                int flags = scene.GridService.GetRegionFlags(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionID);
                if (flags != -1 && ((flags & (int)Aurora.Framework.RegionFlags.Prelude) == (int)Aurora.Framework.RegionFlags.Prelude) && agentInfo != null)
                {
                    if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID))
                    {
                        reason = "You may not enter this region as you have already been to this prelude region.";
                        return(false);
                    }
                    else
                    {
                        agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID, OSD.FromInteger((int)IAgentFlags.PastPrelude));
                        AgentConnector.UpdateAgent(agentInfo); //This only works for standalones... and thats ok
                    }
                }
            }


            if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0)
            {
                if ((account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) == (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile)
                {
                    reason = "You may not enter this region.";
                    return(false);
                }
            }

            if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null)
            {
                if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor)
                {
                    reason = "You may not enter this region.";
                    return(false);
                }
            }

            newPosition = Position;
            reason      = "";
            return(true);
        }
Example #4
0
        private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, uint TeleportFlags,
                                               out Vector3 newPosition, out string reason)
        {
            newPosition = Position;
            UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, userID);

            IScenePresence Sp = scene.GetScenePresence(userID);

            if (account == null)
            {
                reason = "Failed authentication.";
                return(false); //NO!
            }


            //Make sure that this user is inside the region as well
            if (Position.X < -2f || Position.Y < -2f ||
                Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2)
            {
                MainConsole.Instance.DebugFormat(
                    "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping",
                    Position, Name, userID);
                bool changedX = false;
                bool changedY = false;
                while (Position.X < 0)
                {
                    Position.X += scene.RegionInfo.RegionSizeX;
                    changedX    = true;
                }
                while (Position.X > scene.RegionInfo.RegionSizeX)
                {
                    Position.X -= scene.RegionInfo.RegionSizeX;
                    changedX    = true;
                }

                while (Position.Y < 0)
                {
                    Position.Y += scene.RegionInfo.RegionSizeY;
                    changedY    = true;
                }
                while (Position.Y > scene.RegionInfo.RegionSizeY)
                {
                    Position.Y -= scene.RegionInfo.RegionSizeY;
                    changedY    = true;
                }

                if (changedX)
                {
                    Position.X = scene.RegionInfo.RegionSizeX - Position.X;
                }
                if (changedY)
                {
                    Position.Y = scene.RegionInfo.RegionSizeY - Position.Y;
                }
            }

            IAgentConnector AgentConnector = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector>();
            IAgentInfo      agentInfo      = null;

            if (AgentConnector != null)
            {
                agentInfo = AgentConnector.GetAgent(userID);
            }

            ILandObject             ILO = null;
            IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                ILO = parcelManagement.GetLandObject(Position.X, Position.Y);
            }

            if (ILO == null)
            {
                if (Sp != null)
                {
                    Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity
                }
                //Can't find land, give them the first parcel in the region and find a good position for them
                ILO      = parcelManagement.AllParcels()[0];
                Position = parcelManagement.GetParcelCenterAtGround(ILO);
            }

            //parcel permissions
            if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block
            {
                if (Sp != null)
                {
                    Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity
                }
                if (Sp == null)
                {
                    reason = "Banned from this parcel.";
                    return(false);
                }

                if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                {
                }
            }
            //Move them out of banned parcels
            ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags;

            if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup &&
                (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList &&
                (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList)
            {
                if (Sp != null)
                {
                    Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity
                }
                //One of these is in play then
                if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(false);
                    }
                    if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID)
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                        }
                    }
                }
                else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(false);
                    }
                    //All but the people on the access list are banned
                    if (ILO.IsRestrictedFromLand(userID))
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                        }
                    }
                }
                else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList)
                {
                    if (Sp == null)
                    {
                        reason = "Banned from this parcel.";
                        return(false);
                    }
                    //All but the people on the pass/access list are banned
                    if (ILO.IsRestrictedFromLand(Sp.UUID))
                    {
                        if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason))
                        {
                        }
                    }
                }
            }

            EstateSettings      ES             = scene.RegionInfo.EstateSettings;
            TeleportFlags       tpflags        = (TeleportFlags)TeleportFlags;
            const TeleportFlags allowableFlags =
                OpenMetaverse.TeleportFlags.ViaLandmark | OpenMetaverse.TeleportFlags.ViaHome |
                OpenMetaverse.TeleportFlags.ViaLure |
                OpenMetaverse.TeleportFlags.ForceRedirect |
                OpenMetaverse.TeleportFlags.Godlike | OpenMetaverse.TeleportFlags.NineOneOne;

            //If the user wants to force landing points on crossing, we act like they are not crossing, otherwise, check the child property and that the ViaRegionID is set
            bool isCrossing = !ForceLandingPointsOnCrossing && (Sp != null && Sp.IsChildAgent &&
                                                                ((tpflags & OpenMetaverse.TeleportFlags.ViaRegionID) ==
                                                                 OpenMetaverse.TeleportFlags.ViaRegionID));

            //Move them to the nearest landing point
            if (!((tpflags & allowableFlags) != 0) && !isCrossing && !ES.AllowDirectTeleport)
            {
                if (Sp != null)
                {
                    Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity
                }
                if (!scene.Permissions.IsGod(userID))
                {
                    Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID,
                                                                  scene.RegionInfo.RegionHandle);
                    if (telehub != null)
                    {
                        if (telehub.SpawnPos.Count == 0)
                        {
                            Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                        }
                        else
                        {
                            int LastTelehubNum = 0;
                            if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum))
                            {
                                LastTelehubNum = 0;
                            }
                            Position = telehub.SpawnPos[LastTelehubNum] +
                                       new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                            LastTelehubNum++;
                            if (LastTelehubNum == telehub.SpawnPos.Count)
                            {
                                LastTelehubNum = 0;
                            }
                            LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum;
                        }
                    }
                }
            }
            else if (!((tpflags & allowableFlags) != 0) && !isCrossing &&
                     !scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None))
            //Telehubs override parcels
            {
                if (Sp != null)
                {
                    Sp.ClearSavedVelocity();                           //If we are moving the agent, clear their velocity
                }
                if (ILO.LandData.LandingType == (int)LandingType.None) //Blocked, force this person off this land
                {
                    //Find a new parcel for them
                    List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position);
                    if (Parcels.Count > 1)
                    {
                        newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp);
                    }
                    else
                    {
                        bool found = false;
                        //We need to check here as well for bans, can't toss someone into a parcel they are banned from
                        foreach (ILandObject Parcel in Parcels.Where(Parcel => !Parcel.IsBannedFromLand(userID)))
                        {
                            //Now we have to check their userloc
                            if (ILO.LandData.LandingType == (int)LandingType.None)
                            {
                                continue; //Blocked, check next one
                            }
                            else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint)
                            {
                                //Use their landing spot
                                newPosition = Parcel.LandData.UserLocation;
                            }
                            else //They allow for anywhere, so dump them in the center at the ground
                            {
                                newPosition = parcelManagement.GetParcelCenterAtGround(Parcel);
                            }
                            found = true;
                        }

                        if (!found) //Dump them at the edge
                        {
                            if (Sp != null)
                            {
                                newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp);
                            }
                            else
                            {
                                reason = "Banned from this parcel.";
                                return(false);
                            }
                        }
                    }
                }
                else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint)  //Move to tp spot
                {
                    newPosition = ILO.LandData.UserLocation != Vector3.Zero
                                      ? ILO.LandData.UserLocation
                                      : parcelManagement.GetNearestRegionEdgePosition(Sp);
                }
            }

            //We assume that our own region isn't null....
            if (agentInfo != null)
            {
                //Can only enter prelude regions once!
                if (scene.RegionInfo.RegionFlags != -1 &&
                    ((scene.RegionInfo.RegionFlags & (int)RegionFlags.Prelude) == (int)RegionFlags.Prelude) &&
                    agentInfo != null)
                {
                    if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID))
                    {
                        reason = "You may not enter this region as you have already been to this prelude region.";
                        return(false);
                    }
                    else
                    {
                        agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID,
                                                            OSD.FromInteger((int)IAgentFlags.PastPrelude));
                        AgentConnector.UpdateAgent(agentInfo);
                    }
                }
                if (agentInfo.OtherAgentInformation.ContainsKey("LimitedToEstate"))
                {
                    int LimitedToEstate = agentInfo.OtherAgentInformation["LimitedToEstate"];
                    if (scene.RegionInfo.EstateSettings.EstateID != LimitedToEstate)
                    {
                        reason = "You may not enter this reason, as it is outside of the estate you are limited to.";
                        return(false);
                    }
                }
            }


            if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0)
            {
                if (account != null &&
                    (account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) ==
                    (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile)
                {
                    reason = "You may not enter this region.";
                    return(false);
                }
            }

            if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null)
            {
                if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor)
                {
                    reason = "You may not enter this region.";
                    return(false);
                }
            }

            //Check that we are not underground as well
            ITerrainChannel chan = scene.RequestModuleInterface <ITerrainChannel>();

            if (chan != null)
            {
                float posZLimit = chan[(int)newPosition.X, (int)newPosition.Y] + (float)1.25;

                if (posZLimit >= (newPosition.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
                {
                    newPosition.Z = posZLimit;
                }
            }

            reason = "";
            return(true);
        }