]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Prevent fly-by fixture from powering containment field generator (#29225)
authorAlice "Arimah" Heurlin <30327355+arimah@users.noreply.github.com>
Wed, 19 Jun 2024 23:51:07 +0000 (01:51 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2024 23:51:07 +0000 (19:51 -0400)
* Prevent fly-by fixture from powering containment field generator

* Update according to review

Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs
Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs

index d58458527f6f48ed868104f554c77f1d4109c1c9..e575b0403b60b1d5d89c35e2fe5a2cd5fa366b03 100644 (file)
@@ -65,7 +65,8 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
     /// </summary>
     private void HandleGeneratorCollide(Entity<ContainmentFieldGeneratorComponent> 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;
index c704c8bf77b469e507b164009382a099efb9d728..938b34f354a6e016c442341830aa2710eed6545c 100644 (file)
@@ -69,6 +69,13 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component
     [DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
     public string IDTag = "EmitterBolt";
 
+    /// <summary>
+    /// Which fixture ID should test collision with from the entity that powers the generator?
+    /// Prevents the generator from being powered by fly-by fixtures.
+    /// </summary>
+    [DataField]
+    public string SourceFixtureId = "projectile";
+
     /// <summary>
     /// Is the generator toggled on?
     /// </summary>