Migrate cuffing to an uncuff attempt event and allow self-uncuff again (#4725)

* Migrate cuffing to an uncuff attempt event and allow self-uncuff again

* Uncuff attempt event: Use more SubscribeLocalEvent and Dependency attributes
This commit is contained in:
20kdc
2021-10-01 23:17:36 +01:00
committed by GitHub
parent 852785e73e
commit 77c5e7a5ed
2 changed files with 73 additions and 4 deletions

View File

@@ -206,10 +206,11 @@ namespace Content.Server.Cuffs.Components
return;
}
// TODO: Make into an event and instead have a system check for owner.
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
var attempt = new UncuffAttemptEvent(user.Uid, Owner.Uid);
Owner.EntityManager.EventBus.RaiseLocalEvent(user.Uid, attempt);
if (attempt.Cancelled)
{
user.PopupMessage(Loc.GetString("cuffable-component-cannot-interact-message"));
return;
}