forked from space-syndicate/space-station-14
Rejuvenating Resets Item Charges (#41165)
* 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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user