From 9c3af67cd1535c3d9060bc74ec14b5c712ed783b Mon Sep 17 00:00:00 2001 From: Winkarst-cpu <74284083+Winkarst-cpu@users.noreply.github.com> Date: Sun, 14 Sep 2025 22:26:42 +0300 Subject: [PATCH] Fix wizard's recharge spell not adding charges to wands that use LimitedChargesComponent (#40347) * Fix * Update --- Content.Shared/Magic/SharedMagicSystem.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Magic/SharedMagicSystem.cs b/Content.Shared/Magic/SharedMagicSystem.cs index 19d649d1f3..6afba65a39 100644 --- a/Content.Shared/Magic/SharedMagicSystem.cs +++ b/Content.Shared/Magic/SharedMagicSystem.cs @@ -1,6 +1,8 @@ using System.Numerics; using Content.Shared.Body.Components; using Content.Shared.Body.Systems; +using Content.Shared.Charges.Components; +using Content.Shared.Charges.Systems; using Content.Shared.Coordinates.Helpers; using Content.Shared.Doors.Components; using Content.Shared.Doors.Systems; @@ -63,6 +65,7 @@ public abstract class SharedMagicSystem : EntitySystem [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly SharedStunSystem _stun = default!; [Dependency] private readonly TurfSystem _turf = default!; + [Dependency] private readonly SharedChargesSystem _charges = default!; private static readonly ProtoId InvalidForGlobalSpawnSpellTag = "InvalidForGlobalSpawnSpell"; @@ -444,10 +447,13 @@ public abstract class SharedMagicSystem : EntitySystem ev.Handled = true; - if (wand == null || !TryComp(wand, out var basicAmmoComp) || basicAmmoComp.Count == null) + if (wand == null) return; - _gunSystem.UpdateBasicEntityAmmoCount(wand.Value, basicAmmoComp.Count.Value + ev.Charge, basicAmmoComp); + if (TryComp(wand, out var basicAmmoComp) && basicAmmoComp.Count != null) + _gunSystem.UpdateBasicEntityAmmoCount(wand.Value, basicAmmoComp.Count.Value + ev.Charge, basicAmmoComp); + else if (TryComp(wand, out var charges)) + _charges.AddCharges((wand.Value, charges), ev.Charge); } // End Charge Spells #endregion -- 2.51.2