Reapply "remove option ClampNegativeZ"

This reverts commit 667695b393.
This commit is contained in:
lickx
2025-05-05 02:38:16 +02:00
parent 8d8217951d
commit 333d837da6
3 changed files with 44 additions and 37 deletions

View File

@@ -162,13 +162,6 @@ namespace OpenSim.Region.Framework.Scenes
}
private bool m_scripts_enabled;
public bool ClampNegativeZ
{
get { return m_clampNegativeZ; }
}
private readonly bool m_clampNegativeZ = false;
/// <summary>
/// Used to prevent simultaneous calls to code that adds and removes agents.
/// </summary>
@@ -999,8 +992,6 @@ namespace OpenSim.Region.Framework.Scenes
m_clampPrimSize = true;
}
m_clampNegativeZ = startupConfig.GetBoolean("ClampNegativeZ", m_clampNegativeZ);
m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
@@ -1892,7 +1883,7 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.AddFrameStats(TimeDilation, physicsFPS, agentMS,
physicsMS + physicsMS2, otherMS , sleepMS, frameMS, scriptTimeMS);
// Optionally warn if a frame takes double the amount of time that it should.
// Optionally warn if a frame takes double the amount of time that it should.
if (DebugUpdates
&& Util.EnvironmentTickCountSubtract(
m_lastFrameTick, previousFrameTick) > (int)(FrameTime * 1000 * 2))
@@ -2367,7 +2358,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 dir = RayEnd - RayStart;
float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
Vector3 wpos = Vector3.Zero;
Vector3 wpos = new(0.0f, 0.0f, Constants.MinSimulationHeight);
// Check for water surface intersection from above
if ((RayStart.Z > wheight) && (RayEnd.Z < wheight))
{
@@ -2543,9 +2534,6 @@ namespace OpenSim.Region.Framework.Scenes
if (Permissions.CanRezObject(1, ownerID, pos))
{
// rez ON the ground, not IN the ground
// pos.Z += 0.25F; The rez point should now be correct so that its not in the ground
AddNewPrim(ownerID, groupID, pos, rot, shape, addFlags);
}
else

View File

@@ -301,29 +301,51 @@ namespace OpenSim.Region.Framework.Scenes
// KF: Check for out-of-region, move inside and make static.
Vector3 npos = sceneObject.RootPart.GroupPosition;
bool clampZ = m_parentScene.ClampNegativeZ;
if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) ||
npos.X > regionSizeX || npos.Y > regionSizeY))
if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && sceneObject.RootPart.Shape.State != 0))
{
if (npos.X < 0.0) npos.X = 1.0f;
if (npos.Y < 0.0) npos.Y = 1.0f;
if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f;
if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
SceneObjectPart rootpart = sceneObject.RootPart;
rootpart.GroupPosition = npos;
foreach (SceneObjectPart part in sceneObject.Parts)
{
if (part == rootpart)
continue;
part.GroupPosition = npos;
bool clamped = false;
if (npos.X < 0.0f)
{
npos.X = 1.0f;
clamped = true;
}
else if (npos.X > regionSizeX)
{
npos.X = regionSizeX - 1.0f;
clamped = true;
}
if (npos.Y < 0.0f)
{
npos.Y = 1.0f;
clamped = true;
}
else if (npos.Y > regionSizeY)
{
npos.Y = regionSizeY - 1.0f;
clamped = true;
}
if (npos.Z < Constants.MinSimulationHeight)
{
npos.Z = Constants.MinSimulationHeight;
clamped = true;
}
if(clamped)
{
SceneObjectPart rootpart = sceneObject.RootPart;
rootpart.GroupPosition = npos;
foreach (SceneObjectPart part in sceneObject.Parts)
{
if (part == rootpart)
continue;
part.GroupPosition = npos;
}
rootpart.Velocity = Vector3.Zero;
rootpart.AngularVelocity = Vector3.Zero;
rootpart.Acceleration = Vector3.Zero;
}
rootpart.Velocity = Vector3.Zero;
rootpart.AngularVelocity = Vector3.Zero;
rootpart.Acceleration = Vector3.Zero;
}
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);

View File

@@ -140,9 +140,6 @@
; This can be overridden in the region config file.
ClampPrimSize = false
; If a prim is loaded from an external source, clamp it to Z = 0 if Z is negative.
ClampNegativeZ = false
; Maximum number of prims allowable in a linkset. Affects creating new linksets. Ignored if less than or equal to zero.
; This can be overridden in the region config file.
LinksetPrims = 0