Files
2026-06-04 21:49:03 -07:00

34 lines
1.9 KiB
C#

using Unity.Entities;
using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Destructible "Blight clutter" scattered across the expedition frontier — an ownerless INTERPOLATED ghost
/// (region-tagged Expedition; the <see cref="ResourceNode"/> sibling) that clients see and smash. The
/// server-only ResourceHarvestSystem sweeps projectiles against it UNIFIED with node harvesting (so an
/// overlapping projectile is consumed exactly once — two separate sweeps would double-DestroyEntity the
/// projectile and throw at ECB playback). Each hit deposits <see cref="ScrapPerHit"/> of
/// <see cref="ScrapResourceId"/> (a small trickle — "juice + minor scrap", no gating) into the GLOBAL
/// resource ledger and decrements <see cref="Remaining"/>; the clutter despawns at &lt;= 0.
/// <see cref="Remaining"/>/<see cref="Variant"/> are [GhostField] so clients can show depletion + pick a smash
/// visual; <see cref="ScrapResourceId"/>/<see cref="ScrapPerHit"/> are baked, server-only. Distinct from
/// <see cref="ResourceNode"/> so it carries its own visuals, scatter density and client "clear" feedback while
/// reusing the exact, tunnel-safe harvest hit-test.
/// </summary>
public struct BlightClutter : IComponentData
{
/// <summary>Remaining hit-points; the clutter despawns when this reaches 0.</summary>
[GhostField] public int Remaining;
/// <summary>Visual variant id (the client picks a mesh/tint; round-robined by the field spawner).</summary>
[GhostField] public byte Variant;
/// <summary>Scrap resource yielded per hit (baked; server-only) — see <see cref="ResourceId"/> (Biomass).</summary>
public byte ScrapResourceId;
/// <summary>Scrap units yielded per projectile hit (baked; server-only).</summary>
public float ScrapPerHit;
}
}