LANTERN purge B2: delete EB-2 turret defense

TurretFireSystem, TurretAuthoring, Turret.prefab, Turret component, turret cap,
B hotkey, HUD Charge chip + out-of-ammo cue, catalog entry, Tuning consts, tests
(-7, 452 green). StructureType.Turret byte + ResourceId.Charge stay reserved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 14:40:12 -07:00
parent a0f6d4a5c4
commit 835dace213
15 changed files with 15 additions and 692 deletions
@@ -5,20 +5,19 @@ using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Structure type ids (a byte, not an enum, per the cross-assembly enum-in-Burst hazard). Turret is the
/// first concrete structure; Harvester/Fabricator/Conveyor are RESERVED now (free) for the M7 automation
/// pillar (production chains) so adding them later is purely additive.
/// Structure type ids (a byte, not an enum, per the cross-assembly enum-in-Burst hazard). Ids 1-4 are
/// RETIRED (EB-2 turret defense + M7 automation machines, deleted in the LANTERN purge) and stay reserved
/// so PlacedStructure.Type's [GhostField] serializer + old save bytes never re-mean.
/// </summary>
public static class StructureType
{
public const byte None = 0;
// RETIRED ids — reserved, do not reuse:
public const byte Turret = 1;
// Reserved for M7 automation — do not reuse these codes:
public const byte Harvester = 2;
public const byte Fabricator = 3;
public const byte Conveyor = 4;
// World-pass structural/cosmetic build-out (additive; these byte values keep PlacedStructure.Type's
// [GhostField] serializer identical — no re-bake of existing ghosts). Do NOT reuse 2-4 (M7 automation).
// Live buildables:
public const byte Wall = 5;
public const byte Pylon = 6;
}
@@ -29,10 +28,8 @@ namespace ProjectM.Simulation
/// (a cheap byte for client visual branching); <see cref="Cell"/> is server-only (clients derive it from
/// the replicated LocalTransform via <see cref="BaseGridMath.WorldToCell"/>, so it stays off the wire).
/// <see cref="NextTick"/> / <see cref="LastProcessedTick"/> are server-only raw NetworkTick values
/// (<see cref="TickUtil.NonZero"/>-guarded; 0 = inactive): the Turret reuses <see cref="NextTick"/> as its
/// fire cooldown NOW (not dead weight), and M7 production reuses both as the next-production-tick +
/// deterministic offline catch-up linchpin (produced = floor((now - LastProcessedTick)/period)). These two
/// tick fields are the IDENTITY/TIMING that cannot be reconstructed retroactively, so they are baked now.
/// (<see cref="TickUtil.NonZero"/>-guarded; 0 = inactive), kept for future timed structures (the turret
/// cooldown + production catch-up that used them are retired — LANTERN purge).
/// </summary>
public struct PlacedStructure : IComponentData
{
@@ -42,29 +39,16 @@ namespace ProjectM.Simulation
/// <summary>Occupied grid cell (server-only; clients derive it from LocalTransform).</summary>
public int2 Cell;
/// <summary>Next action tick (server-only; turret cooldown now / next production tick in M7). 0 = inactive.</summary>
/// <summary>Next action tick (server-only). 0 = inactive.</summary>
public uint NextTick;
/// <summary>Last tick this structure was processed (server-only; M7 offline-catch-up baseline). Stamped at spawn.</summary>
/// <summary>Last tick this structure was processed (server-only). Stamped at spawn.</summary>
public uint LastProcessedTick;
}
/// <summary>
/// A buildable defense turret (the first structure). Hitscan: <c>TurretFireSystem</c> applies a direct
/// <c>DamageEvent</c> to the nearest in-range living Husk on cooldown (reusing
/// <see cref="PlacedStructure.NextTick"/>) — reuses HealthApplyDamageSystem, no projectile/friendly-fire.
/// </summary>
public struct Turret : IComponentData
{
public float Range;
public int CooldownTicks;
public float Damage;
}
/// <summary>
/// One row of the build catalog: cost + prefab per structure type. Modeled on AbilityPrefabElement
/// (prefab baked via GetEntity, NEVER inside a blob — blobs don't remap entity refs). M7 adds a recipe
/// column to this element additively (the catalog is baked, not replicated → no format break).
/// (prefab baked via GetEntity, NEVER inside a blob — blobs don't remap entity refs).
/// </summary>
public struct StructureCatalogEntry : IBufferElementData
{
@@ -85,3 +69,4 @@ namespace ProjectM.Simulation
/// </summary>
public struct RuntimePlacedTag : IComponentData { }
}