* Movement acceleration * tweaks * Weightless refactor coz fuck it * CCVars * weightless movement tweaks * Some cleanup while I'm here * dorkpacks * thanks fork * fixes * zoomies * toggles * hmm * yamls * b * so true * Effects refactor * namespace * review
29 lines
731 B
C#
29 lines
731 B
C#
using Content.Shared.Spawners.Components;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Spawners.EntitySystems;
|
|
|
|
public abstract class SharedTimedDespawnSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
if (!_timing.IsFirstTimePredicted) return;
|
|
|
|
foreach (var comp in EntityQuery<TimedDespawnComponent>())
|
|
{
|
|
if (!CanDelete(comp.Owner)) continue;
|
|
|
|
comp.Lifetime -= frameTime;
|
|
|
|
if (comp.Lifetime <= 0)
|
|
EntityManager.QueueDeleteEntity(comp.Owner);
|
|
}
|
|
}
|
|
|
|
protected abstract bool CanDelete(EntityUid uid);
|
|
}
|