Fix all 6 Cut 3a Soul Pass #1 findings and add regression tests

This commit is contained in:
Meta Vens 2026-12-04 19:51:16 +01:00
commit b5f1bf7753
14 changed files with 677 additions and 74 deletions

View file

@ -547,10 +547,12 @@ public partial class Hud : CanvasLayer
if (hp is not null)
{
var mounted = grid.GetMountedOn(hp.Id);
bool strippedHp = !grid.IsHardpointOperational(hp);
string hpStatus = strippedHp ? " [STRIPPED]" : "";
_hoverLabel.Text = mounted is not null
? $"{hp.Kind.ToString().ToUpperInvariant()}: {mounted.Spec.Name} {mounted.CurrentTemp:F0}°C ({mounted.CurrentPerformance * 100f:F0}%)"
: $"{hp.Kind.ToString().ToUpperInvariant()} SLOT [{hp.Width}x{hp.Height}] EMPTY";
_hoverLabel.AddThemeColorOverride("font_color", arm <= 0.01f ? RedCol : TextLight);
? $"{hp.Kind.ToString().ToUpperInvariant()}: {mounted.Spec.Name} {mounted.CurrentTemp:F0}°C ({mounted.CurrentPerformance * 100f:F0}%){hpStatus}"
: $"{hp.Kind.ToString().ToUpperInvariant()} SLOT [{hp.Width}x{hp.Height}] EMPTY{hpStatus}";
_hoverLabel.AddThemeColorOverride("font_color", (arm <= 0.01f || strippedHp) ? RedCol : TextLight);
}
else
{
@ -682,22 +684,7 @@ public partial class Hud : CanvasLayer
private static string BuildInteractionPrompt(MatchState state, ContenderState player)
{
GroundDrop? nearest = null;
float bestD2 = MatchState.PickupRadius * MatchState.PickupRadius;
for (int i = 0; i < state.GroundDrops.Count; i++)
{
var d = state.GroundDrops[i];
if (d.PickedUp) continue;
float dx = d.X - player.X;
float dz = d.Z - player.Z;
float d2 = dx * dx + dz * dz;
if (d2 <= bestD2)
{
bestD2 = d2;
nearest = d;
}
}
GroundDrop? nearest = state.FindNearestInteractableDrop(player.Id);
if (nearest is null) return "";
if (nearest.Module is { } mod)
{
@ -723,7 +710,8 @@ public partial class Hud : CanvasLayer
for (int i = 0; i < grid.Mounted.Count; i++)
{
var m = grid.Mounted[i];
lines.Add($"• {m.HardpointId}: {m.Spec.Name} {m.CurrentTemp:F0}°C ({(m.CurrentPerformance * 100f):F0}%)");
string stateTag = grid.IsHardpointOperational(m.HardpointId) ? "" : " [STRIPPED]";
lines.Add($"• {m.HardpointId}: {m.Spec.Name} {m.CurrentTemp:F0}°C ({(m.CurrentPerformance * 100f):F0}%){stateTag}");
}
return string.Join("\n", lines);
}
@ -797,8 +785,10 @@ public partial class Hud : CanvasLayer
Vector2 center = Size * 0.5f;
float gap = 6f;
float tick = 10f;
bool allDisabled = _player is not null && _player.Alive &&
_player.InArcWeaponCount == 0 && _player.OutOfArcWeaponCount == 0 && _player.DisabledWeaponCount > 0;
bool outOfArc = _player is not null && _player.Alive && _player.AllWeaponsOutOfArc;
Color retCol = outOfArc
Color retCol = (outOfArc || allDisabled)
? new Color(RedCol.R, RedCol.G, RedCol.B, 0.95f)
: new Color(TextLight.R, TextLight.G, TextLight.B, 0.88f);
@ -809,7 +799,18 @@ public partial class Hud : CanvasLayer
DrawLine(center + new Vector2(0f, -gap - tick), center + new Vector2(0f, -gap), retCol, 1.6f);
DrawLine(center + new Vector2(0f, gap), center + new Vector2(0f, gap + tick), retCol, 1.6f);
if (outOfArc)
if (allDisabled)
{
DrawString(
ThemeDB.FallbackFont,
center + new Vector2(-52f, 36f),
"WEAPONS STRIPPED",
HorizontalAlignment.Left,
-1,
11,
RedCol);
}
else if (outOfArc)
{
DrawString(
ThemeDB.FallbackFont,

View file

@ -109,7 +109,7 @@ public partial class Main : Node3D
_cameraPitch = Math.Clamp(
_cameraPitch + mm.Relative.Y * 0.0024f,
Mathf.DegToRad(-78f),
Mathf.DegToRad(45f));
Mathf.DegToRad(62f));
return;
}