]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix cuff layer spam (#14869)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 26 Mar 2023 13:15:32 +0000 (00:15 +1100)
committerGitHub <noreply@github.com>
Sun, 26 Mar 2023 13:15:32 +0000 (08:15 -0500)
Content.Client/Cuffs/CuffableSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs

index 1109d3785f417f429cd802f2f2a47697d8eae2bf..76d9ce163982591b190b353f89c960f194ec3f52 100644 (file)
@@ -15,17 +15,11 @@ public sealed class CuffableSystem : SharedCuffableSystem
     {
         base.Initialize();
 
-        SubscribeLocalEvent<CuffableComponent, ComponentShutdown>(OnShutdown);
+        SubscribeLocalEvent<CuffableComponent, ComponentShutdown>(OnCuffableShutdown);
         SubscribeLocalEvent<CuffableComponent, ComponentHandleState>(OnCuffableHandleState);
         SubscribeLocalEvent<HandcuffComponent, ComponentHandleState>(OnHandcuffHandleState);
     }
 
-    private void OnShutdown(EntityUid uid, CuffableComponent component, ComponentShutdown args)
-    {
-        if (TryComp<SpriteComponent>(uid, out var sprite))
-            sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, false);
-    }
-
     private void OnHandcuffHandleState(EntityUid uid, HandcuffComponent component, ref ComponentHandleState args)
     {
         if (args.Current is not HandcuffComponentState state)
@@ -38,10 +32,17 @@ public sealed class CuffableSystem : SharedCuffableSystem
 
         if (TryComp<SpriteComponent>(uid, out var sprite))
         {
-            sprite.LayerSetState(HumanoidVisualLayers.Handcuffs, state.IconState);
+            // If you think this should be an explicit layer look at the YML and see https://github.com/space-wizards/space-station-14/issues/14771
+            sprite.LayerSetState(0, state.IconState);
         }
     }
 
+    private void OnCuffableShutdown(EntityUid uid, CuffableComponent component, ComponentShutdown args)
+    {
+        if (TryComp<SpriteComponent>(uid, out var sprite))
+            sprite.LayerSetVisible(HumanoidVisualLayers.Handcuffs, false);
+    }
+
     private void OnCuffableHandleState(EntityUid uid, CuffableComponent component, ref ComponentHandleState args)
     {
         if (args.Current is not CuffableComponentState cuffState)
index da67a118e381e13e115e2f17acde7189672fda22..2cf87ea96c63d21d19fe93466e3f8b1fceef7a74 100644 (file)
@@ -28,18 +28,16 @@ using Content.Shared.Weapons.Melee.Events;
 using Robust.Shared.Containers;
 using Robust.Shared.Network;
 using Robust.Shared.Player;
-using Robust.Shared.Timing;
 
 namespace Content.Shared.Cuffs
 {
     public abstract class SharedCuffableSystem : EntitySystem
     {
-        [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
-        [Dependency] private readonly AlertsSystem _alerts = default!;
         [Dependency] private readonly IComponentFactory _componentFactory = default!;
-        [Dependency] private readonly IGameTiming _timing = default!;
         [Dependency] private readonly INetManager _net = default!;
         [Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
+        [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
+        [Dependency] private readonly AlertsSystem _alerts = default!;
         [Dependency] private readonly MobStateSystem _mobState = default!;
         [Dependency] private readonly SharedAudioSystem _audio = default!;
         [Dependency] private readonly SharedContainerSystem _container = default!;