Wire client VTOL/arc HUD & inputs and add Cut 3a tests

This commit is contained in:
Meta Vens 2026-12-04 19:11:33 +01:00
commit eb579a6ede
10 changed files with 552 additions and 86 deletions

View file

@ -176,7 +176,17 @@ public partial class Hud : CanvasLayer
{
if (state.Contenders[i].Alive) aliveCount++;
}
_statsLabel.Text = $"SPD {player.Speed:F1} m/s | ALIVE {aliveCount} / {state.Contenders.Count} | KILLS {player.Kills}";
if (player.Grid.Spec.IsVtol)
{
float agl = MathF.Max(0f, player.Y - player.Grid.Spec.HalfHeight - state.Terrain.SampleHeight(player.X, player.Z));
_statsLabel.Text = $"SPD {player.Speed:F1} m/s | ALT {agl:F1}m | ALIVE {aliveCount} / {state.Contenders.Count} | KILLS {player.Kills}";
_controlsHint.Text = "WASD Fly | Space/C Climb/Descend | Mouse Aim | LMB Fire | E Bolt/Swap | Tab Garage";
}
else
{
_statsLabel.Text = $"SPD {player.Speed:F1} m/s | ALIVE {aliveCount} / {state.Contenders.Count} | KILLS {player.Kills}";
_controlsHint.Text = "WASD Drive | Mouse Aim | LMB Fire | E Bolt/Swap | Tab Garage | T Conduits | Wheel Zoom";
}
float distCenter = MathF.Sqrt(player.X * player.X + player.Z * player.Z);
float outside = distCenter - state.Spectators.SafeRadius;
@ -553,7 +563,7 @@ public partial class Hud : CanvasLayer
private void SyncCargoButtons(ChassisGrid grid)
{
int hash = grid.Cargo.Count * 97 + (_selectedCargoIndex + 10);
int hash = HashCode.Combine(grid.Cargo.Count, grid.Spec.CargoCapacity, _selectedCargoIndex);
for (int i = 0; i < grid.Cargo.Count; i++)
{
hash = HashCode.Combine(hash, grid.Cargo[i].Id);
@ -691,7 +701,10 @@ public partial class Hud : CanvasLayer
if (nearest is null) return "";
if (nearest.Module is { } mod)
{
return $"[E] Loot {(mod.IsImperial ? "IMPERIAL " : "")}{mod.Name}";
var freeHp = player.Grid.FindFirstEmptyCompatibleHardpoint(mod);
return freeHp is not null
? $"[E] Bolt {(mod.IsImperial ? "IMPERIAL " : "")}{mod.Name} -> {freeHp.Id}"
: $"[E] Loot {(mod.IsImperial ? "IMPERIAL " : "")}{mod.Name}";
}
if (nearest.Chassis is { } ch)
{
@ -784,7 +797,10 @@ public partial class Hud : CanvasLayer
Vector2 center = Size * 0.5f;
float gap = 6f;
float tick = 10f;
Color retCol = new Color(TextLight.R, TextLight.G, TextLight.B, 0.88f);
bool outOfArc = _player is not null && _player.Alive && _player.AllWeaponsOutOfArc;
Color retCol = outOfArc
? new Color(RedCol.R, RedCol.G, RedCol.B, 0.95f)
: new Color(TextLight.R, TextLight.G, TextLight.B, 0.88f);
// Clean 4-tick center crosshair + center pip
DrawCircle(center, 1.8f, retCol);
@ -793,6 +809,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)
{
DrawString(
ThemeDB.FallbackFont,
center + new Vector2(-34f, 36f),
"OUT OF ARC",
HorizontalAlignment.Left,
-1,
11,
RedCol);
}
if (_player is null || !_player.Alive)
{
return;