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

@ -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[]