From b9fad6cbd4fa368b809bb024c32a24cdccffb31a Mon Sep 17 00:00:00 2001 From: Link <131011403+LinkF2kkk@users.noreply.github.com> Date: Fri, 28 Mar 2025 11:10:42 +0300 Subject: [PATCH] Mana no longer regenerates after death (#1027) * Update CP14MagicEnergySystem.Draw.cs * :nerd: * Update CP14MagicEnergySystem.Draw.cs * Update CP14MagicEnergySystem.Draw.cs * oops... --------- Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> --- .../_CP14/MagicEnergy/CP14MagicEnergySystem.Draw.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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;