using Unity.Mathematics; namespace ProjectM.Simulation { /// /// Pure validity check for the client build-placement PREVIEW (the ground-ghost colour) — the same legality /// the server re-validates authoritatively in BuildPlaceSystem, computed client-side so the ghost can read /// green (valid) vs red (why-not). No managed types / RNG / wall-clock → unit-testable. The caller supplies /// the live occupancy result + the affordability inputs (it owns the structure scan + the ledger read). /// public static class BuildPreviewMath { public const byte Valid = 0; public const byte OutOfPlot = 1; public const byte Occupied = 2; public const byte Unaffordable = 3; /// /// Evaluate placement at : must be in-plot, unoccupied, and affordable. /// = the caller's live-structure cell check; / /// the resource on hand vs the catalog cost. Returns the first failing reason, else . /// public static byte Evaluate(in BaseAnchor anchor, int2 cell, bool occupied, int have, int cost) { if (!BaseGridMath.IsCellInPlot(anchor, cell)) return OutOfPlot; if (occupied) return Occupied; if (have < cost) return Unaffordable; return Valid; } } }