Fix tranq rounds injecting when reflected (#26141)
* Fix tranq rounds injecting when reflected * Cleanup using directives * Remove FixtureId from component
This commit is contained in:
@@ -25,7 +25,4 @@ public sealed partial class SolutionInjectOnCollideComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("blockSlots"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("blockSlots"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public SlotFlags BlockSlots = SlotFlags.MASK;
|
public SlotFlags BlockSlots = SlotFlags.MASK;
|
||||||
|
|
||||||
[DataField]
|
|
||||||
public string FixtureId = SharedProjectileSystem.ProjectileFixture;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ using Content.Server.Body.Systems;
|
|||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using JetBrains.Annotations;
|
using Content.Shared.Projectiles;
|
||||||
using Robust.Shared.Physics.Events;
|
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.EntitySystems;
|
namespace Content.Server.Chemistry.EntitySystems;
|
||||||
|
|
||||||
@@ -17,17 +16,15 @@ public sealed class SolutionInjectOnCollideSystem : EntitySystem
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<SolutionInjectOnCollideComponent, StartCollideEvent>(HandleInjection);
|
SubscribeLocalEvent<SolutionInjectOnCollideComponent, ProjectileHitEvent>(HandleInjection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleInjection(Entity<SolutionInjectOnCollideComponent> ent, ref StartCollideEvent args)
|
private void HandleInjection(Entity<SolutionInjectOnCollideComponent> ent, ref ProjectileHitEvent args)
|
||||||
{
|
{
|
||||||
var component = ent.Comp;
|
var component = ent.Comp;
|
||||||
var target = args.OtherEntity;
|
var target = args.Target;
|
||||||
|
|
||||||
if (!args.OtherBody.Hard ||
|
if (!TryComp<BloodstreamComponent>(target, out var bloodstream) ||
|
||||||
args.OurFixtureId != ent.Comp.FixtureId ||
|
|
||||||
!EntityManager.TryGetComponent<BloodstreamComponent>(target, out var bloodstream) ||
|
|
||||||
!_solutionContainersSystem.TryGetInjectableSolution(ent.Owner, out var solution, out _))
|
!_solutionContainersSystem.TryGetInjectableSolution(ent.Owner, out var solution, out _))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user