diff --git a/Content.Server/Administration/Systems/SuperBonkSystem.cs b/Content.Server/Administration/Systems/SuperBonkSystem.cs index 9f6a7666f2d1..b120e8be8249 100644 --- a/Content.Server/Administration/Systems/SuperBonkSystem.cs +++ b/Content.Server/Administration/Systems/SuperBonkSystem.cs @@ -15,8 +15,6 @@ public sealed class SuperBonkSystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audioSystem = default!; [Dependency] private readonly IGameTiming _timing = default!; - private readonly HashSet _toRemove = []; - public override void Initialize() { base.Initialize(); @@ -38,7 +36,7 @@ private void OnMobStateChanged(Entity ent, ref MobStateChang var (uid, component) = ent; if (component.StopWhenDead && args.NewMobState == MobState.Dead) - _toRemove.Add(uid); + RemCompDeferred(uid); } private void OnShutdown(Entity ent, ref ComponentShutdown args) @@ -67,13 +65,6 @@ public override void Update(float frameTime) comp.NextBonk += comp.BonkCooldown; } - - foreach (var uid in _toRemove) - { - RemComp(uid); - } - - _toRemove.Clear(); } public void StartSuperBonk(EntityUid target, bool stopWhenDead = false)