mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* MutedStatusEffects * Update species_base.yml * System * refactor * yml fix * fix component * review * fix yml * Update disabilities.yml * StatusEffectMuted -> TraitStatusEffectMuted * Update misc.yml * merge * RemoveStatusEffect * more review * cleanup * merge * oops * Send it --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
30 lines
963 B
C#
30 lines
963 B
C#
using Content.Shared.StatusEffectNew.Components;
|
|
|
|
namespace Content.Shared.StatusEffectNew;
|
|
|
|
/// <summary>
|
|
/// Keeps permanent status effects from <see cref="PermanentStatusEffectsComponent"/> applied
|
|
/// for as long as the owning component exists.
|
|
/// </summary>
|
|
public sealed partial class PermanentStatusEffectsSystem : EntitySystem
|
|
{
|
|
[Dependency] private StatusEffectsSystem _statusEffects = default!;
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnMapInit(Entity<PermanentStatusEffectsComponent> ent, ref MapInitEvent args)
|
|
{
|
|
foreach (var effect in ent.Comp.StatusEffects)
|
|
{
|
|
_statusEffects.TrySetStatusEffectDuration(ent, effect);
|
|
}
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnRemove(Entity<PermanentStatusEffectsComponent> ent, ref ComponentRemove args)
|
|
{
|
|
foreach (var effect in ent.Comp.StatusEffects)
|
|
{
|
|
_statusEffects.TryRemoveStatusEffect(ent, effect);
|
|
}
|
|
}
|
|
}
|