check land permitions on sit target for unscripted sits

avinationmerge
UbitUmarov 2013-01-03 14:27:21 +00:00
parent 1665a0d636
commit a285ff7e69
3 changed files with 31 additions and 0 deletions

View File

@ -70,6 +70,7 @@ namespace OpenSim.Framework
void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client);
bool IsEitherBannedOrRestricted(UUID avatar); bool IsEitherBannedOrRestricted(UUID avatar);
bool IsBannedFromLand(UUID avatar); bool IsBannedFromLand(UUID avatar);
bool CanBeOnThisLand(UUID avatar, float posHeight);
bool IsRestrictedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar);
bool IsInLandAccessList(UUID avatar); bool IsInLandAccessList(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(IClientAPI remote_client);

View File

@ -442,6 +442,19 @@ namespace OpenSim.Region.CoreModules.World.Land
return false; return false;
} }
public bool CanBeOnThisLand(UUID avatar, float posHeight)
{
if (posHeight < LandChannel.BAN_LINE_SAFETY_HIEGHT && IsBannedFromLand(avatar))
{
return false;
}
else if (IsRestrictedFromLand(avatar))
{
return false;
}
return true;
}
public bool HasGroupAccess(UUID avatar) public bool HasGroupAccess(UUID avatar)
{ {
if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)

View File

@ -2247,6 +2247,17 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
private bool CanEnterLandPosition(Vector3 testPos)
{
ILandObject land = m_scene.LandChannel.GetLandObject(testPos.X, testPos.Y);
if (land == null || land.LandData.Name == "NO_LAND")
return true;
return land.CanBeOnThisLand(UUID,testPos.Z);
}
// status // status
// < 0 ignore // < 0 ignore
// 0 bad sit spot // 0 bad sit spot
@ -2265,6 +2276,12 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null) if (part == null)
return; return;
Vector3 targetPos = part.GetWorldPosition() + offset * part.GetWorldRotation();
if(!CanEnterLandPosition(targetPos))
{
ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot");
return;
}
// m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString());
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();