mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
Streamline banning code using existing methods.
This commit is contained in:
@@ -4855,9 +4855,14 @@ Environment.Exit(1);
|
||||
get { return m_allowScriptCrossings; }
|
||||
}
|
||||
|
||||
public Vector3? GetNearestAllowedPosition(ScenePresence avatar)
|
||||
public Vector3 GetNearestAllowedPosition(ScenePresence avatar)
|
||||
{
|
||||
ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||
return GetNearestAllowedPosition(avatar, null);
|
||||
}
|
||||
|
||||
public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel)
|
||||
{
|
||||
ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel);
|
||||
|
||||
if (nearestParcel != null)
|
||||
{
|
||||
@@ -4915,6 +4920,11 @@ Environment.Exit(1);
|
||||
}
|
||||
|
||||
public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y)
|
||||
{
|
||||
return GetNearestAllowedParcel(avatarId, x, y, null);
|
||||
}
|
||||
|
||||
public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel)
|
||||
{
|
||||
List<ILandObject> all = AllParcels();
|
||||
float minParcelDistance = float.MaxValue;
|
||||
@@ -4922,7 +4932,7 @@ Environment.Exit(1);
|
||||
|
||||
foreach (var parcel in all)
|
||||
{
|
||||
if (!parcel.IsEitherBannedOrRestricted(avatarId))
|
||||
if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel)
|
||||
{
|
||||
float parcelDistance = GetParcelDistancefromPoint(parcel, x, y);
|
||||
if (parcelDistance < minParcelDistance)
|
||||
|
||||
Reference in New Issue
Block a user