Files
2026-06-09 23:26:20 -07:00

27 lines
1.4 KiB
C#

using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// One pending hit against a damageable entity, queued as a per-entity buffer element. The server
/// appends a DamageEvent when a projectile hits (ProjectileDamageSystem), then HealthApplyDamageSystem
/// drains the buffer once per tick to subtract from Health. Buffering decouples hit detection from
/// health resolution and lets multiple simultaneous hits accumulate before being applied. Not
/// replicated — only Health.Current is a GhostField; the buffer is server-side and cleared each tick.
/// </summary>
public struct DamageEvent : IBufferElementData
{
/// <summary>Damage to subtract from the target's Health.Current (world health units).</summary>
public float Amount;
/// <summary>NetworkId of the firing player that caused this hit (attribution / self-hit filtering upstream).</summary>
public int SourceNetworkId;
/// <summary>Raw ServerTick at which this hit logically LANDS (the appending tick), stamped via
/// <c>TickUtil.NonZero</c> at every append site (0 = unstamped). The dash i-frame negation compares it
/// against the dashing player's <c>DashState</c> window, so a strike appended a tick before it is
/// drained is judged against the tick it was AUTHORED, not the tick it was applied.</summary>
public uint SourceTick;
}
}