From a8d4da2e55b682201ba80acc059c907a74d4b414 Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Fri, 15 Mar 2024 09:57:15 -0400 Subject: [PATCH] Fix tranq rounds injecting when reflected (#26141) * Fix tranq rounds injecting when reflected * Cleanup using directives * Remove FixtureId from component --- .../Components/SolutionInjectOnCollideComponent.cs | 3 --- .../EntitySystems/SolutionInjectOnCollideSystem.cs | 13 +++++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Content.Server/Chemistry/Components/SolutionInjectOnCollideComponent.cs b/Content.Server/Chemistry/Components/SolutionInjectOnCollideComponent.cs index cdba55467ae..76bb5294bce 100644 --- a/Content.Server/Chemistry/Components/SolutionInjectOnCollideComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionInjectOnCollideComponent.cs @@ -25,7 +25,4 @@ public sealed partial class SolutionInjectOnCollideComponent : Component /// [DataField("blockSlots"), ViewVariables(VVAccess.ReadWrite)] public SlotFlags BlockSlots = SlotFlags.MASK; - - [DataField] - public string FixtureId = SharedProjectileSystem.ProjectileFixture; } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs index 0f696774ae5..fb84aca3e41 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs @@ -3,8 +3,7 @@ using Content.Server.Chemistry.Components; using Content.Server.Chemistry.Containers.EntitySystems; using Content.Shared.Inventory; -using JetBrains.Annotations; -using Robust.Shared.Physics.Events; +using Content.Shared.Projectiles; namespace Content.Server.Chemistry.EntitySystems; @@ -17,17 +16,15 @@ public sealed class SolutionInjectOnCollideSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(HandleInjection); + SubscribeLocalEvent(HandleInjection); } - private void HandleInjection(Entity ent, ref StartCollideEvent args) + private void HandleInjection(Entity ent, ref ProjectileHitEvent args) { var component = ent.Comp; - var target = args.OtherEntity; + var target = args.Target; - if (!args.OtherBody.Hard || - args.OurFixtureId != ent.Comp.FixtureId || - !EntityManager.TryGetComponent(target, out var bloodstream) || + if (!TryComp(target, out var bloodstream) || !_solutionContainersSystem.TryGetInjectableSolution(ent.Owner, out var solution, out _)) { return;