diff --git a/Content.Server/_CP14/MagicEnergy/CP14MagicEnergySystem.Draw.cs b/Content.Server/_CP14/MagicEnergy/CP14MagicEnergySystem.Draw.cs index f04aab9784..6d69512801 100644 --- a/Content.Server/_CP14/MagicEnergy/CP14MagicEnergySystem.Draw.cs +++ b/Content.Server/_CP14/MagicEnergy/CP14MagicEnergySystem.Draw.cs @@ -1,12 +1,16 @@ using Content.Server._CP14.MagicEnergy.Components; using Content.Shared._CP14.MagicEnergy.Components; using Content.Shared.Damage; +using Content.Shared.Mobs.Components; +using Content.Shared.Mobs.Systems; using Robust.Shared.Map.Components; namespace Content.Server._CP14.MagicEnergy; public partial class CP14MagicEnergySystem { + [Dependency] private readonly MobStateSystem _mobState = default!; + private void InitializeDraw() { SubscribeLocalEvent(OnDrawMapInit); @@ -52,6 +56,9 @@ public partial class CP14MagicEnergySystem if (draw.NextUpdateTime >= _gameTiming.CurTime) continue; + if (TryComp(uid, out var mobState) && !_mobState.IsAlive(uid, mobState)) + continue; + draw.NextUpdateTime = _gameTiming.CurTime + TimeSpan.FromSeconds(draw.Delay); ChangeEnergy(uid, draw.Energy, out _, out _, magicContainer, draw.Safe); @@ -63,6 +70,9 @@ public partial class CP14MagicEnergySystem if (draw.NextUpdateTime >= _gameTiming.CurTime) continue; + if (TryComp(uid, out var mobState) && !_mobState.IsAlive(uid, mobState)) + continue; + draw.NextUpdateTime = _gameTiming.CurTime + TimeSpan.FromSeconds(draw.Delay); var daylight = false;