From 38f080547eb2a5659c9c2dc404f1d55874968017 Mon Sep 17 00:00:00 2001 From: nikthechampiongr Date: Wed, 19 Jun 2024 22:59:44 +0300 Subject: [PATCH 1/4] Firelocks are no longer pryable by hand if they are powered --- .../Doors/Systems/SharedFirelockSystem.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs index 03350d2e6444..6811545434ee 100644 --- a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs @@ -21,6 +21,7 @@ public override void Initialize() // Access/Prying SubscribeLocalEvent(OnBeforeDoorOpened); + SubscribeLocalEvent(OnBeforePry); SubscribeLocalEvent(OnDoorGetPryTimeModifier); SubscribeLocalEvent(OnAfterPried); @@ -60,6 +61,18 @@ private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, Befo WarnPlayer((uid, component), args.User.Value); } + private void OnBeforePry(EntityUid uid, FirelockComponent component, ref BeforePryEvent args) + { + if (args.Cancelled) + return; + + if (!component.Powered || args.PryPowered) + return; + + args.Cancelled = true; + + } + private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args) { WarnPlayer((uid, component), args.User); From 7cd89f915f757fadf306c83f0717ed5241ba8133 Mon Sep 17 00:00:00 2001 From: nikthechampiongr Date: Wed, 19 Jun 2024 23:29:18 +0300 Subject: [PATCH 2/4] Make firelocks still pry when powered with a crowbar --- .../Doors/Systems/SharedFirelockSystem.cs | 2 +- .../Prying/Components/PryingComponent.cs | 14 +++++++++++++- Content.Shared/Prying/Systems/PryingSystem.cs | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs index 6811545434ee..a2a2b01ee536 100644 --- a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs @@ -66,7 +66,7 @@ private void OnBeforePry(EntityUid uid, FirelockComponent component, ref BeforeP if (args.Cancelled) return; - if (!component.Powered || args.PryPowered) + if (!component.Powered || args.ToolUsed || args.PryPowered) return; args.Cancelled = true; diff --git a/Content.Shared/Prying/Components/PryingComponent.cs b/Content.Shared/Prying/Components/PryingComponent.cs index 7a7f304d8f83..e80ac6cd208e 100644 --- a/Content.Shared/Prying/Components/PryingComponent.cs +++ b/Content.Shared/Prying/Components/PryingComponent.cs @@ -43,14 +43,26 @@ public sealed partial class PryingComponent : Component /// Cancel to stop the entity from being pried open. /// [ByRefEvent] -public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force) +public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, bool ToolUsed) { public readonly EntityUid User = User; + /// + /// Whether prying should be allowed even if whatever is being pried is powered. + /// public readonly bool PryPowered = PryPowered; + /// + /// Whether prying should be allowed to go through under most circumstances. (E.g. airlock is bolted). + /// Systems may still wish to ignore this occasionally. + /// public readonly bool Force = Force; + /// + /// Whether a tool was used to pry the door or not. + /// + public readonly bool ToolUsed = ToolUsed; + public string? Message; public bool Cancelled; diff --git a/Content.Shared/Prying/Systems/PryingSystem.cs b/Content.Shared/Prying/Systems/PryingSystem.cs index 372c89c9ae09..518d9b117b3e 100644 --- a/Content.Shared/Prying/Systems/PryingSystem.cs +++ b/Content.Shared/Prying/Systems/PryingSystem.cs @@ -109,7 +109,7 @@ private bool CanPry(EntityUid target, EntityUid user, out string? message, Pryin 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 { @@ -119,7 +119,7 @@ private bool CanPry(EntityUid target, EntityUid user, out string? message, Pryin return false; } - canev = new BeforePryEvent(user, false, false); + canev = new BeforePryEvent(user, false, false, false); } RaiseLocalEvent(target, ref canev); From f5f1f24ce3b8f3a957b3c1850a06356aab0a31c2 Mon Sep 17 00:00:00 2001 From: nikthechampiongr Date: Thu, 20 Jun 2024 17:58:21 +0300 Subject: [PATCH 3/4] Fix name --- Content.Shared/Doors/Systems/SharedFirelockSystem.cs | 2 +- Content.Shared/Prying/Components/PryingComponent.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs index a2a2b01ee536..7f180c3d10e0 100644 --- a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs @@ -66,7 +66,7 @@ private void OnBeforePry(EntityUid uid, FirelockComponent component, ref BeforeP if (args.Cancelled) return; - if (!component.Powered || args.ToolUsed || args.PryPowered) + if (!component.Powered || args.StrongPry || args.PryPowered) return; args.Cancelled = true; diff --git a/Content.Shared/Prying/Components/PryingComponent.cs b/Content.Shared/Prying/Components/PryingComponent.cs index e80ac6cd208e..d075f3cc7ae3 100644 --- a/Content.Shared/Prying/Components/PryingComponent.cs +++ b/Content.Shared/Prying/Components/PryingComponent.cs @@ -43,7 +43,7 @@ public sealed partial class PryingComponent : Component /// Cancel to stop the entity from being pried open. /// [ByRefEvent] -public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, bool ToolUsed) +public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, bool StrongPry) { public readonly EntityUid User = User; @@ -59,9 +59,9 @@ public record struct BeforePryEvent(EntityUid User, bool PryPowered, bool Force, public readonly bool Force = Force; /// - /// Whether a tool was used to pry the door or not. + /// Whether anything other than bare hands were used. This should only be false if prying is being performed without a prying comp. /// - public readonly bool ToolUsed = ToolUsed; + public readonly bool StrongPry = StrongPry; public string? Message; From e68f2479ca8fcca5ffa5886bba9a8516877c1dfb Mon Sep 17 00:00:00 2001 From: nikthechampiongr Date: Sat, 22 Jun 2024 13:09:03 +0300 Subject: [PATCH 4/4] Fix nitpick --- Content.Shared/Doors/Systems/SharedFirelockSystem.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs index 7f180c3d10e0..e613848c5c74 100644 --- a/Content.Shared/Doors/Systems/SharedFirelockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedFirelockSystem.cs @@ -63,14 +63,10 @@ private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, Befo private void OnBeforePry(EntityUid uid, FirelockComponent component, ref BeforePryEvent args) { - if (args.Cancelled) - return; - - if (!component.Powered || args.StrongPry || args.PryPowered) + if (args.Cancelled || !component.Powered || args.StrongPry || args.PryPowered) return; args.Cancelled = true; - } private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args)