From 4abd793ef96088fc80add454326badf09c0645be Mon Sep 17 00:00:00 2001 From: "A.Ne." <138010940+comasqw@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:16:00 +0400 Subject: [PATCH] lockkey system tweak (#601) * lockkey system tweak * Update SharedCP14LockKeySystem.cs --------- Co-authored-by: Ed --- Content.Shared/_CP14/LockKey/SharedCP14LockKeySystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Content.Shared/_CP14/LockKey/SharedCP14LockKeySystem.cs b/Content.Shared/_CP14/LockKey/SharedCP14LockKeySystem.cs index ec48c10a1a..46f042a24c 100644 --- a/Content.Shared/_CP14/LockKey/SharedCP14LockKeySystem.cs +++ b/Content.Shared/_CP14/LockKey/SharedCP14LockKeySystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Lock; using Content.Shared.Popups; using Content.Shared.Storage; using Content.Shared.Verbs; +using Content.Shared.Doors.Components; using Robust.Shared.Audio.Systems; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -22,6 +23,7 @@ public sealed class SharedCP14LockKeySystem : EntitySystem private EntityQuery _lockQuery; private EntityQuery _cp14LockQuery; private EntityQuery _keyQuery; + private EntityQuery _doorQuery; public const int DepthComplexity = 2; @@ -32,6 +34,7 @@ public sealed class SharedCP14LockKeySystem : EntitySystem _lockQuery = GetEntityQuery(); _cp14LockQuery = GetEntityQuery(); _keyQuery = GetEntityQuery(); + _doorQuery = GetEntityQuery(); SubscribeLocalEvent(OnKeyInteract); SubscribeLocalEvent(OnKeyRingInteract); @@ -82,6 +85,9 @@ public sealed class SharedCP14LockKeySystem : EntitySystem if (!args.CanReach || args.Target is not { Valid: true }) return; + if (_doorQuery.TryComp(args.Target, out var doorComponent) && doorComponent.State == DoorState.Open) + return; + if (!_lockQuery.TryComp(args.Target, out _)) return;