]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix wizard's recharge spell not adding charges to wands that use LimitedChargesCompon...
authorWinkarst-cpu <74284083+Winkarst-cpu@users.noreply.github.com>
Sun, 14 Sep 2025 19:26:42 +0000 (22:26 +0300)
committerGitHub <noreply@github.com>
Sun, 14 Sep 2025 19:26:42 +0000 (21:26 +0200)
* Fix

* Update

Content.Shared/Magic/SharedMagicSystem.cs

index 19d649d1f3128572c3e6cb81c1ce2eabed880c4b..6afba65a39963a5d4eaaf26460416b038045e008 100644 (file)
@@ -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<TagPrototype> InvalidForGlobalSpawnSpellTag = "InvalidForGlobalSpawnSpell";
 
@@ -444,10 +447,13 @@ public abstract class SharedMagicSystem : EntitySystem
 
         ev.Handled = true;
 
-        if (wand == null || !TryComp<BasicEntityAmmoProviderComponent>(wand, out var basicAmmoComp) || basicAmmoComp.Count == null)
+        if (wand == null)
             return;
 
-        _gunSystem.UpdateBasicEntityAmmoCount(wand.Value, basicAmmoComp.Count.Value + ev.Charge, basicAmmoComp);
+        if (TryComp<BasicEntityAmmoProviderComponent>(wand, out var basicAmmoComp) && basicAmmoComp.Count != null)
+            _gunSystem.UpdateBasicEntityAmmoCount(wand.Value, basicAmmoComp.Count.Value + ev.Charge, basicAmmoComp);
+        else if (TryComp<LimitedChargesComponent>(wand, out var charges))
+            _charges.AddCharges((wand.Value, charges), ev.Charge);
     }
     // End Charge Spells
     #endregion