Fix cuff layer spam (#14869)

This commit is contained in:
metalgearsloth
2023-03-27 00:15:32 +11:00
committed by GitHub
parent f32a922c11
commit 2dfdf73aa6
2 changed files with 11 additions and 12 deletions

View 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)