36950ca21d
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>
46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using ProjectM.Simulation;
|
|
using Unity.Burst;
|
|
using Unity.Collections;
|
|
using Unity.Entities;
|
|
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Server
|
|
{
|
|
/// <summary>
|
|
/// SERVER-ONLY decoy-wisp lifecycle: despawns a decoy ghost when its Health is spent (Husks "killed" it) or
|
|
/// its <see cref="DecoyTag.ExpireTick"/> lifetime elapses. Server-authoritative ghost despawn (the client's
|
|
/// copy is removed by GhostSendSystem — never DestroyEntity a ghost client-side). The decoy draws aggro via
|
|
/// <c>EnemyAISystem</c>'s decoy target set; this system only ends its life. Presence-gated on DecoyTag.
|
|
/// </summary>
|
|
[BurstCompile]
|
|
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]
|
|
[UpdateInGroup(typeof(SimulationSystemGroup))]
|
|
public partial struct DecoySystem : ISystem
|
|
{
|
|
[BurstCompile]
|
|
public void OnCreate(ref SystemState state)
|
|
{
|
|
state.RequireForUpdate<NetworkTime>();
|
|
state.RequireForUpdate<DecoyTag>();
|
|
}
|
|
|
|
[BurstCompile]
|
|
public void OnUpdate(ref SystemState state)
|
|
{
|
|
var serverTick = SystemAPI.GetSingleton<NetworkTime>().ServerTick;
|
|
if (!serverTick.IsValid) return;
|
|
var ecb = new EntityCommandBuffer(Allocator.Temp);
|
|
foreach (var (decoy, hp, e) in
|
|
SystemAPI.Query<RefRO<DecoyTag>, RefRO<Health>>().WithEntityAccess())
|
|
{
|
|
bool expired = decoy.ValueRO.ExpireTick != 0u
|
|
&& !new NetworkTick(decoy.ValueRO.ExpireTick).IsNewerThan(serverTick);
|
|
if (hp.ValueRO.Current <= 0f || expired)
|
|
ecb.DestroyEntity(e);
|
|
}
|
|
ecb.Playback(state.EntityManager);
|
|
ecb.Dispose();
|
|
}
|
|
}
|
|
}
|