Throwing fixes (#18576)

* Throwing fixes

- Status should always be reset.
- ResetDynamics when I meant ResetMassData but didn't matter anyway.

* a
This commit is contained in:
metalgearsloth
2023-08-15 09:49:59 +10:00
committed by GitHub
parent 76688c691c
commit a13da27905
2 changed files with 8 additions and 5 deletions

View File

@@ -48,10 +48,10 @@ namespace Content.Server.Damage.Systems
_sharedCameraRecoil.KickCamera(args.Target, direction); _sharedCameraRecoil.KickCamera(args.Target, direction);
} }
// TODO: If more stuff touches this then handle it after.
if (TryComp<PhysicsComponent>(uid, out var physics)) if (TryComp<PhysicsComponent>(uid, out var physics))
{ {
_thrownItem.LandComponent(args.Thrown, args.Component, physics, false); _thrownItem.LandComponent(args.Thrown, args.Component, physics, false);
_physics.ResetDynamics(physics);
} }
} }

View File

@@ -69,7 +69,7 @@ namespace Content.Shared.Throwing
private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref StartCollideEvent args) private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref StartCollideEvent args)
{ {
if (args.OtherFixture.Hard == false) if (!args.OtherFixture.Hard)
return; return;
if (args.OtherEntity == component.Thrower) if (args.OtherEntity == component.Thrower)
@@ -98,8 +98,13 @@ namespace Content.Shared.Throwing
StopThrow(message.Pulled.Owner, thrownItemComponent); StopThrow(message.Pulled.Owner, thrownItemComponent);
} }
private void StopThrow(EntityUid uid, ThrownItemComponent thrownItemComponent) public void StopThrow(EntityUid uid, ThrownItemComponent thrownItemComponent)
{ {
if (TryComp<PhysicsComponent>(uid, out var physics))
{
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
}
if (EntityManager.TryGetComponent(uid, out FixturesComponent? manager)) if (EntityManager.TryGetComponent(uid, out FixturesComponent? manager))
{ {
var fixture = _fixtures.GetFixtureOrNull(uid, ThrowingFixture, manager: manager); var fixture = _fixtures.GetFixtureOrNull(uid, ThrowingFixture, manager: manager);
@@ -116,8 +121,6 @@ namespace Content.Shared.Throwing
public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound) public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound)
{ {
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
if (thrownItem.Deleted || Deleted(uid)) if (thrownItem.Deleted || Deleted(uid))
return; return;