Fix cuff layer spam (#14869)
This commit is contained in:
@@ -15,17 +15,11 @@ public sealed class CuffableSystem : SharedCuffableSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<CuffableComponent, ComponentShutdown>(OnShutdown);
|
SubscribeLocalEvent<CuffableComponent, ComponentShutdown>(OnCuffableShutdown);
|
||||||
SubscribeLocalEvent<CuffableComponent, ComponentHandleState>(OnCuffableHandleState);
|
SubscribeLocalEvent<CuffableComponent, ComponentHandleState>(OnCuffableHandleState);
|
||||||
SubscribeLocalEvent<HandcuffComponent, ComponentHandleState>(OnHandcuffHandleState);
|
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)
|
private void OnHandcuffHandleState(EntityUid uid, HandcuffComponent component, ref ComponentHandleState args)
|
||||||
{
|
{
|
||||||
if (args.Current is not HandcuffComponentState state)
|
if (args.Current is not HandcuffComponentState state)
|
||||||
@@ -38,10 +32,17 @@ public sealed class CuffableSystem : SharedCuffableSystem
|
|||||||
|
|
||||||
if (TryComp<SpriteComponent>(uid, out var sprite))
|
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)
|
private void OnCuffableHandleState(EntityUid uid, CuffableComponent component, ref ComponentHandleState args)
|
||||||
{
|
{
|
||||||
if (args.Current is not CuffableComponentState cuffState)
|
if (args.Current is not CuffableComponentState cuffState)
|
||||||
|
|||||||
@@ -28,18 +28,16 @@ using Content.Shared.Weapons.Melee.Events;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Shared.Cuffs
|
namespace Content.Shared.Cuffs
|
||||||
{
|
{
|
||||||
public abstract class SharedCuffableSystem : EntitySystem
|
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 IComponentFactory _componentFactory = default!;
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
|
||||||
[Dependency] private readonly INetManager _net = default!;
|
[Dependency] private readonly INetManager _net = default!;
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLog = 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 MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
|||||||
Reference in New Issue
Block a user