Files
tbd-station-14/Content.Shared/Trigger/Systems/UncuffOnTriggerSystem.cs
Princess Cheeseballs 04b71d8203 Make CuffableComponent and CuffableSystem not Crash (Hopefully) (#39123)
* This system is ancient

* Destroy that API

* Address reviews

* Destroy merge conflicts from orbit

* seems to work fine

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2025-11-01 13:22:13 +00:00

20 lines
680 B
C#

using Content.Shared.Cuffs;
using Content.Shared.Cuffs.Components;
using Content.Shared.Trigger.Components.Effects;
namespace Content.Shared.Trigger.Systems;
public sealed class UncuffOnTriggerSystem : XOnTriggerSystem<UncuffOnTriggerComponent>
{
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
protected override void OnTrigger(Entity<UncuffOnTriggerComponent> ent, EntityUid target, ref TriggerEvent args)
{
if (!TryComp<CuffableComponent>(target, out var cuffs) || !_cuffable.TryGetLastCuff(target, out var cuff))
return;
_cuffable.Uncuff(target, args.User, cuff.Value);
args.Handled = true;
}
}