]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Action Cooldowns Reset on Rejuvenate (#22149)
authorForestNoises <33579038+ForestNoises@users.noreply.github.com>
Tue, 5 Dec 2023 21:00:02 +0000 (16:00 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Dec 2023 21:00:02 +0000 (16:00 -0500)
* ActionComponents subscribe to RejuvenateEvent, resets cooldowns

* forgo a line

* Update Content.Shared/Actions/SharedActionsSystem.cs

Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>
---------

Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>
Content.Shared/Actions/SharedActionsSystem.cs

index 471e00a57263d9330bbb4d3037bae3db4ce7f80c..675727167e8e7dd5499ee42807fa222c9182ca59 100644 (file)
@@ -15,6 +15,7 @@ using Robust.Shared.GameStates;
 using Robust.Shared.Map;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
+using Content.Shared.Rejuvenate;
 
 namespace Content.Shared.Actions;
 
@@ -38,6 +39,7 @@ public abstract class SharedActionsSystem : EntitySystem
         SubscribeLocalEvent<ActionsComponent, DidEquipHandEvent>(OnHandEquipped);
         SubscribeLocalEvent<ActionsComponent, DidUnequipEvent>(OnDidUnequip);
         SubscribeLocalEvent<ActionsComponent, DidUnequipHandEvent>(OnHandUnequipped);
+        SubscribeLocalEvent<ActionsComponent, RejuvenateEvent>(OnRejuventate);
 
         SubscribeLocalEvent<ActionsComponent, ComponentShutdown>(OnShutdown);
 
@@ -163,6 +165,14 @@ public abstract class SharedActionsSystem : EntitySystem
         Dirty(actionId.Value, action);
     }
 
+    private void OnRejuventate(EntityUid uid, ActionsComponent component, RejuvenateEvent args)
+    {
+        foreach (var act in component.Actions)
+        {
+            ClearCooldown(act);
+        }
+    }
+
     #region ComponentStateManagement
     protected virtual void UpdateAction(EntityUid? actionId, BaseActionComponent? action = null)
     {