From e15fca60d1efcfe32e795e3494e35bdae26111e2 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jul 2018 18:31:58 +0100
Subject: mantis8342: make max ban height above ground configurable per regions
instance with ini file option BanLineSafeHeight
---
OpenSim/Framework/ILandChannel.cs | 3 ++-
OpenSim/Region/CoreModules/World/Land/LandChannel.cs | 20 ++++++++++++++++++--
.../CoreModules/World/Land/LandManagementModule.cs | 16 +++++++++++++++-
OpenSim/Region/CoreModules/World/Land/LandObject.cs | 2 +-
OpenSim/Tests/Common/Mock/TestLandChannel.cs | 2 ++
5 files changed, 38 insertions(+), 5 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs
index 8667837..e5ea596 100644
--- a/OpenSim/Framework/ILandChannel.cs
+++ b/OpenSim/Framework/ILandChannel.cs
@@ -33,6 +33,8 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ILandChannel
{
+
+ float BanLineSafeHeight {get;}
///
/// Get all parcels
///
@@ -97,6 +99,5 @@ namespace OpenSim.Region.Framework.Interfaces
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void sendClientInitialLandInfo(IClientAPI remoteClient);
-
}
}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 5ff063b..993b782 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -37,11 +37,9 @@ namespace OpenSim.Region.CoreModules.World.Land
{
#region Constants
- public const float BAN_LINE_SAFETY_HEIGHT = 100;
//Land types set with flags in ParcelOverlay.
//Only one of these can be used.
-
//RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
@@ -77,10 +75,28 @@ namespace OpenSim.Region.CoreModules.World.Land
private readonly Scene m_scene;
private readonly LandManagementModule m_landManagementModule;
+ private float m_BanLineSafeHeight = 100.0f;
+ public float BanLineSafeHeight
+ {
+ get
+ {
+ return m_BanLineSafeHeight;
+ }
+ private set
+ {
+ if (value >= 20f && value <= 5000f)
+ m_BanLineSafeHeight = value;
+ else
+ m_BanLineSafeHeight = 100.0f;
+ }
+ }
+
public LandChannel(Scene scene, LandManagementModule landManagementMod)
{
m_scene = scene;
m_landManagementModule = landManagementMod;
+ if(landManagementMod != null)
+ m_BanLineSafeHeight = landManagementMod.BanLineSafeHeight;
}
#region ILandChannel Members
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 09ece7d..19b714e 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -116,6 +116,19 @@ namespace OpenSim.Region.CoreModules.World.Land
// "View distance" for sending parcel layer info if asked for from a view point in the region
private int parcelLayerViewDistance { get; set; }
+ private float m_BanLineSafeHeight = 100.0f;
+ public float BanLineSafeHeight
+ {
+ get { return m_BanLineSafeHeight; }
+ private set
+ {
+ if (value > 20f && value <= 5000f)
+ m_BanLineSafeHeight = value;
+ else
+ m_BanLineSafeHeight = 100.0f;
+ }
+ }
+
#region INonSharedRegionModule Members
public Type ReplaceableInterface
@@ -137,6 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Land
bool disablebans = landManagementConfig.GetBoolean("DisableParcelBans", !m_allowedForcefulBans);
m_allowedForcefulBans = !disablebans;
m_showBansLines = landManagementConfig.GetBoolean("ShowParcelBansLines", m_showBansLines);
+ m_BanLineSafeHeight = landManagementConfig.GetFloat("BanLineSafeHeight", m_BanLineSafeHeight);
}
}
@@ -341,7 +355,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool EnforceBans(ILandObject land, ScenePresence avatar)
{
Vector3 agentpos = avatar.AbsolutePosition;
- float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + LandChannel.BAN_LINE_SAFETY_HEIGHT;
+ float h = m_scene.GetGroundHeight(agentpos.X, agentpos.Y) + m_scene.LandChannel.BanLineSafeHeight;
float zdif = avatar.AbsolutePosition.Z - h;
if (zdif > 0 )
{
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index cbe8a2e..229587b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -633,7 +633,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool CanBeOnThisLand(UUID avatar, float posHeight)
{
- if (posHeight < LandChannel.BAN_LINE_SAFETY_HEIGHT && IsBannedFromLand(avatar))
+ if (posHeight < m_scene.LandChannel.BanLineSafeHeight && IsBannedFromLand(avatar))
{
return false;
}
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
index 05db03fe..cb16f55 100644
--- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs
+++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
@@ -42,6 +42,8 @@ namespace OpenSim.Tests.Common
private Scene m_scene;
private List m_parcels;
+ public float BanLineSafeHeight { get { return 100f; } }
+
public TestLandChannel(Scene scene)
{
m_scene = scene;
--
cgit v1.1