From 0e6915ae48e175d3548fbdbb8a42366db1645cc6 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 20 Dec 2007 16:50:16 +0000 Subject: *Ban lines now work if they are enabled grid wide. *Restricted lines just give you a friendly warning for now --- .../Environment/LandManagement/LandManager.cs | 64 +++++++++++++++++++--- OpenSim/Region/Environment/Scenes/Scene.cs | 12 +++- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 + 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 310d29b..f984d58 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -74,6 +74,8 @@ namespace OpenSim.Region.Environment.LandManagement //These are other constants. Yay! public const int START_LAND_LOCAL_ID = 1; + public const float BAN_LINE_SAFETY_HIEGHT = 100; + #endregion #region Member Variables @@ -90,6 +92,8 @@ namespace OpenSim.Region.Environment.LandManagement private readonly Scene m_scene; private readonly RegionInfo m_regInfo; + public bool allowedForcefulBans = true; + #endregion #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) { if (m_scene.RegionInfo.RegionID == regionID) @@ -597,20 +616,30 @@ namespace OpenSim.Region.Environment.LandManagement if (landList[localLandID] != null) { Land parcelAvatarIsEntering = landList[localLandID]; - if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) + if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT) { - avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); - + if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) + { + sendYouAreBannedNotice(avatar); + } + else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) + { + 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 if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) + else { - avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. Please go away. <3 OpenSim Developers"); + avatar.sentMessageAboutRestrictedParcelFlyingDown = true; } } } } - public void sendOutBannedNotices(IClientAPI avatar) + public void sendOutNearestBanLine(IClientAPI avatar) { List avatars = m_scene.GetAvatars(); @@ -631,6 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); return; //Only send one } + } return; } @@ -661,13 +691,33 @@ namespace OpenSim.Region.Environment.LandManagement if (clientAvatar != null) { 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. { + 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); + + } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 3d4c4bb..0cb353c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -821,8 +821,16 @@ namespace OpenSim.Region.Environment.Scenes Dictionary dGridSettings = m_sceneGridService.GetGridSettings(); if (dGridSettings.ContainsKey("allow_forceful_banlines")) { - if (dGridSettings["allow_forceful_banlines"] != "TRUE") - MainLog.Instance.Verbose("GRID","Grid is disabling forceful parcel banlists"); + if (dGridSettings["allow_forceful_banlines"] != "TRUE") + { + 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; + } } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index a221243..e30c564 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -45,6 +45,8 @@ namespace OpenSim.Region.Environment.Scenes public LLUUID currentParcelUUID = LLUUID.Zero; private List m_animations = new List(); private List m_animationSeqs = new List(); + public Vector3 lastKnownAllowedPosition = new Vector3(); + public bool sentMessageAboutRestrictedParcelFlyingDown = false; private bool m_updateflag = false; private byte m_movementflag = 0; -- cgit v1.1