using Content.Shared._DV.CosmicCult.Components; using Robust.Shared.Timing; using Content.Shared.Damage; using Robust.Shared.Random; namespace Content.Server._DV.CosmicCult.EntitySystems; /// /// Makes the person with this component take damage over time. /// Used for status effect. /// public sealed partial class CosmicEntropyDegenSystem : EntitySystem { [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly DamageableSystem _damageable = default!; public override void Initialize() { SubscribeLocalEvent(OnInit); } private void OnInit(EntityUid uid, CosmicEntropyDebuffComponent comp, ref ComponentStartup args) { _damageable.TryChangeDamage(uid, comp.Degen, true, false); comp.CheckTimer = _timing.CurTime + comp.CheckWait; } public override void Update(float frameTime) { base.Update(frameTime); var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var component)) { if (_timing.CurTime < component.CheckTimer) continue; component.CheckTimer = _timing.CurTime + component.CheckWait; _damageable.TryChangeDamage(uid, component.Degen, true, false); } } }