*Ban lines now work if they are enabled grid wide.

*Restricted lines just give you a friendly warning for now
afrisby
mingchen 2007-12-20 16:50:16 +00:00
parent dcaea6cd50
commit 0e6915ae48
3 changed files with 69 additions and 9 deletions

View File

@ -74,6 +74,8 @@ namespace OpenSim.Region.Environment.LandManagement
//These are other constants. Yay! //These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1; public const int START_LAND_LOCAL_ID = 1;
public const float BAN_LINE_SAFETY_HIEGHT = 100;
#endregion #endregion
#region Member Variables #region Member Variables
@ -90,6 +92,8 @@ namespace OpenSim.Region.Environment.LandManagement
private readonly Scene m_scene; private readonly Scene m_scene;
private readonly RegionInfo m_regInfo; private readonly RegionInfo m_regInfo;
public bool allowedForcefulBans = true;
#endregion #endregion
#region Constructors #region Constructors
@ -590,6 +594,21 @@ namespace OpenSim.Region.Environment.LandManagement
} }
public void sendYouAreBannedNotice(ScenePresence avatar)
{
if (allowedForcefulBans)
{
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers");
avatar.PhysicsActor.Position = new OpenSim.Region.Physics.Manager.PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y, avatar.lastKnownAllowedPosition.z);
avatar.PhysicsActor.Velocity = new OpenSim.Region.Physics.Manager.PhysicsVector(0, 0, 0);
}
else
{
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers");
}
}
public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID) public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
{ {
if (m_scene.RegionInfo.RegionID == regionID) if (m_scene.RegionInfo.RegionID == regionID)
@ -597,20 +616,30 @@ namespace OpenSim.Region.Environment.LandManagement
if (landList[localLandID] != null) if (landList[localLandID] != null)
{ {
Land parcelAvatarIsEntering = landList[localLandID]; Land parcelAvatarIsEntering = landList[localLandID];
if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT)
{
if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID))
{ {
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); sendYouAreBannedNotice(avatar);
} }
else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID))
{ {
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. Please go away. <3 OpenSim Developers"); avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers");
}
else
{
avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
}
}
else
{
avatar.sentMessageAboutRestrictedParcelFlyingDown = true;
} }
} }
} }
} }
public void sendOutBannedNotices(IClientAPI avatar) public void sendOutNearestBanLine(IClientAPI avatar)
{ {
List<ScenePresence> avatars = m_scene.GetAvatars(); List<ScenePresence> avatars = m_scene.GetAvatars();
@ -631,6 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement
checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar);
return; //Only send one return; //Only send one
} }
} }
return; return;
} }
@ -661,13 +691,33 @@ namespace OpenSim.Region.Environment.LandManagement
if (clientAvatar != null) if (clientAvatar != null)
{ {
sendLandUpdate(clientAvatar); sendLandUpdate(clientAvatar);
sendOutBannedNotices(remote_client); sendOutNearestBanLine(remote_client);
Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{
handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line!
if (!parcel.isBannedFromLand(clientAvatar.UUID))
{
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
}
}
else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID))
{
sendYouAreBannedNotice(clientAvatar);
}
} }
} }
public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
{ {
Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT)
{
avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
}
} }

View File

@ -822,7 +822,15 @@ namespace OpenSim.Region.Environment.Scenes
if (dGridSettings.ContainsKey("allow_forceful_banlines")) if (dGridSettings.ContainsKey("allow_forceful_banlines"))
{ {
if (dGridSettings["allow_forceful_banlines"] != "TRUE") if (dGridSettings["allow_forceful_banlines"] != "TRUE")
MainLog.Instance.Verbose("GRID","Grid is disabling forceful parcel banlists"); {
MainLog.Instance.Verbose("GRID", "Grid is disabling forceful parcel banlists");
m_LandManager.allowedForcefulBans = false;
}
else
{
MainLog.Instance.Verbose("GRID", "Grid is allowing forceful parcel banlists");
m_LandManager.allowedForcefulBans = true;
}
} }
} }

View File

@ -45,6 +45,8 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID currentParcelUUID = LLUUID.Zero; public LLUUID currentParcelUUID = LLUUID.Zero;
private List<LLUUID> m_animations = new List<LLUUID>(); private List<LLUUID> m_animations = new List<LLUUID>();
private List<int> m_animationSeqs = new List<int>(); private List<int> m_animationSeqs = new List<int>();
public Vector3 lastKnownAllowedPosition = new Vector3();
public bool sentMessageAboutRestrictedParcelFlyingDown = false;
private bool m_updateflag = false; private bool m_updateflag = false;
private byte m_movementflag = 0; private byte m_movementflag = 0;