fix(render,sim): preserve MechPaint albedo/COLOR_0, monotonic tracer VFX IDs, dither fade, and GLB COLOR_0 check

This commit is contained in:
Meta Vens 2026-12-05 00:26:13 +01:00
commit d81865091d
8 changed files with 201 additions and 56 deletions

View file

@ -131,5 +131,37 @@ namespace RustToDust.Tests
// Expected broadside clearance = HalfWidth (1.65) + 0.35 = 2.00m (well below HalfLength + 0.55 = 3.20m)
Assert.InRange(muzzleHorizDist, player.Grid.Spec.HalfWidth + 0.25f, player.Grid.Spec.HalfWidth + 0.50f);
}
[Fact]
public void TracerEvent_AssignsMonotonicId_AndPreservesAcrossAdvance()
{
using var session = new ArenaSession(seed: 19);
var player = session.State.Player;
float aimX = player.X + MathF.Sin(player.Yaw) * 25f;
float aimZ = player.Z + MathF.Cos(player.Yaw) * 25f;
var ids = new List<int>();
for (int tick = 0; tick < 30 && ids.Count < 2; tick++)
{
session.Step(new PlayerInput(0f, 0f, aimX, aimZ, Fire: true, InteractPickup: false, Brake: true));
foreach (var t in session.State.Tracers)
{
if (!ids.Contains(t.Id))
{
ids.Add(t.Id);
}
}
}
Assert.True(ids.Count >= 2, $"Expected at least 2 distinct tracer IDs, got {ids.Count}");
Assert.True(ids[0] > 0 && ids[1] > ids[0], $"Expected monotonic tracer IDs, got [{ids[0]}, {ids[1]}]");
int trackedId = session.State.Tracers[^1].Id;
float ttlBefore = session.State.Tracers[^1].Ttl;
MatchRules.AdvanceTracers(session.State, 0.01f);
var after = session.State.Tracers.Find(t => t.Id == trackedId);
Assert.Equal(trackedId, after.Id);
Assert.True(after.Ttl < ttlBefore);
}
}
}