mantis8342: make max ban height above ground configurable per regions instance with ini file option BanLineSafeHeight

0.9.1.0-post-fixes
UbitUmarov 2018-07-21 18:31:58 +01:00
parent 8c1c9129aa
commit e15fca60d1
5 changed files with 38 additions and 5 deletions

View File

@ -33,6 +33,8 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface ILandChannel
{
float BanLineSafeHeight {get;}
/// <summary>
/// Get all parcels
/// </summary>
@ -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);
}
}

View File

@ -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

View File

@ -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 )
{

View File

@ -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;
}

View File

@ -42,6 +42,8 @@ namespace OpenSim.Tests.Common
private Scene m_scene;
private List<ILandObject> m_parcels;
public float BanLineSafeHeight { get { return 100f; } }
public TestLandChannel(Scene scene)
{
m_scene = scene;