2021-02-06 03:11:21 +11:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using Content.Shared.GameObjects.Components.ActionBlocking;
|
2020-08-25 08:54:23 -04:00
|
|
|
|
using Robust.Client.GameObjects;
|
2020-09-13 14:23:52 +02:00
|
|
|
|
using Robust.Client.Graphics;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-08-25 08:54:23 -04:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.GameObjects.Components.ActionBlocking
|
|
|
|
|
|
{
|
|
|
|
|
|
[RegisterComponent]
|
2021-02-06 03:11:21 +11:00
|
|
|
|
[ComponentReference(typeof(SharedHandcuffComponent))]
|
2020-08-25 08:54:23 -04:00
|
|
|
|
public class HandcuffComponent : SharedHandcuffComponent
|
|
|
|
|
|
{
|
2021-02-06 03:11:21 +11:00
|
|
|
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
2020-08-25 08:54:23 -04:00
|
|
|
|
{
|
2020-11-26 14:33:31 +01:00
|
|
|
|
if (curState is not HandcuffedComponentState state)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-08-25 08:54:23 -04:00
|
|
|
|
|
2020-11-26 14:33:31 +01:00
|
|
|
|
if (state.IconState == string.Empty)
|
2020-08-25 08:54:23 -04:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
|
|
|
|
|
{
|
2020-11-26 14:33:31 +01:00
|
|
|
|
sprite.LayerSetState(0, new RSI.StateId(state.IconState)); // TODO: safety check to see if RSI contains the state?
|
2020-08-25 08:54:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|