From 2b92ec79f78873c16a8c289be7eace130009c725 Mon Sep 17 00:00:00 2001 From: "Alice \"Arimah\" Heurlin" <30327355+arimah@users.noreply.github.com> Date: Thu, 20 Jun 2024 01:51:07 +0200 Subject: [PATCH] Prevent fly-by fixture from powering containment field generator (#29225) * Prevent fly-by fixture from powering containment field generator * Update according to review --- .../EntitySystems/ContainmentFieldGeneratorSystem.cs | 3 ++- .../Components/ContainmentFieldGeneratorComponent.cs | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index d58458527f..e575b0403b 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -65,7 +65,8 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem /// private void HandleGeneratorCollide(Entity generator, ref StartCollideEvent args) { - if (_tags.HasTag(args.OtherEntity, generator.Comp.IDTag)) + if (args.OtherFixtureId == generator.Comp.SourceFixtureId && + _tags.HasTag(args.OtherEntity, generator.Comp.IDTag)) { ReceivePower(generator.Comp.PowerReceived, generator); generator.Comp.Accumulator = 0f; diff --git a/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs index c704c8bf77..938b34f354 100644 --- a/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -69,6 +69,13 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component [DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer))] public string IDTag = "EmitterBolt"; + /// + /// Which fixture ID should test collision with from the entity that powers the generator? + /// Prevents the generator from being powered by fly-by fixtures. + /// + [DataField] + public string SourceFixtureId = "projectile"; + /// /// Is the generator toggled on? ///