Files
wwdpublic/Content.Server/_Shitmed/Body/Organ/StatusEffectOrganSystem.cs
gluesniffler 2a33691a1c Ports Shitmed Updates From Goob (#1387)
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster

# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.

(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
2025-01-13 23:01:51 +03:00

34 lines
1.1 KiB
C#

using Content.Shared.Body.Organ;
using Content.Shared.StatusEffect;
using Robust.Shared.Timing;
namespace Content.Server._Shitmed.Body.Organ;
public sealed class StatusEffectOrganSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly StatusEffectsSystem _effects = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<StatusEffectOrganComponent, OrganComponent>();
var now = _timing.CurTime;
while (query.MoveNext(out var uid, out var comp, out var organ))
{
if (now < comp.NextUpdate || organ.Body is not {} body)
continue;
comp.NextUpdate = now + comp.Delay;
if (!TryComp<StatusEffectsComponent>(body, out var effects))
continue;
foreach (var (key, component) in comp.Refresh)
{
_effects.TryAddStatusEffect(body, key, comp.Delay, refresh: true, component, effects);
}
}
}
}