namespace ProjectM.Client
{
///
/// Client-local build-mode state shared between the HUD build palette (sets the selected buildable), the
/// build placement input (ground ghost preview + click-to-place + conveyor rotation), and the input gather
/// (suppresses Fire while a build is selected, so a left-click places instead of firing). Pure UI state —
/// never replicated, never touches the sim. Reset on play-enter (statics survive fast-enter domain reloads).
///
public static class BuildPaletteState
{
/// Selected structure type (StructureType.*); 0 = none / no slot selected.
public static byte Selected;
/// Pending conveyor facing (0=+X,1=-X,2=+Z,3=-Z); rotated by [ / ] or R.
public static byte Direction;
/// True while the build PALETTE panel is open (toggled by Tab / gamepad Y). Slice 1 HUD declutter:
/// the palette is hidden by default; this gates its visibility, orthogonal to .
public static bool PaletteOpen;
/// True while a buildable SLOT is selected (placement is armed). The palette must also be open.
public static bool Active => Selected != 0;
/// Toggle the palette panel open/closed; closing also cancels any active slot selection.
public static void TogglePalette()
{
PaletteOpen = !PaletteOpen;
if (!PaletteOpen) { Selected = 0; Direction = 0; }
}
/// Select a type (or 0 to deselect), resetting the pending conveyor facing; auto-opens the palette
/// so a slot click never leaves the panel hidden.
public static void Select(byte type) { Selected = type; Direction = 0; if (type != 0) PaletteOpen = true; }
/// Cancel the current selection and close the palette.
public static void Clear() { Selected = 0; Direction = 0; PaletteOpen = false; }
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics() { Selected = 0; Direction = 0; PaletteOpen = false; }
}
}