Reapply "mantis 9133 replace some z < 0 checks by < Constants.MinSimulationHeight (-100)"

This reverts commit cb1bde70db.
This commit is contained in:
lickx
2025-05-05 02:37:54 +02:00
parent e1459301af
commit 8d8217951d
4 changed files with 28 additions and 14 deletions

View File

@@ -63,6 +63,8 @@ namespace OpenSim.Framework
public const float MinWaterHeight = 0;
public const float MaxWaterHeight = 8000f;
public const float DefaultLandingBorderBuffer = 5.0f;
public const int MaxTextureResolution = 2048;
public static readonly string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; //plywood

View File

@@ -683,39 +683,45 @@ namespace OpenSim.Framework
private void DoDefaultLandingSanityChecks()
{
// Sanity Check Default Landing
float buffer_zone = 5f;
bool ValuesCapped = false;
// Minimum Positions
if (DefaultLandingPoint.X < buffer_zone)
if (DefaultLandingPoint.X < Constants.DefaultLandingBorderBuffer)
{
DefaultLandingPoint.X = buffer_zone;
DefaultLandingPoint.X = Constants.DefaultLandingBorderBuffer;
ValuesCapped = true;
}
if (DefaultLandingPoint.Y < buffer_zone)
if (DefaultLandingPoint.Y < Constants.DefaultLandingBorderBuffer)
{
DefaultLandingPoint.Y = buffer_zone;
DefaultLandingPoint.Y = Constants.DefaultLandingBorderBuffer;
ValuesCapped = true;
}
// Maximum Positions
if (DefaultLandingPoint.X > RegionSizeX - buffer_zone)
if (DefaultLandingPoint.X > RegionSizeX - Constants.DefaultLandingBorderBuffer)
{
DefaultLandingPoint.X = RegionSizeX - buffer_zone;
DefaultLandingPoint.X = RegionSizeX - Constants.DefaultLandingBorderBuffer;
ValuesCapped = true;
}
if (DefaultLandingPoint.Y > RegionSizeY - buffer_zone)
if (DefaultLandingPoint.Y > RegionSizeY - Constants.DefaultLandingBorderBuffer)
{
DefaultLandingPoint.Y = RegionSizeY - buffer_zone;
DefaultLandingPoint.Y = RegionSizeY - Constants.DefaultLandingBorderBuffer;
ValuesCapped = true;
}
// Height
if (DefaultLandingPoint.Z < 0f)
DefaultLandingPoint.Z = 0f;
if (DefaultLandingPoint.Z < Constants.MinSimulationHeight)
{
DefaultLandingPoint.Z = Constants.MinSimulationHeight;
ValuesCapped = true;
}
else if (DefaultLandingPoint.Z > Constants.MaxSimulationHeight)
{
DefaultLandingPoint.Z = Constants.MaxSimulationHeight;
ValuesCapped = true;
}
if (ValuesCapped)
m_log.WarnFormat("[RegionInfo]: The default landing location for {0} has been capped to {1}", RegionName, DefaultLandingPoint);

View File

@@ -497,7 +497,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, position, m_sceneName);
// Teleport within the same region
if (!m_scene.PositionIsInCurrentRegion(position) || position.Z < 0)
if (!m_scene.PositionIsInCurrentRegion(position))
{
Vector3 emergencyPos = new(128, 128, 128);
@@ -520,6 +520,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
position.Z = posZLimit;
}
if(position.Z < Constants.MinSimulationHeight)
position.Z = Constants.MinSimulationHeight;
else if(position.Z > Constants.MaxSimulationHeight)
position.Z = Constants.MaxSimulationHeight;
/*
if(!sp.CheckLocalTPLandingPoint(ref position))
{

View File

@@ -826,7 +826,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
SceneObjectPart rootPart = g.RootPart;
bool delete = false;
if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
if (rootPart.GroupPosition.Z < Constants.MinSimulationHeight || rootPart.GroupPosition.Z > Constants.MaxSimulationHeight)
{
delete = true;
}