// Access/Prying
SubscribeLocalEvent<FirelockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
+ SubscribeLocalEvent<FirelockComponent, BeforePryEvent>(OnBeforePry);
SubscribeLocalEvent<FirelockComponent, GetPryTimeModifierEvent>(OnDoorGetPryTimeModifier);
SubscribeLocalEvent<FirelockComponent, PriedEvent>(OnAfterPried);
WarnPlayer((uid, component), args.User.Value);
}
+ private void OnBeforePry(EntityUid uid, FirelockComponent component, ref BeforePryEvent args)
+ {
+ if (args.Cancelled || !component.Powered || args.StrongPry || args.PryPowered)
+ return;
+
+ args.Cancelled = true;
+ }
+
private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args)
{
WarnPlayer((uid, component), args.User);
/// Cancel to stop the entity from being pried open.
/// </summary>
[ByRefEvent]
-public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force)
+public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, bool StrongPry)
{
public readonly EntityUid User = User;
+ /// <summary>
+ /// Whether prying should be allowed even if whatever is being pried is powered.
+ /// </summary>
public readonly bool PryPowered = PryPowered;
+ /// <summary>
+ /// Whether prying should be allowed to go through under most circumstances. (E.g. airlock is bolted).
+ /// Systems may still wish to ignore this occasionally.
+ /// </summary>
public readonly bool Force = Force;
+ /// <summary>
+ /// Whether anything other than bare hands were used. This should only be false if prying is being performed without a prying comp.
+ /// </summary>
+ public readonly bool StrongPry = StrongPry;
+
public string? Message;
public bool Cancelled;
if (comp != null || Resolve(user, ref comp, false))
{
- canev = new BeforePryEvent(user, comp.PryPowered, comp.Force);
+ canev = new BeforePryEvent(user, comp.PryPowered, comp.Force, true);
}
else
{
return false;
}
- canev = new BeforePryEvent(user, false, false);
+ canev = new BeforePryEvent(user, false, false, false);
}
RaiseLocalEvent(target, ref canev);