using Unity.Entities;
namespace ProjectM.Simulation
{
///
/// Server-world, UNMANAGED bridge holding a save slice the menu staged for a "Continue" session, applied
/// AT SPAWN by the server CycleDirectorSpawnSystem so the director ghost is BORN correct — it never
/// serializes a default / empty ledger to clients (no replication flicker). The
/// menu creates exactly one of these (with the buffer) in the freshly
/// created ServerWorld BEFORE the gameplay subscene streams in; the spawn system consumes + destroys it.
/// Unmanaged so the Bursted spawn system reads it without a managed bridge.
///
public struct PendingSave : IComponentData
{
public int GoalCharge;
public int GoalTarget;
/// 0 = nothing staged (New Game); non-zero = apply the staged slice at director spawn.
public byte HasData;
}
/// One staged ledger row for a Continue session; copied into the director's StorageEntry buffer at spawn.
public struct PendingSaveLedgerRow : IBufferElementData
{
public ushort ItemId;
public int Count;
}
/// One staged player-built structure row for a Continue session (M7); BaseRestoreSystem replays it
/// charge-free into the freshly-streamed base. Mirrors but as an unmanaged ECS
/// buffer element (staged in the ServerWorld before the subscene streams).
public struct PendingStructure : IBufferElementData
{
public byte Type;
public int CellX;
public int CellZ;
public byte Direction;
public uint RemainingTicks;
public byte ConveyorResId;
public int ConveyorCount;
}
/// One staged machine I/O row (M7), joined to the buffer by index.
/// Slot 0 = MachineInput, 1 = MachineOutput.
public struct PendingStructureIo : IBufferElementData
{
public int StructureIndex;
public byte Slot;
public byte ResourceId;
public int Count;
}
///
/// Host-only autosave request flag on the CycleDirector entity (added at spawn). The Bursted CyclePhaseSystem
/// sets =1 on the Siege->Calm checkpoint; the managed SaveWriteSystem reads it, writes
/// the JSON save, and clears it. A plain byte => Burst-safe (no managed/string/file touch in the sim loop).
///
public struct SaveRequest : IComponentData
{
public byte Pending;
}
}