LANTERN P1 Group B: 5-Spark systems — Aoe/Hitscan dispatch + reel/zone/decoy

Aoe/Hitscan archetype dispatch in AbilityFireSystem (both-worlds cooldown;
server-only ecb.Instantiate — the client-never-instantiates invariant; ZoneEffect
vs DecoyTag chosen by prefab membership). Harpooner REEL as a homing state
(ReelState + ReelSystem re-aim the hit Husk's KnockbackState toward the caster's
live position each tick; EnemyAISystem stays sole Position writer), stamped by
ProjectileDamageSystem on a Reel-flag hit. ZonePulseSystem (enemy-only periodic
AoE, caster attribution, no friendly fire, Vortex pull, born-0 lazy-stamp).
Decoy aggro in EnemyAISystem + DecoySystem despawn. AbilityDefBlob gains
EffectFlags (Reel) + DurationTicks. +3 ZonePulseSystem EditMode tests (497 green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-15 00:00:41 -07:00
parent 8f070ff83c
commit 36950ca21d
24 changed files with 738 additions and 20 deletions
@@ -50,6 +50,8 @@ namespace ProjectM.Authoring
Archetype = (byte)def.Archetype,
AutoTargetConeRadians = math.radians(def.AutoTargetConeDegrees),
CooldownTicks = def.CooldownTicks,
EffectFlags = (byte)(def.Reel ? ProjectileEffectFlag.Reel : (byte)0),
DurationTicks = def.EffectDurationTicks,
Name = def.DisplayName,
};
}
@@ -28,6 +28,11 @@ namespace ProjectM.Authoring
[Header("Timing")]
[Min(1)] public int CooldownTicks = 12;
[Header("Spark effect (LANTERN)")]
[Tooltip("HookPull: home the hit target to the caster (the Harpooner reel).")]
public bool Reel = false;
[Min(0), Tooltip("Aoe/zone + decoy lifetime in ticks (0 = system default).")]
public int EffectDurationTicks = 0;
[Header("Prefab (baked into the prefab buffer, not the blob)")]
public GameObject ProjectilePrefab;
@@ -0,0 +1,31 @@
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Authoring for a decoy-wisp ghost (the LANTERN Aoe/spawn Spark). Bakes an inert <see cref="DecoyTag"/>
/// (lifetime stamped at spawn) plus the damageable set (Health + DamageEvent buffer) so Husks path to and
/// "kill" it — drawing aggro off the players (EnemyAISystem targets DecoyTag entities). NO HitRadius: the
/// decoy is NOT a projectile target, so the caster's own shots pass through it. <c>DecoySystem</c> despawns
/// it on Health &lt;= 0 or lifetime elapse. Ghost setup (interpolated, ownerless) is inherited by duplicating
/// an existing ownerless interpolated ghost, so position replicates via the stock LocalTransform variant.
/// </summary>
public class DecoyAuthoring : MonoBehaviour
{
[Min(1f), Tooltip("Decoy hit points — how much aggro/melee it soaks before popping.")]
public float MaxHealth = 60f;
private class DecoyBaker : Baker<DecoyAuthoring>
{
public override void Bake(DecoyAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent<DecoyTag>(entity); // ExpireTick stamped at spawn by AbilityFireSystem
AddComponent(entity, new Health { Current = authoring.MaxHealth, Max = authoring.MaxHealth });
AddBuffer<DamageEvent>(entity);
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fbd3e612f2e1e0a4abbd5d665943e9f2
@@ -51,6 +51,7 @@ namespace ProjectM.Authoring
});
AddComponent(entity, new EnemyAttackCooldown { NextAttackTick = 0 });
AddComponent<KnockbackState>(entity); // server-only recoil state (zero = not knocked)
AddComponent<ReelState>(entity); // server-only Harpooner-reel homing state (baked inert; stamped on a Reel-flag hit; NOT a GhostField)
AddComponent(entity, new EnemyNavState { LastPos = float.MaxValue }); // server-only anti-stuck nav state (not replicated); sentinel LastPos forces a first-tick reset
AddComponent<AttackWindup>(entity); // replicated telegraph signal (zero = not winding up)
// Slice 1 (Feature C): client-safe baked telegraph metadata. EnemyBaker is the SOLE writer of
@@ -0,0 +1,34 @@
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// Authoring for a player-cast ZONE ghost (Vortex / LightZone — the LANTERN Aoe/zone Sparks). Bakes an inert
/// <see cref="ZoneEffect"/>; the runtime values (caster / radius / damage / lifetime) are stamped at spawn by
/// <c>AbilityFireSystem</c> — only the Vortex FLAG is authored here (so <c>AbilityFireSystem</c> can pick
/// ZoneEffect vs DecoyTag by prefab membership, and the pull behaviour is baked-in). The prefab's ghost setup
/// (GhostAuthoringComponent: interpolated, ownerless) is inherited by DUPLICATING an existing ownerless
/// interpolated ghost, so it replicates to all clients via the stock LocalTransform variant (no hand-written
/// <c>[GhostField]</c>). <c>GetEntity(Dynamic)</c> gives a runtime-mutable LocalTransform for the spawn override.
/// </summary>
public class ZoneAuthoring : MonoBehaviour
{
[Tooltip("Vortex: pull enemies toward the zone centre each tick (in addition to the periodic damage).")]
public bool Vortex = false;
private class ZoneBaker : Baker<ZoneAuthoring>
{
public override void Bake(ZoneAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity, new ZoneEffect
{
Flags = authoring.Vortex ? ZoneEffectFlag.Vortex : (byte)0,
// caster / radius / damage / NextTick / ExpireTick are seeded at spawn by AbilityFireSystem.
});
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 491130dca5b97114cac9f21582092329