Fix Polygon2D.UV casing, stiffen deep-pen bump-stop, and widen mesa occlusion test margin

This commit is contained in:
Meta Vens 2026-12-04 15:43:54 +01:00
commit 62089dcff3
3 changed files with 18 additions and 15 deletions

View file

@ -206,21 +206,21 @@ namespace RustToDust.Tests
session.State.Spectators.UpdateSafeRadius(session.State.Time);
TerrainBrush mesa = default;
float bestArea = -1f;
float bestMinRadius = -1f;
for (int i = 0; i < session.State.Terrain.Brushes.Count; i++)
{
var b = session.State.Terrain.Brushes[i];
if (b.Kind == TerrainBrushKind.Mesa && b.HeightDelta >= 22f)
{
float area = b.RadiusX * b.RadiusZ;
if (area > bestArea)
float minR = MathF.Min(b.RadiusX, b.RadiusZ);
if (minR > bestMinRadius)
{
bestArea = area;
bestMinRadius = minR;
mesa = b;
}
}
}
Assert.True(bestArea > 0f, "Expected at least one tall Mesa in generated terrain.");
Assert.True(bestMinRadius > 0f, "Expected at least one tall Mesa in generated terrain.");
var player = session.State.Player;
var tourists = session.State.Spectators.Spectators.Where(s => s.Tier == SpectatorTier.Tourist).ToList();
@ -232,7 +232,7 @@ namespace RustToDust.Tests
float xPos = mesa.X + mesa.RadiusX + 18f;
bool negIsFurther = (xNeg * xNeg + mesa.Z * mesa.Z) >= (xPos * xPos + mesa.Z * mesa.Z);
float occludedX = negIsFurther ? xNeg : xPos;
float specSideX = negIsFurther ? xPos : xNeg;
float specSideX = negIsFurther ? (mesa.X + mesa.RadiusX + 45f) : (mesa.X - mesa.RadiusX - 45f);
// Briefly establish visual contact for provokedSpec at initial spot, then move player behind the mesa
session.SetContenderPose(player.Id, specSideX - (negIsFurther ? 12f : -12f), mesa.Z);
@ -261,7 +261,7 @@ namespace RustToDust.Tests
// Run 300 ticks (5.0s > 4.0s TargetMemoryDuration) while player moves laterally behind cover
for (int tick = 0; tick < 300; tick++)
{
float latZ = mesa.Z - 14f + (tick / 299f) * 34f;
float latZ = mesa.Z - 14f + (tick / 299f) * 28f;
if (tick % 10 == 0)
{
session.SetContenderPose(player.Id, occludedX, latZ);