Fix Soul HUD/MP findings: camera-local offscreen arrows, panel avoidance, dead-observer clear, remote CoreHpRatio sync, and OFL notice staging
This commit is contained in:
parent
cffef82845
commit
02ad6d68cf
8 changed files with 270 additions and 48 deletions
|
|
@ -797,6 +797,40 @@ namespace RustToDust.Tests
|
|||
"Client must receive Exemplar walker snapshot even under dense 12 quad-walker contention");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoteArenaSession_AppliesRemoteContenderCoreHpRatioOnPvsSnapshot()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, 0, seed: 42, ArenaMapKind.Desert, maxHumans: 12, autoRestartSec: 0);
|
||||
var ep = new IPEndPoint(IPAddress.Loopback, host.BoundPort);
|
||||
|
||||
using var client = new RemoteArenaSession(ep, "HpProbe");
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
Assert.True(PumpUntil(host, new[] { client }, () => client.IsJoined, ref nowMs, 3000));
|
||||
int localSlot = client.LocalContenderId;
|
||||
int rivalSlot = localSlot == 0 ? 1 : 0;
|
||||
|
||||
var serverLocal = host.Session.State.Contenders[localSlot];
|
||||
var serverRival = host.Session.State.Contenders[rivalSlot];
|
||||
host.Session.SetContenderPose(localSlot, 0f, 0f, 0f);
|
||||
host.Session.SetContenderPose(rivalSlot, 0f, 40f, MathF.PI);
|
||||
|
||||
float targetHp = serverRival.Grid.MaxCoreHp * 0.42f;
|
||||
serverRival.Grid.ApplyReplicatedDamage(0, 0, 0f, 20f, targetHp, serverRival.Grid.HitSequence + 1);
|
||||
float expectedRatio = serverRival.Grid.CoreHp / serverRival.Grid.MaxCoreHp;
|
||||
|
||||
bool synced = PumpUntil(host, new[] { client }, () =>
|
||||
{
|
||||
if (!client.IsContenderVisible(rivalSlot)) return false;
|
||||
var c = client.ViewState.Contenders[rivalSlot];
|
||||
float r = c.Grid.MaxCoreHp > 0f ? c.Grid.CoreHp / c.Grid.MaxCoreHp : 1f;
|
||||
return MathF.Abs(r - expectedRatio) < 0.02f;
|
||||
}, ref nowMs, 2500);
|
||||
|
||||
var clientRival = client.ViewState.Contenders[rivalSlot];
|
||||
float actualRatio = clientRival.Grid.MaxCoreHp > 0f ? clientRival.Grid.CoreHp / clientRival.Grid.MaxCoreHp : 1f;
|
||||
Assert.True(synced, $"Expected remote contender {rivalSlot} CoreHpRatio ~ {expectedRatio:F3}, got {actualRatio:F3}");
|
||||
}
|
||||
|
||||
private static byte[] EncodeRudpLatestDatagram(byte[] frameBytes, uint sequence) =>
|
||||
CultNetRudpPacketCodec.Encode(new CultNetRudpPacket
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue