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

@ -10,12 +10,12 @@ namespace RustToDust.Tests
public void Conduction_SpreadsHeatFromHotHardpointToNeighbors()
{
var grid = Catalog.CreateStarterBuggy();
// wpn_roof is at (1, 0). Neighbor (0, 0) and (1, 1) start at ambient 20f.
grid.InjectHardpointHeat("wpn_roof", 600f);
// hp.weapon.roof is at (1, 0) 1x2. Neighbors (0, 0) and (1, 2) start at ambient 20f.
grid.InjectHardpointHeat("hp.weapon.roof", 600f);
float hotBefore = grid.Temperature[1, 0];
Assert.True(hotBefore > ChassisGrid.AmbientTemp + 20f);
Assert.Equal(ChassisGrid.AmbientTemp, grid.Temperature[0, 0]);
Assert.Equal(ChassisGrid.AmbientTemp, grid.Temperature[1, 1]);
Assert.Equal(ChassisGrid.AmbientTemp, grid.Temperature[1, 2]);
for (int i = 0; i < 30; i++)
{
@ -23,7 +23,7 @@ namespace RustToDust.Tests
}
Assert.True(grid.Temperature[0, 0] > ChassisGrid.AmbientTemp + 1f);
Assert.True(grid.Temperature[1, 1] > ChassisGrid.AmbientTemp + 1f);
Assert.True(grid.Temperature[1, 2] > ChassisGrid.AmbientTemp + 1f);
Assert.True(grid.Temperature[1, 0] < hotBefore);
}
@ -99,29 +99,31 @@ namespace RustToDust.Tests
[Fact]
public void LooseFitAndSwapChassis_PreservesCompatibleGearAndStowsOverflow()
{
// Tank has 2x2 turret hardpoint: smaller 1x1 weapon fits loosely; 2x2 weapon must NOT fit 1x1 buggy roof.
var tankGrid = new ChassisGrid(Catalog.Tank);
Assert.True(tankGrid.TryMount(Catalog.Recoilless, "wpn_turret")); // 2x2 into 2x2
Assert.True(tankGrid.TryMount(Catalog.Mg762, "wpn_coax")); // 1x1 into 1x1
Assert.True(tankGrid.TryMount(Catalog.TurboCore, "eng_rear")); // 1x2 into 2x2
Assert.True(tankGrid.TryMount(Catalog.GoldRadiator, "rad_deck")); // 1x1 into 1x1
Assert.True(tankGrid.TryMount(Catalog.WeldedPlate, "arm_glacis")); // 1x1 into 2x1
Assert.True(tankGrid.TryMount(Catalog.GildedPlate, "arm_skirt")); // 1x1 into 1x1
// Ironclad has 2x2 main turret hardpoint: smaller 1x1 weapon fits loosely; 2x2 weapon must NOT fit 1x2 Jackal roof.
var tankGrid = new ChassisGrid(Catalog.Ironclad);
Assert.True(tankGrid.TryMount(Catalog.Recoilless, "hp.weapon.main")); // 2x2 into 2x2
Assert.True(tankGrid.TryMount(Catalog.Mg762, "hp.weapon.coax")); // 1x1 into 1x1
Assert.True(tankGrid.TryMount(Catalog.TurboCore, "hp.engine.rear")); // 1x2 into 2x2
Assert.True(tankGrid.TryMount(Catalog.GoldRadiator, "hp.radiator.l")); // 1x1 into 1x2
Assert.True(tankGrid.TryMount(Catalog.WeldedPlate, "hp.armor.front")); // 1x1 into 4x1
Assert.True(tankGrid.TryMount(Catalog.GildedPlate, "hp.armor.skirts")); // 1x1 into 1x2
// Fill cargo near buggy capacity (4) so swapping down to Buggy overflows to ground!
// Fill cargo so swapping down to Jackal (capacity 4) overflows 2 items to ground!
Assert.True(tankGrid.TryAddCargo(Catalog.Flak));
Assert.True(tankGrid.TryAddCargo(Catalog.CopperRad));
Assert.True(tankGrid.TryAddCargo(Catalog.DieselCore));
List<ModuleSpec> dropped = tankGrid.SwapChassis(Catalog.Buggy);
List<ModuleSpec> dropped = tankGrid.SwapChassis(Catalog.Jackal);
// Buggy has 1x1 Weapon (mg_762 fits, recoilless 2x2 does not!), 1x1 Engine (turbo_core 1x2 does not fit!), 1x1 Radiator (gold_radiator fits!), 0 Armor hardpoints.
Assert.Equal("buggy", tankGrid.Spec.Id);
// Jackal has 1x2 Weapon (mg_762 fits, recoilless 2x2 does not!), 1x2 Engine (turbo_core fits), 1x1 Radiator (gold_radiator fits), 0 Armor hardpoints.
Assert.Equal("jackal", tankGrid.Spec.Id);
Assert.Contains(tankGrid.Mounted, m => m.Spec.Id == "mg_762");
Assert.Contains(tankGrid.Mounted, m => m.Spec.Id == "turbo_core");
Assert.Contains(tankGrid.Mounted, m => m.Spec.Id == "gold_radiator");
Assert.DoesNotContain(tankGrid.Mounted, m => m.Spec.Id == "recoilless");
// 6 mounted on Tank: 2 transferred (mg_762, gold_radiator), 4 leftover + 2 cargo = 6 items -> 4 in Buggy Cargo, 2 dropped!
Assert.Equal(Catalog.Buggy.CargoCapacity, tankGrid.Cargo.Count);
// 6 mounted on Ironclad: 3 transferred, 3 leftover + 3 cargo = 6 items -> 4 in Jackal Cargo, 2 dropped!
Assert.Equal(Catalog.Jackal.CargoCapacity, tankGrid.Cargo.Count);
Assert.Equal(2, dropped.Count);
}
}