OpenSim.Region.Framework.Scenes.Scene.TestLandRestrictions C# (CSharp) Method

TestLandRestrictions() private method

private TestLandRestrictions ( AgentCircuitData agent, ILandObject land, string &reason ) : bool
agent AgentCircuitData
land ILandObject
reason string
return bool
        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;
        }
Scene