Files
Project-M/Assets/_Project/Scripts/Simulation/World/RouteSelectRequest.cs
T
2026-07-02 20:41:43 -07:00

28 lines
1.7 KiB
C#

using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Client → server route choice at a RouteSelect gate. <see cref="OptionIndex"/> indexes the REPLICATED
/// <c>RunInfo.RouteOpt*</c> option set (never a raw map column — the server re-validates against its own
/// <c>NextMask</c>, so a divergent client can only send an index the server rejects).
/// <see cref="ForRunEpoch"/>/<see cref="ForLayer"/> stale-reject a pick that arrives after the party already
/// advanced. First ACCEPTED commit wins (the in-place <c>RouteCommand</c> latch — DR-014 atomicity).
/// UNCONDITIONAL wire type, blittable scalars only. Declared at Step 3 (wire front-load, one RpcCollection hash
/// change for the whole redesign); consumed by <c>RouteSelectSystem</c> from Step 8.
/// </summary>
public struct RouteSelectRequest : IRpcCommand
{
/// <summary>Index into the replicated RouteOpt* set (0..RouteOptionCount-1).</summary>
public byte OptionIndex;
/// <summary>RE-MEANED (Step-8 review, zero wire churn): carries <c>(int)RunInfo.RunSeed</c> — the
/// replicated, per-run-unique, never-zero run-identity token — NOT the server-only RunEpoch (which a client
/// cannot know). The server accepts iff <c>(uint)ForRunEpoch == RunRuntime.RunSeed</c>: the full cross-run
/// stale-reject at zero RpcCollection-hash cost (re-mean bytes, don't rename).</summary>
public int ForRunEpoch;
/// <summary>The layer this pick was made for — <c>RunInfo.CurrentRoom</c> VERBATIM (during a gate that is
/// still the just-CLEARED layer; never +1 — the server compares the same un-incremented value).</summary>
public int ForLayer;
}
}