Fix damaging thrown item phasing through walls (#18574)

This commit is contained in:
Slava0135
2023-08-02 15:44:27 +03:00
committed by GitHub
parent 26dd6f2cdf
commit 86f222be9f
2 changed files with 13 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ using Content.Shared.Effects;
using Content.Shared.Mobs.Components;
using Content.Shared.Throwing;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
namespace Content.Server.Damage.Systems
@@ -19,6 +20,7 @@ namespace Content.Server.Damage.Systems
[Dependency] private readonly GunSystem _guns = default!;
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!;
[Dependency] private readonly ThrownItemSystem _thrownItem = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
public override void Initialize()
{
@@ -41,7 +43,11 @@ namespace Content.Server.Damage.Systems
_sharedCameraRecoil.KickCamera(args.Target, direction);
}
_thrownItem.LandComponent(args.Thrown, args.Component, playSound: false);
if (TryComp<PhysicsComponent>(uid, out var physics))
{
_thrownItem.LandComponent(args.Thrown, args.Component, physics, false);
_physics.ResetDynamics(physics);
}
}
}
}