From f2379dc78502623a2161da8be86a61508ec9860e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 11 Apr 2025 05:05:42 +0100 Subject: [PATCH] mantis 9133 replace some z < 0 checks by < Constants.MinSimulationHeight (-100) --- OpenSim/Framework/Constants.cs | 2 ++ OpenSim/Framework/RegionInfo.cs | 30 +++++++++++-------- .../EntityTransfer/EntityTransferModule.cs | 8 ++++- .../Objects/Commands/ObjectCommandsModule.cs | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 967563bc8e..e453c8cc88 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -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 diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 9cbedbee33..f4d6ce8fa4 100755 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -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); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71fd8f9c27..b7d45aa422 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -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)) { diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 612be55198..3e2582c895 100755 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -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; }