Vixen
c7401864
csharp
public sealed class HitClaimValidator

Checks a client's hit claim against what the server knows, and against what the shot could possibly have done.

Read the guide page for this →

Remarks

Doc 28 § Shooting's hit path, minus the networking. The prediction, the claim RPC and the collider rewind are all doc 16's and all built; what is new is the weapon model and the claim's validation rules, which are arithmetic over numbers the caller supplies. Line of sight and the rewind itself are the caller's — this is handed the answers and decides whether they add up.

⚠ What it can prove and what it cannot, stated plainly. It can prove a claim names a shot that happened, that no pellet is claimed twice, that the tick is inside the window, that the distance is inside the weapon's range, and that the deviation is inside the cone the shot's own seed produces. It cannot prove the target was there — that is the rewind, and the rewind is the expensive part, which is why the budget exists.

Fields and properties (4)

  • public WeaponLibrary Weapons

    Where weapon templates come from.

  • public int Window

    How many ticks back a claim may reach.

  • public int History

    How many shots per shooter are remembered.

  • public RewindBudget? Budget

    How much a claim's rewind costs, or null for unlimited.

Methods (4)

  • public HitClaimValidator(WeaponLibrary weapons, int window = 30, int history = 64)

    Makes a validator.

  • public void RecordShot(ulong shooter, DefId weapon, in ShotFired shot, int tick)

    Records a shot the server has accepted, so its claims can be checked against it.

  • public ClaimVerdict Validate(in HitClaim claim, int tick, bool lineOfSight = true)

    Checks a claim.

  • public bool Forget(ulong shooter)

    Forgets a shooter — they left, they died, they respawned.

Used by (2)

  • HitClaimValidatorTestsVixen.Gameplay.Shooting.Tests
  • RewindBudgetTestsVixen.Gameplay.Shooting.Tests