Cut 7b: 16 modular Brokkr weapon parts, mfg paint bands 10..14, ClientOrdnanceMirror, audio & tooltips
This commit is contained in:
parent
6f6bfe3c46
commit
6447155efb
27 changed files with 2420 additions and 74 deletions
|
|
@ -277,6 +277,7 @@ public partial class Smoke : Node
|
|||
await VerifyMaxLoadPaladinGarageAsync();
|
||||
await VerifySionMapAsync();
|
||||
await VerifyOrbitalDropSequenceAsync();
|
||||
await VerifyCut7bModularOrdnanceAsync();
|
||||
}
|
||||
|
||||
private async Task VerifyHudAndShadersAsync(bool isHeadless)
|
||||
|
|
@ -2006,6 +2007,275 @@ public partial class Smoke : Node
|
|||
GD.Print($"SMOKE INFO: Cut 6b OrbitalDrop verified (touchdownTick={touchdownTick}, debris={debrisAtTouchdown}, postDisp={postDisp:F2}m, bucketsDelta={bucketsDuringDrop - bucketsBefore}, matDups={VehicleVisualInstance.PerfMaterialDupCount})");
|
||||
}
|
||||
|
||||
private async Task VerifyCut7bModularOrdnanceAsync()
|
||||
{
|
||||
var cache = _main.Arena.AssetCache;
|
||||
var partPool = _main.Arena.PartPool;
|
||||
|
||||
// 1. All 16 modular weapon sub-parts loaded with single-surface COLOR_0 meshes and required sockets
|
||||
Check(cache.WeaponParts.Count == 16, $"Expected 16 cached modular weapon parts, got {cache.WeaponParts.Count}");
|
||||
foreach (string pid in VehicleAssetCache.ExpectedWeaponPartIds)
|
||||
{
|
||||
var wp = cache.GetOrLoadWeaponPart(pid);
|
||||
Check(wp.SingleSurfaceMesh.GetSurfaceCount() == 1,
|
||||
$"Expected 1 surface on modular part '{pid}', got {wp.SingleSurfaceMesh.GetSurfaceCount()}");
|
||||
var arr = wp.SingleSurfaceMesh.SurfaceGetArrays(0);
|
||||
Check(arr.Count > (int)Mesh.ArrayType.Color && arr[(int)Mesh.ArrayType.Color].VariantType == Variant.Type.PackedColorArray,
|
||||
$"Modular part '{pid}' missing COLOR_0 attribute");
|
||||
if (wp.Slot == "receiver")
|
||||
{
|
||||
Check(wp.SocketsLocal.ContainsKey("barrel") && wp.SocketsLocal.ContainsKey("feed"),
|
||||
$"Receiver '{pid}' missing barrel/feed sockets");
|
||||
}
|
||||
else if (wp.Slot == "barrel")
|
||||
{
|
||||
Check(wp.SocketsLocal.ContainsKey("muzzle"), $"Barrel '{pid}' missing muzzle socket");
|
||||
}
|
||||
else if (wp.Slot == "muzzle")
|
||||
{
|
||||
Check(wp.SocketsLocal.ContainsKey("muzzle_tip"), $"Muzzle '{pid}' missing muzzle_tip socket");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Mount 50 distinct procedural weapons across all 5 manufacturers & 20 archetypes -> <= 16 new PartPool buckets, 0 matDups
|
||||
VehicleVisualInstance.PerfMaterialDupCount = 0;
|
||||
var testVis = VehicleVisualInstance.Create(cache, "anvil", VehicleVisualRole.Player);
|
||||
AddChild(testVis.Root);
|
||||
var testGrid = Catalog.CreateWithDefaultLoadout(Catalog.Anvil);
|
||||
string? weaponHpId = null;
|
||||
for (int i = 0; i < testGrid.Spec.Hardpoints.Length; i++)
|
||||
{
|
||||
if (testGrid.Spec.Hardpoints[i].Kind == HardpointKind.Weapon &&
|
||||
testGrid.Spec.Hardpoints[i].Height >= 2)
|
||||
{
|
||||
weaponHpId = testGrid.Spec.Hardpoints[i].Id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Check(weaponHpId is not null, "Expected Anvil to have a 1x2 weapon hardpoint for modular assembly test");
|
||||
|
||||
// Pre-warm baseline Anvil chassis/cell buckets in PartPool so bucketDelta measures ONLY modular weapon parts
|
||||
if (weaponHpId is not null)
|
||||
{
|
||||
testGrid.Mounted.RemoveAll(m => m.HardpointId == weaponHpId);
|
||||
}
|
||||
testVis.SyncMountedGear(testGrid);
|
||||
partPool.BeginFrame(null);
|
||||
testVis.SubmitToPool(partPool);
|
||||
partPool.EndFrame();
|
||||
int bucketsBefore = partPool.BucketCount;
|
||||
|
||||
partPool.BeginFrame(null);
|
||||
if (weaponHpId is not null)
|
||||
{
|
||||
for (int w = 0; w < 50; w++)
|
||||
{
|
||||
byte mfg = (byte)(w % 5);
|
||||
byte arch = (byte)(mfg * 4 + (w % 4));
|
||||
var pSpec = ProceduralWeaponGenerator.Generate(new ProceduralWeaponKey((ulong)(0xA100 + w), mfg, arch, (byte)(w & 3), 0));
|
||||
testGrid.Mounted.RemoveAll(m => m.HardpointId == weaponHpId);
|
||||
Check(testGrid.TryMount(pSpec.Module, weaponHpId), $"Failed to mount procedural weapon '{pSpec.DisplayName}' on '{weaponHpId}'");
|
||||
testVis.SyncMountedGear(testGrid);
|
||||
testVis.SubmitToPool(partPool);
|
||||
|
||||
if (w < 5)
|
||||
{
|
||||
bool hasAim = testVis.TryGetMountedWeaponCentroidsInModel(weaponHpId, "muzzle", "receiver", out Vector3 frontC, out Vector3 rearC);
|
||||
Check(hasAim && (frontC.Z > rearC.Z + 0.35f),
|
||||
$"Expected modular weapon '{pSpec.DisplayName}' muzzle ({frontC}) forward of receiver ({rearC})");
|
||||
}
|
||||
}
|
||||
}
|
||||
partPool.EndFrame();
|
||||
|
||||
int bucketDelta = partPool.BucketCount - bucketsBefore;
|
||||
Check(bucketDelta <= 16, $"Expected 50 procedural weapons to add <= 16 PartPool buckets, added {bucketDelta}");
|
||||
Check(VehicleVisualInstance.PerfMaterialDupCount == 0, $"Expected 0 material duplications, got {VehicleVisualInstance.PerfMaterialDupCount}");
|
||||
Check(CountMeshInstances(testVis.Root) == 0, $"Expected 0 MeshInstance3D children on modular vehicle rig, got {CountMeshInstances(testVis.Root)}");
|
||||
|
||||
// Verify shearing a modular weapon hardpoint spawns all 4 sub-parts into DebrisSystem
|
||||
if (weaponHpId is not null)
|
||||
{
|
||||
var testDebris = new DebrisSystem { Name = "SmokeModularShearDebris" };
|
||||
AddChild(testDebris);
|
||||
var hp = testGrid.FindHardpoint(weaponHpId)!;
|
||||
for (int dy = 0; dy < hp.Height; dy++)
|
||||
{
|
||||
for (int dx = 0; dx < hp.Width; dx++)
|
||||
{
|
||||
testGrid.Armor[hp.X + dx, hp.Y + dy] = 0f;
|
||||
}
|
||||
}
|
||||
testVis.SyncDamageAndHeat(testGrid, testDebris, Vector3.Zero);
|
||||
Check(testDebris.ActiveCount >= 4, $"Expected >= 4 sheared modular sub-parts in DebrisSystem, got {testDebris.ActiveCount}");
|
||||
testDebris.QueueFree();
|
||||
}
|
||||
testVis.Root.QueueFree();
|
||||
|
||||
// 3. Procedural weapon GroundDrops render with modular parts & clean up on pickup
|
||||
_main.Reset(77, ArenaMapKind.Desert, skipInitialDrop: true);
|
||||
_main.SetPhysicsProcess(false);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
var state = _main.Session.ViewState;
|
||||
var player = _main.Session.LocalContender;
|
||||
int dropsBefore = state.GroundDrops.Count;
|
||||
_main.Arena.Sync(_main.Session, 1.0f, 1f / 60f, 1f);
|
||||
int trackedBefore = _main.Arena.ActiveDropVisualCount;
|
||||
|
||||
var procDrops = new List<GroundDrop>(5);
|
||||
for (int m = 0; m < 5; m++)
|
||||
{
|
||||
var pSpec = ProceduralWeaponGenerator.RollForManufacturer((ManufacturerId)m, tier: 2, seed: (ulong)(0x7700 + m));
|
||||
var gd = new GroundDrop(95000 + m, player.X + 4f + m * 6f, player.Z + 8f, null, pSpec.Module);
|
||||
state.GroundDrops.Add(gd);
|
||||
procDrops.Add(gd);
|
||||
}
|
||||
_main.Arena.Sync(_main.Session, 1.1f, 1f / 60f, 1f);
|
||||
Check(_main.Arena.ActiveDropVisualCount == trackedBefore + 5,
|
||||
$"Expected {trackedBefore + 5} tracked drops after adding 5 mfg drops, got {_main.Arena.ActiveDropVisualCount}");
|
||||
|
||||
// 4. HUD 6 chrome panels, 2-line Borderlands tooltips (Garage + Hover + Pickup Prompt), zero overlap at 1280x720
|
||||
var sabotDream = ProceduralWeaponGenerator.CreateDreamSabotSled();
|
||||
var droneDream = ProceduralWeaponGenerator.CreateDreamLoiteringDrone();
|
||||
var mirvDream = ProceduralWeaponGenerator.CreateDreamMirvMineBlanket();
|
||||
|
||||
var pGrid = player.Grid;
|
||||
string? pWeaponHp = null;
|
||||
HardpointSpec? pWeaponHpSpec = null;
|
||||
for (int i = 0; i < pGrid.Spec.Hardpoints.Length; i++)
|
||||
{
|
||||
if (pGrid.Spec.Hardpoints[i].Kind == HardpointKind.Weapon && pGrid.Spec.Hardpoints[i].Height >= 2)
|
||||
{
|
||||
pWeaponHp = pGrid.Spec.Hardpoints[i].Id;
|
||||
pWeaponHpSpec = pGrid.Spec.Hardpoints[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pWeaponHp is not null && pWeaponHpSpec is not null)
|
||||
{
|
||||
pGrid.Mounted.RemoveAll(m => m.HardpointId == pWeaponHp);
|
||||
Check(pGrid.TryMount(sabotDream.Module, pWeaponHp), "Expected Dream Sabot Sled to mount on player");
|
||||
if (!_main.Hud.GarageExpanded) _main.Hud.ToggleGarage();
|
||||
_main.Hud.Sync(_main.Session);
|
||||
_main.Hud.SimulateCellHover(new Vector2I(pWeaponHpSpec.X, pWeaponHpSpec.Y), pWeaponHpSpec);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
int chromeCount = 0;
|
||||
foreach (var _ in _main.Hud.GetChromeMaterials()) chromeCount++;
|
||||
Check(chromeCount == 6, $"Expected 6 HUD chrome panels, got {chromeCount}");
|
||||
Check(_main.Hud.HoverLabelText.Contains(sabotDream.ManufacturerLabel) && _main.Hud.HoverLabelText.Contains('\n'),
|
||||
$"Expected 2-line Borderlands hover tooltip with manufacturer badge, got: {_main.Hud.HoverLabelText}");
|
||||
Check(_main.Hud.GarageDetailsText.Contains(sabotDream.SummaryLine1) && _main.Hud.GarageDetailsText.Contains(sabotDream.SummaryLine2),
|
||||
$"Expected Garage details to contain SummaryLine1 & SummaryLine2, got: {_main.Hud.GarageDetailsText}");
|
||||
|
||||
// Check nearby pickup prompt 2-line display
|
||||
var nearbyDrop = new GroundDrop(95999, player.X + 1.0f, player.Z + 1.0f, null, droneDream.Module);
|
||||
state.GroundDrops.Add(nearbyDrop);
|
||||
_main.Hud.Sync(_main.Session);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
Check(_main.Hud.PromptLabelText.Contains(droneDream.ManufacturerLabel) && _main.Hud.PromptLabelText.Contains('\n'),
|
||||
$"Expected 2-line pickup prompt with manufacturer & summary, got: {_main.Hud.PromptLabelText}");
|
||||
|
||||
Vector2 vpSize = GetViewport().GetVisibleRect().Size;
|
||||
Check(!_main.Hud.HasPanelOverlapOrClip(vpSize), $"HUD overlapped or clipped with procedural tooltip at {vpSize}");
|
||||
|
||||
nearbyDrop.PickedUp = true;
|
||||
state.GroundDrops.Remove(nearbyDrop);
|
||||
if (_main.Hud.GarageExpanded) _main.Hud.ToggleGarage();
|
||||
}
|
||||
|
||||
for (int i = 0; i < procDrops.Count; i++) procDrops[i].PickedUp = true;
|
||||
_main.Arena.Sync(_main.Session, 1.2f, 1f / 60f, 1f);
|
||||
state.GroundDrops.RemoveRange(dropsBefore, procDrops.Count);
|
||||
|
||||
// 5. ClientOrdnanceMirror + Haven MWO Audio Hooks across Sabot, Loitering Drone, and MIRV Mines
|
||||
var localSession = (_main.Session as LocalArenaSession)!;
|
||||
var sim = localSession.Inner;
|
||||
for (int cIdx = 1; cIdx < sim.State.Contenders.Count; cIdx++)
|
||||
{
|
||||
sim.SetContenderPose(cIdx, 480f + cIdx * 12f, 480f);
|
||||
}
|
||||
sim.SetContenderPose(0, 0f, 0f, 0f);
|
||||
sim.SetContenderPose(1, 0f, 125f, MathF.PI); // target Anvil/rival 125m ahead
|
||||
|
||||
int audioShotsBefore = _main.Audio.Total3DPlaysRequested;
|
||||
bool sawMirrorRocket = false;
|
||||
bool sawSabotTransition = false;
|
||||
bool sawMirrorDrone = false;
|
||||
bool sawMirrorMines = false;
|
||||
|
||||
// 5a: Sabot Rocket Sled
|
||||
if (pWeaponHp is not null)
|
||||
{
|
||||
pGrid.Mounted.RemoveAll(m => m.HardpointId == pWeaponHp);
|
||||
pGrid.TryMount(sabotDream.Module, pWeaponHp);
|
||||
for (int t = 0; t < 35; t++)
|
||||
{
|
||||
var inp = new PlayerInput(0f, 0f, 0f, 125f, Fire: t == 0, InteractPickup: false, Brake: true);
|
||||
_main.Session.SubmitLocalInput(in inp, isPhysicsTick: true);
|
||||
var evs = new List<ISimEvent>(16);
|
||||
_main.Session.DrainSimEvents(evs);
|
||||
for (int e = 0; e < evs.Count; e++)
|
||||
{
|
||||
if (evs[e] is OrdnanceNodeEvent oe && (OrdnanceEventKind)oe.Kind == OrdnanceEventKind.StageTransition)
|
||||
{
|
||||
sawSabotTransition = true;
|
||||
}
|
||||
}
|
||||
_main.Arena.Sync(_main.Session, 2.0f + t / 60f, 1f / 60f, 1f);
|
||||
_main.Arena.ConsumeEvents(_main.Session, evs, Array.Empty<FootstepPulse>(), 1f / 60f, _main.SampleCurrentMapGroundTint);
|
||||
_main.Audio.UpdateFrame(_main.Session, evs, Array.Empty<FootstepPulse>(), _main.Camera.GlobalPosition, 1f / 60f, 1f);
|
||||
if (_main.Arena.OrdnanceMirror.ActiveCount > 0) sawMirrorRocket = true;
|
||||
}
|
||||
|
||||
// 5b: Loitering Laser Drone
|
||||
pGrid.Mounted.RemoveAll(m => m.HardpointId == pWeaponHp);
|
||||
pGrid.TryMount(droneDream.Module, pWeaponHp);
|
||||
for (int t = 0; t < 95; t++)
|
||||
{
|
||||
var inp = new PlayerInput(0f, 0f, 0f, 125f, Fire: t == 0, InteractPickup: false, Brake: true);
|
||||
_main.Session.SubmitLocalInput(in inp, isPhysicsTick: true);
|
||||
var evs = new List<ISimEvent>(16);
|
||||
_main.Session.DrainSimEvents(evs);
|
||||
_main.Arena.Sync(_main.Session, 3.0f + t / 60f, 1f / 60f, 1f);
|
||||
_main.Arena.ConsumeEvents(_main.Session, evs, Array.Empty<FootstepPulse>(), 1f / 60f, _main.SampleCurrentMapGroundTint);
|
||||
_main.Audio.UpdateFrame(_main.Session, evs, Array.Empty<FootstepPulse>(), _main.Camera.GlobalPosition, 1f / 60f, 1f);
|
||||
if (t > 70 && _main.Arena.OrdnanceMirror.ActiveCount > 0) sawMirrorDrone = true;
|
||||
}
|
||||
|
||||
// 5c: MIRV Minefield Blanket
|
||||
pGrid.Mounted.RemoveAll(m => m.HardpointId == pWeaponHp);
|
||||
pGrid.TryMount(mirvDream.Module, pWeaponHp);
|
||||
for (int t = 0; t < 160; t++)
|
||||
{
|
||||
var inp = new PlayerInput(0f, 0f, 0f, 85f, Fire: t == 0, InteractPickup: false, Brake: true);
|
||||
_main.Session.SubmitLocalInput(in inp, isPhysicsTick: true);
|
||||
var evs = new List<ISimEvent>(32);
|
||||
_main.Session.DrainSimEvents(evs);
|
||||
_main.Arena.Sync(_main.Session, 5.0f + t / 60f, 1f / 60f, 1f);
|
||||
_main.Arena.ConsumeEvents(_main.Session, evs, Array.Empty<FootstepPulse>(), 1f / 60f, _main.SampleCurrentMapGroundTint);
|
||||
_main.Audio.UpdateFrame(_main.Session, evs, Array.Empty<FootstepPulse>(), _main.Camera.GlobalPosition, 1f / 60f, 1f);
|
||||
if (_main.Arena.OrdnanceMirror.ActiveCount >= 6) sawMirrorMines = true;
|
||||
}
|
||||
}
|
||||
|
||||
Check(sawMirrorRocket && sawSabotTransition,
|
||||
$"Expected ClientOrdnanceMirror to track Sabot rocket & StageTransition (rocket={sawMirrorRocket}, trans={sawSabotTransition})");
|
||||
Check(sawMirrorDrone, "Expected ClientOrdnanceMirror to maintain active Loitering Laser Drone after climb");
|
||||
Check(sawMirrorMines, "Expected ClientOrdnanceMirror to mirror >= 6 MIRV mines after Split");
|
||||
Check(_main.Audio.Total3DPlaysRequested > audioShotsBefore,
|
||||
$"Expected ArenaAudioSystem Haven MWO ordnance cues to trigger (before={audioShotsBefore}, after={_main.Audio.Total3DPlaysRequested})");
|
||||
|
||||
// Verify MatchResetEvent clears ClientOrdnanceMirror cleanly
|
||||
_main.Arena.ConsumeEvents(_main.Session, new ISimEvent[] { new MatchResetEvent() }, Array.Empty<FootstepPulse>(), 1f / 60f, _main.SampleCurrentMapGroundTint);
|
||||
Check(_main.Arena.OrdnanceMirror.ActiveCount == 0,
|
||||
$"Expected MatchResetEvent to clear ClientOrdnanceMirror, got {_main.Arena.OrdnanceMirror.ActiveCount}");
|
||||
|
||||
_main.SetPhysicsProcess(true);
|
||||
GD.Print($"SMOKE INFO: Cut 7b verified (16 parts, bucketDelta={bucketDelta}, matDups={VehicleVisualInstance.PerfMaterialDupCount}, audioPlays={_main.Audio.Total3DPlaysRequested - audioShotsBefore})");
|
||||
}
|
||||
|
||||
private static int CountPremulViolations(Image img, float tolerance)
|
||||
{
|
||||
int count = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue