using Unity.Entities;
namespace ProjectM.Simulation
{
///
/// A fixed-yield resource generator — the FRONT of the M7 auto-gather chain (Harvester -> Conveyor ->
/// Fabricator). Each period it deposits of into its OWN
/// server-only buffer (a conveyor pulls it onward). Server-only data (NO
/// [GhostField]); the client only ever sees PlacedStructure.Type. Reuses
/// PlacedStructure.NextTick/LastProcessedTick for the deterministic, within-session catch-up
/// cadence (see HarvesterProductionSystem).
///
public struct Harvester : IComponentData
{
/// Resource id produced (a byte; see ).
public byte ResourceId;
/// Units produced per elapsed period.
public int Yield;
/// Server ticks between productions.
public int PeriodTicks;
}
///
/// A recipe machine — the BACK of the M7 chain. Consumes of
/// per run from its own buffer (fed by a conveyor) and deposits
/// of into the GLOBAL ledger. Strictly input-limited (never mints from an empty
/// slot). Server-only data.
///
public struct Fabricator : IComponentData
{
public byte InResourceId;
public int InAmount;
public byte OutResourceId;
public int OutAmount;
public int PeriodTicks;
}
///
/// A directional transport belt — the MIDDLE of the M7 chain. Each period it pulls one item off an adjacent
/// upstream (when empty) and advances a held exactly one
/// cell toward . is a byte (0=+X,1=-X,2=+Z,3=-Z) — never an enum
/// (the cross-assembly enum-in-Burst hazard). Server-only data.
///
public struct Conveyor : IComponentData
{
/// Belt facing: 0=+X, 1=-X, 2=+Z, 3=-Z (see ConveyorMath.DirOffset).
public byte Direction;
public int PeriodTicks;
}
///
/// A machine's INPUT staging buffer (server-only, NO [GhostField] -> never replicated). A DISTINCT element type
/// from the global ledger's (so GetSingleton<StorageEntry> stays
/// unambiguous) and from (so a machine can carry both without a buffer-type clash).
///
public struct MachineInput : IBufferElementData
{
public byte ResourceId;
public int Count;
}
/// A machine's OUTPUT staging buffer (server-only, NO [GhostField]). See .
public struct MachineOutput : IBufferElementData
{
public byte ResourceId;
public int Count;
}
///
/// The single in-flight item a conveyor carries. An ENABLEABLE component (enabled = the belt is occupied) so a
/// transport step is a bit-flip + field copy, never a structural change. Baked DISABLED (an empty belt).
/// Server-only.
///
public struct ConveyorItem : IComponentData, IEnableableComponent
{
public byte ResourceId;
public int Count;
}
///
/// Marks a structure PLACED by a player at runtime (BuildPlaceSystem) or restored from a save — i.e. the
/// persistable set, as opposed to anything baked into the subscene. SaveWriteSystem scans only these and
/// BaseRestoreSystem re-adds the tag, so save/restore is the single source of truth for player builds.
/// Server-only (not replicated).
///
public struct RuntimePlacedTag : IComponentData { }
}