using Unity.Collections;
using Unity.Mathematics;
namespace ProjectM.Simulation
{
///
/// Pure, deterministic build-placement helpers (unit-tested like /
/// StorageMath). Occupancy is DERIVED from the live structure set each placement (the structure
/// ghosts are the source of truth — restart- and replay-order-safe), never cached on the immutable
/// baked . The server passes a Temp of occupied
/// cells built by scanning live ghosts.
///
public static class BuildPlacementMath
{
/// True if is occupied in the derived set.
public static bool IsOccupied(in NativeHashSet occupied, int2 cell) => occupied.Contains(cell);
/// Full server placement legality: the cell is in-plot (half-open, negative-safe) AND not occupied.
public static bool CanPlace(in BaseAnchor anchor, in NativeHashSet occupied, int2 cell)
{
return BaseGridMath.IsCellInPlot(anchor, cell) && !occupied.Contains(cell);
}
}
}