]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Rejuvenating Resets Item Charges (#41165)
authorJustin Pfeifler <jrpl101998@gmail.com>
Thu, 30 Oct 2025 03:17:13 +0000 (22:17 -0500)
committerGitHub <noreply@github.com>
Thu, 30 Oct 2025 03:17:13 +0000 (03:17 +0000)
* Add check for child entities with charges

* Add reset charges on rejuvenate

* Revert "Add check for child entities with charges"

This reverts commit f55fd69da78ed3240e3b5349c854542516e2d1e1.

* Revert "Add reset charges on rejuvenate"

This reverts commit ee4221cd87c766d11f6f2a88b72b9de439a26e0a.

* Add Reset Charges on Rejuvenate

* Apply suggestions from code review

* oops I broke it

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Shared/Charges/Systems/SharedChargesSystem.cs

index 504648c41d684fed2ae1b98b0d9c36fa32a1f220..a48fbaaa8d184e54610f9fc45bd34a9bbe9f5373 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Actions.Events;
 using Content.Shared.Charges.Components;
 using Content.Shared.Examine;
+using Content.Shared.Rejuvenate;
 using JetBrains.Annotations;
 using Robust.Shared.Timing;
 
@@ -19,7 +20,7 @@ public abstract class SharedChargesSystem : EntitySystem
         base.Initialize();
 
         SubscribeLocalEvent<LimitedChargesComponent, ExaminedEvent>(OnExamine);
-
+        SubscribeLocalEvent<LimitedChargesComponent, RejuvenateEvent>(OnRejuvenate);
         SubscribeLocalEvent<LimitedChargesComponent, ActionAttemptEvent>(OnChargesAttempt);
         SubscribeLocalEvent<LimitedChargesComponent, MapInitEvent>(OnChargesMapInit);
         SubscribeLocalEvent<LimitedChargesComponent, ActionPerformedEvent>(OnChargesPerformed);
@@ -48,6 +49,11 @@ public abstract class SharedChargesSystem : EntitySystem
         args.PushMarkup(Loc.GetString("limited-charges-recharging", ("seconds", timeRemaining.TotalSeconds.ToString("F1"))));
     }
 
+    private void OnRejuvenate(Entity<LimitedChargesComponent> ent, ref RejuvenateEvent args)
+    {
+        ResetCharges(ent.AsNullable());
+    }
+
     private void OnChargesAttempt(Entity<LimitedChargesComponent> ent, ref ActionAttemptEvent args)
     {
         if (args.Cancelled)