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

@ -540,22 +540,36 @@ public partial class ArenaRenderer : Node3D
switch (chassisId)
{
case "buggy":
case "jackal":
BuildBuggyParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat);
break;
case "technical":
case "mule":
BuildTechnicalParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat);
break;
case "tank":
case "anvil":
case "ironclad":
case "ferret":
case "mammoth":
BuildTankParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat);
break;
case "hornet":
case "condor":
BuildVtolParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat, isHeavy: chassisId == "condor");
break;
case "manticore":
case "bastion":
BuildManticoreParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat);
break;
case "raptor":
case "spectre":
case "kestrel":
case "exemplar_frame":
BuildRaptorParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat, isExemplar: chassisId == "exemplar_frame");
break;
case "paladin":
case "breaker":
BuildPaladinParts(root, aimPivot, bodyMat, accentMat, darkMat, heatMat, isTourist: isSpectator && tier == SpectatorTier.Tourist);
break;
default:
@ -728,6 +742,18 @@ public partial class ArenaRenderer : Node3D
AddBox(aimPivot, new Vector3(0.45f, 0.48f, 2.0f), new Vector3( 1.45f, 0f, 0.65f), accentMat);
}
private static void BuildVtolParts(Node3D root, Node3D aimPivot, Material bodyMat, Material accentMat, Material darkMat, Material heatMat, bool isHeavy)
{
float s = isHeavy ? 1.3f : 1.0f;
AddBox(root, new Vector3(1.1f * s, 0.7f * s, 3.4f * s), Vector3.Zero, bodyMat);
AddBox(root, new Vector3(3.1f * s, 0.16f * s, 0.9f * s), new Vector3(0f, 0.15f * s, -0.2f * s), accentMat);
AddBox(root, new Vector3(0.65f * s, 0.35f * s, 0.9f * s), new Vector3(-1.35f * s, 0.25f * s, -0.15f * s), darkMat);
AddBox(root, new Vector3(0.65f * s, 0.35f * s, 0.9f * s), new Vector3( 1.35f * s, 0.25f * s, -0.15f * s), darkMat);
AddBox(root, new Vector3(0.6f * s, 0.32f * s, 0.6f * s), new Vector3(0f, 0.25f * s, -1.4f * s), heatMat);
aimPivot.Position = new Vector3(0f, -0.25f * s, 1.3f * s);
AddBox(aimPivot, new Vector3(0.32f * s, 0.24f * s, 0.9f * s), new Vector3(0f, 0f, 0.35f * s), accentMat);
}
private static void AddBox(Node3D parent, Vector3 size, Vector3 pos, Material mat)
{
parent.AddChild(new MeshInstance3D

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;

View file

@ -108,8 +108,8 @@ public partial class Main : Node3D
_cameraYaw -= mm.Relative.X * 0.0028f;
_cameraPitch = Math.Clamp(
_cameraPitch + mm.Relative.Y * 0.0024f,
Mathf.DegToRad(-18f),
Mathf.DegToRad(38f));
Mathf.DegToRad(-78f),
Mathf.DegToRad(45f));
return;
}
@ -211,7 +211,12 @@ public partial class Main : Node3D
if (Input.IsKeyPressed(Key.D) || Input.IsKeyPressed(Key.Right)) steer += 1f;
if (Input.IsKeyPressed(Key.A) || Input.IsKeyPressed(Key.Left)) steer -= 1f;
bool brake = Input.IsKeyPressed(Key.Space);
bool isVtol = Session.State.Player.Grid.Spec.IsVtol;
float verticalThrottle = 0f;
if (Input.IsKeyPressed(Key.Space)) verticalThrottle += 1f;
if (Input.IsKeyPressed(Key.C) || Input.IsKeyPressed(Key.Ctrl)) verticalThrottle -= 1f;
bool brake = isVtol ? Input.IsKeyPressed(Key.Shift) : Input.IsKeyPressed(Key.Space);
bool pointerOnHud = Input.MouseMode != Input.MouseModeEnum.Captured &&
_hud.IsPointerOverInteractiveHud(GetViewport().GetMousePosition());
bool fire = !pointerOnHud && Input.IsMouseButtonPressed(MouseButton.Left);
@ -225,7 +230,8 @@ public partial class Main : Node3D
Fire: fire,
InteractPickup: _interactQueued,
Brake: brake,
AimWorldY: aimY);
AimWorldY: aimY,
VerticalThrottle: verticalThrottle);
}
private (float AimX, float AimY, float AimZ) ComputeCenterScreenAim()

View file

@ -220,15 +220,15 @@ public partial class Smoke : Node
}
Check(chromeCount == 5, $"Expected 5 ChromePanel materials on HUD, got {chromeCount}");
// Pack a real Tank chassis with mounted modules, thermal gradient, stripped cell, and active hit-pulse
var testGrid = new ChassisGrid(Catalog.Tank);
Check(testGrid.TryMount(Catalog.Recoilless, "wpn_turret"), "Expected Recoilless to mount on wpn_turret");
Check(testGrid.TryMount(Catalog.Mg762, "wpn_coax"), "Expected Mg762 to mount on wpn_coax");
Check(testGrid.TryMount(Catalog.TurboCore, "eng_rear"), "Expected TurboCore to mount on eng_rear");
Check(testGrid.TryMount(Catalog.CopperRad, "rad_deck"), "Expected CopperRad to mount on rad_deck");
Check(testGrid.TryMount(Catalog.WeldedPlate, "arm_glacis"), "Expected WeldedPlate to mount on arm_glacis");
testGrid.InjectHardpointHeat("eng_rear", 1800f);
testGrid.InjectHardpointHeat("wpn_turret", 900f);
// Pack a real Ironclad chassis with mounted modules, thermal gradient, stripped cell, and active hit-pulse
var testGrid = new ChassisGrid(Catalog.Ironclad);
Check(testGrid.TryMount(Catalog.Recoilless, "hp.weapon.main"), "Expected Recoilless to mount on hp.weapon.main");
Check(testGrid.TryMount(Catalog.Mg762, "hp.weapon.coax"), "Expected Mg762 to mount on hp.weapon.coax");
Check(testGrid.TryMount(Catalog.TurboCore, "hp.engine.rear"), "Expected TurboCore to mount on hp.engine.rear");
Check(testGrid.TryMount(Catalog.CopperRad, "hp.radiator.l"), "Expected CopperRad to mount on hp.radiator.l");
Check(testGrid.TryMount(Catalog.WeldedPlate, "hp.armor.front"), "Expected WeldedPlate to mount on hp.armor.front");
testGrid.InjectHardpointHeat("hp.engine.rear", 1800f);
testGrid.InjectHardpointHeat("hp.weapon.main", 900f);
testGrid.StepHeat(0.25f);
testGrid.Armor[0, 0] = 0f; // stripped armor cell
@ -236,7 +236,7 @@ public partial class Smoke : Node
schematic.SetGrid(testGrid);
schematic.TriggerHitPulse(1, 1, 1f);
// Hit-testing verification: center of cell (1, 1) must map to (1, 1) and hardpoint "wpn_turret"
// Hit-testing verification: center of cell (1, 1) must map to (1, 1) and hardpoint "hp.weapon.main"
schematic.ComputeCellLayout(out float cellSize, out Vector2 origin);
Check(cellSize > 10f, $"Expected InventoryGridControl cellSize > 10px, got {cellSize:F2}");
Vector2 probePos = origin + new Vector2(1.5f * cellSize, 1.5f * cellSize);
@ -244,8 +244,8 @@ public partial class Smoke : Node
Check(hitCell && mappedCell == new Vector2I(1, 1),
$"Expected TryGetCellAt to map center of (1,1) to (1,1), got hit={hitCell} cell={mappedCell}");
var mappedHp = schematic.GetHardpointAt(1, 1);
Check(mappedHp is { Id: "wpn_turret" },
$"Expected GetHardpointAt(1,1) to return wpn_turret, got {mappedHp?.Id ?? "null"}");
Check(mappedHp is { Id: "hp.weapon.main" },
$"Expected GetHardpointAt(1,1) to return hp.weapon.main, got {mappedHp?.Id ?? "null"}");
// Toggle thermal mode off -> on -> off
_main.Hud.SetThermalMode(true, instant: true);
@ -257,8 +257,8 @@ public partial class Smoke : Node
// Regression check (Finding 3): same-dimension SwapChassis updates _hardpointLookup and clears hover state
schematic._GuiInput(new InputEventMouseMotion { Position = probePos });
Check(schematic.HoveredCell == new Vector2I(1, 1) && schematic.HoveredHardpoint is { Id: "wpn_turret" },
$"Expected hover on (1,1)/wpn_turret before SwapChassis, got cell={schematic.HoveredCell} hp={schematic.HoveredHardpoint?.Id ?? "null"}");
Check(schematic.HoveredCell == new Vector2I(1, 1) && schematic.HoveredHardpoint is { Id: "hp.weapon.main" },
$"Expected hover on (1,1)/hp.weapon.main before SwapChassis, got cell={schematic.HoveredCell} hp={schematic.HoveredHardpoint?.Id ?? "null"}");
bool hoverResetEmitted = false;
void OnSwapHoverChanged(Vector2I? cell, HardpointSpec? hp)
@ -269,9 +269,9 @@ public partial class Smoke : Node
}
}
schematic.HoverChanged += OnSwapHoverChanged;
var altTankSpec = Catalog.Tank with
var altTankSpec = Catalog.Ironclad with
{
Id = "tank_alt",
Id = "ironclad_alt",
Hardpoints = new[]
{
new HardpointSpec("wpn_swapped", HardpointKind.Weapon, 1, 1, 2, 2, 18f)
@ -284,19 +284,19 @@ public partial class Smoke : Node
Check(schematic.GetHardpointAt(1, 1) is { Id: "wpn_swapped" },
$"Expected GetHardpointAt(1,1) to update to wpn_swapped after same-dimension SwapChassis, got {schematic.GetHardpointAt(1, 1)?.Id ?? "null"}");
Check(schematic.GetHardpointAt(0, 1) is null,
$"Expected old hardpoint wpn_coax at (0,1) to clear after SwapChassis, got {schematic.GetHardpointAt(0, 1)?.Id ?? "null"}");
$"Expected old hardpoint hp.weapon.coax at (0,1) to clear after SwapChassis, got {schematic.GetHardpointAt(0, 1)?.Id ?? "null"}");
Check(schematic.HoveredCell is null && schematic.HoveredHardpoint is null && hoverResetEmitted,
$"Expected SwapChassis to clear hover and emit HoverChanged(null, null), cell={schematic.HoveredCell} emitted={hoverResetEmitted}");
// Re-seed Tank grid for GPU tests below
testGrid = new ChassisGrid(Catalog.Tank);
Check(testGrid.TryMount(Catalog.Recoilless, "wpn_turret"), "Expected Recoilless to remount on wpn_turret");
Check(testGrid.TryMount(Catalog.Mg762, "wpn_coax"), "Expected Mg762 to remount on wpn_coax");
Check(testGrid.TryMount(Catalog.TurboCore, "eng_rear"), "Expected TurboCore to remount on eng_rear");
Check(testGrid.TryMount(Catalog.CopperRad, "rad_deck"), "Expected CopperRad to remount on rad_deck");
Check(testGrid.TryMount(Catalog.WeldedPlate, "arm_glacis"), "Expected WeldedPlate to remount on arm_glacis");
testGrid.InjectHardpointHeat("eng_rear", 1800f);
testGrid.InjectHardpointHeat("wpn_turret", 900f);
// Re-seed Ironclad grid for GPU tests below
testGrid = new ChassisGrid(Catalog.Ironclad);
Check(testGrid.TryMount(Catalog.Recoilless, "hp.weapon.main"), "Expected Recoilless to remount on hp.weapon.main");
Check(testGrid.TryMount(Catalog.Mg762, "hp.weapon.coax"), "Expected Mg762 to remount on hp.weapon.coax");
Check(testGrid.TryMount(Catalog.TurboCore, "hp.engine.rear"), "Expected TurboCore to remount on hp.engine.rear");
Check(testGrid.TryMount(Catalog.CopperRad, "hp.radiator.l"), "Expected CopperRad to remount on hp.radiator.l");
Check(testGrid.TryMount(Catalog.WeldedPlate, "hp.armor.front"), "Expected WeldedPlate to remount on hp.armor.front");
testGrid.InjectHardpointHeat("hp.engine.rear", 1800f);
testGrid.InjectHardpointHeat("hp.weapon.main", 900f);
testGrid.StepHeat(0.25f);
testGrid.Armor[0, 0] = 0f;
@ -354,8 +354,8 @@ public partial class Smoke : Node
Check(modeDiff > 500, $"Expected thermal conduit toggle to visibly change > 500 pixels, got {modeDiff}");
// Finding 2 GPU check: overheated (350C+, thermal_mode = 1.0f) must obey blend_premul_alpha (out_rgb <= out_a)
testGrid.InjectHardpointHeat("eng_rear", 45000f);
testGrid.InjectHardpointHeat("wpn_turret", 25000f);
testGrid.InjectHardpointHeat("hp.engine.rear", 45000f);
testGrid.InjectHardpointHeat("hp.weapon.main", 25000f);
testGrid.StepHeat(0.05f);
float hotTemp = testGrid.Temperature[1, 3];
Check(hotTemp >= 350f, $"Expected overheated cell >= 350C for premul test, got {hotTemp:F1}C");
@ -371,12 +371,12 @@ public partial class Smoke : Node
// Finding 1 GPU check: asymmetric Raptor chassis with thermal_mode = 1.0f must leave 0 lit pixels in inactive cell holes
var raptorGrid = new ChassisGrid(Catalog.Raptor);
Check(raptorGrid.TryMount(Catalog.CopperRad, "rad_lsh"), "Expected CopperRad on Raptor rad_lsh");
Check(raptorGrid.TryMount(Catalog.CopperRad, "rad_rsh"), "Expected CopperRad on Raptor rad_rsh");
Check(raptorGrid.TryMount(Catalog.Autocannon, "wpn_larm"), "Expected Autocannon on Raptor wpn_larm");
Check(raptorGrid.TryMount(Catalog.TurboCore, "eng_chest"), "Expected TurboCore on Raptor eng_chest");
Check(raptorGrid.TryMount(Catalog.Autocannon, "wpn_rarm"), "Expected Autocannon on Raptor wpn_rarm");
raptorGrid.InjectHardpointHeat("eng_chest", 1800f);
Check(raptorGrid.TryMount(Catalog.CopperRad, "hp.radiator.sh_l"), "Expected CopperRad on Raptor hp.radiator.sh_l");
Check(raptorGrid.TryMount(Catalog.CopperRad, "hp.radiator.sh_r"), "Expected CopperRad on Raptor hp.radiator.sh_r");
Check(raptorGrid.TryMount(Catalog.Autocannon, "hp.weapon.arm_l"), "Expected Autocannon on Raptor hp.weapon.arm_l");
Check(raptorGrid.TryMount(Catalog.TurboCore, "hp.engine.chest"), "Expected TurboCore on Raptor hp.engine.chest");
Check(raptorGrid.TryMount(Catalog.Autocannon, "hp.weapon.arm_r"), "Expected Autocannon on Raptor hp.weapon.arm_r");
raptorGrid.InjectHardpointHeat("hp.engine.chest", 1800f);
raptorGrid.StepHeat(0.25f);
vpGrid.SetGrid(raptorGrid);
@ -478,8 +478,8 @@ public partial class Smoke : Node
var grid = _main.Session.State.Player.Grid;
grid.TryAddCargo(Catalog.TouringPlasma);
grid.TryAddCargo(Catalog.GoldRadiator);
grid.InjectHardpointHeat("eng_mid", 1100f);
grid.InjectHardpointHeat("wpn_roof", 750f);
grid.InjectHardpointHeat("hp.engine.rear", 1100f);
grid.InjectHardpointHeat("hp.weapon.roof", 750f);
grid.StepHeat(0.15f);
grid.Armor[0, 0] = 0f;
_main.Hud.Sync(_main.Session);
@ -499,15 +499,15 @@ public partial class Smoke : Node
{
var grid = _main.Session.State.Player.Grid;
grid.SwapChassis(Catalog.Paladin);
Check(grid.TryMount(Catalog.TouringPlasma, "wpn_lsh"), "Expected TouringPlasma on Paladin wpn_lsh");
Check(grid.TryMount(Catalog.WeldedPlate, "arm_collar"), "Expected WeldedPlate on Paladin arm_collar");
Check(grid.TryMount(Catalog.TouringPlasma, "wpn_rsh"), "Expected TouringPlasma on Paladin wpn_rsh");
Check(grid.TryMount(Catalog.GildedLance, "wpn_larm"), "Expected GildedLance on Paladin wpn_larm");
Check(grid.TryMount(Catalog.NobleCore, "eng_core"), "Expected NobleCore on Paladin eng_core");
Check(grid.TryMount(Catalog.GildedLance, "wpn_rarm"), "Expected GildedLance on Paladin wpn_rarm");
Check(grid.TryMount(Catalog.GoldRadiator, "rad_l"), "Expected GoldRadiator on Paladin rad_l");
Check(grid.TryMount(Catalog.WeldedPlate, "arm_waist"), "Expected WeldedPlate on Paladin arm_waist");
Check(grid.TryMount(Catalog.GoldRadiator, "rad_r"), "Expected GoldRadiator on Paladin rad_r");
Check(grid.TryMount(Catalog.TouringPlasma, "hp.weapon.sh_l"), "Expected TouringPlasma on Paladin hp.weapon.sh_l");
Check(grid.TryMount(Catalog.WeldedPlate, "hp.armor.torso"), "Expected WeldedPlate on Paladin hp.armor.torso");
Check(grid.TryMount(Catalog.TouringPlasma, "hp.weapon.sh_r"), "Expected TouringPlasma on Paladin hp.weapon.sh_r");
Check(grid.TryMount(Catalog.GildedLance, "hp.weapon.arm_l"), "Expected GildedLance on Paladin hp.weapon.arm_l");
Check(grid.TryMount(Catalog.NobleCore, "hp.engine.chest"), "Expected NobleCore on Paladin hp.engine.chest");
Check(grid.TryMount(Catalog.GildedLance, "hp.weapon.arm_r"), "Expected GildedLance on Paladin hp.weapon.arm_r");
Check(grid.TryMount(Catalog.GoldRadiator, "hp.radiator.back_l"), "Expected GoldRadiator on Paladin hp.radiator.back_l");
Check(grid.TryMount(Catalog.WeldedPlate, "hp.armor.legs"), "Expected WeldedPlate on Paladin hp.armor.legs");
Check(grid.TryMount(Catalog.GoldRadiator, "hp.radiator.back_r"), "Expected GoldRadiator on Paladin hp.radiator.back_r");
grid.Cargo.Clear();
var cargoSpecs = new[]