diff --git a/Content.Shared/StatusEffect/StatusEffectsComponent.cs b/Content.Shared/StatusEffect/StatusEffectsComponent.cs index 8dd3ef7813..c95e57f85d 100644 --- a/Content.Shared/StatusEffect/StatusEffectsComponent.cs +++ b/Content.Shared/StatusEffect/StatusEffectsComponent.cs @@ -24,6 +24,9 @@ namespace Content.Shared.StatusEffect public List AllowedEffects = default!; } + [RegisterComponent] + public sealed class ActiveStatusEffectsComponent : Component {} + /// /// Holds information about an active status effect. /// diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index 469f04eb9f..40019a8926 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -32,9 +32,8 @@ namespace Content.Shared.StatusEffect base.Update(frameTime); var curTime = _gameTiming.CurTime; - foreach (var status in EntityManager.EntityQuery(false)) + foreach (var (_, status) in EntityManager.EntityQuery()) { - if (status.ActiveEffects.Count == 0) continue; foreach (var state in status.ActiveEffects.ToArray()) { // if we're past the end point of the effect @@ -190,6 +189,7 @@ namespace Content.Shared.StatusEffect else { status.ActiveEffects.Add(key, new StatusEffectState(cooldown, refresh, null)); + EnsureComp(uid); } if (proto.Alert != null) @@ -271,6 +271,10 @@ namespace Content.Shared.StatusEffect } status.ActiveEffects.Remove(key); + if (status.ActiveEffects.Count == 0) + { + RemComp(uid); + } Dirty(status); // event?