using Unity.Entities;
using Unity.NetCode;
namespace ProjectM.Simulation
{
///
/// Enableable, LOCAL (not replicated) "is dead" gate for a player. Derived every predicted tick from the
/// replicated by (Dead == Health.Current <= 0) —
/// exactly the derive-don't-replicate idiom of /StatRecomputeSystem,
/// so it is identical on server + owner-predicted client and rollback-correct with no replicated enabled bit.
/// Baked DISABLED (the player spawns alive). Movement/aim/fire systems query .WithDisabled<Dead>()
/// so a dead player is frozen and can't act.
///
public struct Dead : IComponentData, IEnableableComponent { }
///
/// Server-only respawn timer for a player. NOT replicated — recovery is server-authoritative and the refilled
/// (GhostField) + repositioned LocalTransform replicate instead.
/// == 0 means "no respawn pending / alive"; is the baked down-time before recovery.
///
public struct RespawnState : IComponentData
{
/// Raw server tick at which to respawn; 0 = none pending.
public uint RespawnTick;
/// Ticks the player stays down before recovering (~60 ticks/sec).
public int DelayTicks;
/// Ticks of post-respawn damage immunity granted on recovery (~60 ticks/sec).
public int InvulnTicks;
}
///
/// Replicated post-respawn damage-immunity window. UntilTick = the raw server tick until which the
/// player ignores damage; 0 = none. Set server-side by PlayerRespawnSystem on recovery, enforced by
/// HealthApplyDamageSystem, and a [GhostField] so the client HUD can show a SHIELDED cue.
///
public struct RespawnInvuln : IComponentData
{
[GhostField] public uint UntilTick;
}
}