From 367feba023dd1afd58f757348eb6d4c68160d068 Mon Sep 17 00:00:00 2001 From: vulppine Date: Tue, 24 May 2022 02:49:08 -0700 Subject: [PATCH 1/2] adds a check for canreach in SpawnAfterInteract --- .../Engineering/Components/SpawnAfterInteractComponent.cs | 4 ++++ .../Engineering/EntitySystems/SpawnAfterInteractSystem.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Content.Server/Engineering/Components/SpawnAfterInteractComponent.cs b/Content.Server/Engineering/Components/SpawnAfterInteractComponent.cs index da3ad392307d..fe4e98ad7b8e 100644 --- a/Content.Server/Engineering/Components/SpawnAfterInteractComponent.cs +++ b/Content.Server/Engineering/Components/SpawnAfterInteractComponent.cs @@ -10,6 +10,10 @@ public sealed class SpawnAfterInteractComponent : Component [DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer))] public string? Prototype { get; } + [ViewVariables] + [DataField("ignoreDistance")] + public bool IgnoreDistance { get; } + [ViewVariables] [DataField("doAfter")] public float DoAfterTime = 0; diff --git a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs index 3119222e3721..8e400382fcea 100644 --- a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs +++ b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs @@ -25,6 +25,8 @@ public override void Initialize() private async void HandleAfterInteract(EntityUid uid, SpawnAfterInteractComponent component, AfterInteractEvent args) { + if (!args.CanReach) + return; if (string.IsNullOrEmpty(component.Prototype)) return; if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(EntityManager), out var grid)) From 9fd172c02b454673b5c06e09ed640f514de897dd Mon Sep 17 00:00:00 2001 From: vulppine Date: Tue, 24 May 2022 02:52:18 -0700 Subject: [PATCH 2/2] adds a check for the new field --- .../Engineering/EntitySystems/SpawnAfterInteractSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs index 8e400382fcea..0e20f699f990 100644 --- a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs +++ b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs @@ -25,7 +25,7 @@ public override void Initialize() private async void HandleAfterInteract(EntityUid uid, SpawnAfterInteractComponent component, AfterInteractEvent args) { - if (!args.CanReach) + if (!args.CanReach && !component.IgnoreDistance) return; if (string.IsNullOrEmpty(component.Prototype)) return;