Files
Delta-v/Content.Server/_DV/CosmicCult/EntitySystems/CosmicEntropyDegenSystem.cs
T
BarryNorfolk bf8cce52a1 Remove warnings in Content.Server for _DV content (#5114)
* Cleanup datafields with matching autogenerated tag [RA0027]

* Remove unused dependencies [CS0414]

* Swap to AddMarkupOrThrow over PushMarkup [CS0618]

* Fix namespacing [CA1050]

* Prefer the generic overload [CA2263]

* Fix exception throwing [CA2208]

* Mark RoundStartCaptain as static [CA1822]

* Don't use string literal [RA0033]

* Remove un-needed null check [CS8073]

* Explicitly set webhookData to null [CS0649]

* Use protoId over bare string

* Prefer HasComp over TryComp with no usage of the actual comp
2026-01-06 10:31:51 -06:00

42 lines
1.4 KiB
C#

using Content.Shared._DV.CosmicCult.Components;
using Robust.Shared.Timing;
using Content.Shared.Damage.Systems;
using Robust.Shared.Random;
namespace Content.Server._DV.CosmicCult.EntitySystems;
/// <summary>
/// Makes the person with this component take damage over time.
/// Used for status effect.
/// </summary>
public sealed partial class CosmicEntropyDegenSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
public override void Initialize()
{
SubscribeLocalEvent<CosmicEntropyDebuffComponent, ComponentStartup>(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<CosmicEntropyDebuffComponent>();
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);
}
}
}