Fix SCRAM implant not working while cuffed. Incidentally fix freedom implant working while dead/crit (#25978)
* Fix SCRAM implant not being usable while in cuffs. Also fix freedom implant from working while dead/crit as a side effect * Move check up to apply to all actions and do thing I forgor to do before * Change check into an ActionBlocker check that also checks whether the user is sleeping. * Make checking for Consciousness the default for actions Went through and chose what I believe to be sensible defaults for actions that had CheckCanInteract. * Fix typos my beloved I had an unbelievable skill issue * Fix major skill issue
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Shared.Body.Events;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Emoting;
|
||||
@@ -5,6 +6,8 @@ using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Speech;
|
||||
@@ -67,6 +70,9 @@ namespace Content.Shared.ActionBlocker
|
||||
/// <returns></returns>
|
||||
public bool CanInteract(EntityUid user, EntityUid? target)
|
||||
{
|
||||
if (!CanConsciouslyPerformAction(user))
|
||||
return false;
|
||||
|
||||
var ev = new InteractionAttemptEvent(user, target);
|
||||
RaiseLocalEvent(user, ev);
|
||||
|
||||
@@ -98,6 +104,21 @@ namespace Content.Shared.ActionBlocker
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Whether a user conscious to perform an action.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should be used when you want a much more permissive check than <see cref="CanInteract"/>
|
||||
/// </remarks>
|
||||
public bool CanConsciouslyPerformAction(EntityUid user)
|
||||
{
|
||||
var ev = new ConsciousAttemptEvent(user);
|
||||
RaiseLocalEvent(user, ev);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanThrow(EntityUid user, EntityUid itemUid)
|
||||
{
|
||||
var ev = new ThrowAttemptEvent(user, itemUid);
|
||||
|
||||
Reference in New Issue
Block a user