Files
Project-M/Assets/_Project/Scripts/Simulation/Combat/Dying.cs
T
2026-07-13 18:30:41 -07:00

28 lines
1.5 KiB
C#

using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// Phase 1 (B3): the enemy corpse window. Stamped ONCE by <c>HealthApplyDamageSystem</c> on the lethal
/// 0-crossing (server-only, never replicated — clients derive the death read from the replicated
/// <c>Health.Current&lt;=0</c>); the entity is destroyed when ServerTick reaches <see cref="UntilTick"/>.
/// While present the enemy is a CORPSE: every actor pass (AI move/windup/contact, boss kit), every
/// LIVING count (room clear, HUD Remaining, MaxAlive fit, summon cap, siege cleared) and every target
/// snapshot (projectiles, melee, turrets, auto-aim, aggro) must skip it — a corpse neither acts, counts,
/// nor soaks hits (design review wf_fd177263: all counts were entity-count based, all snapshots unfiltered).
/// </summary>
public struct Dying : IComponentData
{
/// <summary>Server tick the corpse despawns (via <c>TickUtil.NonZero</c>; compared via <c>NetworkTick</c>).</summary>
public uint UntilTick;
/// <summary>Phase 1.7: NetworkId of the player credited with the kill (the last player-sourced DamageEvent
/// drained this tick), or -1 if none. Read once by <c>KillRewardSystem</c> for on-kill boons (Siphon/Frenzy).</summary>
public int KillerNetId;
/// <summary>Phase 1.7: 0 until <c>KillRewardSystem</c> has granted this corpse's on-kill rewards (idempotent
/// value latch — no structural change, no edge-detection).</summary>
public byte Rewarded;
}
}