Fix even more warnings (#11968)

Also more instances of someone using TryComp instead of HasComp

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-10-17 02:49:22 +11:00
committed by GitHub
parent 214d0c1774
commit 1782eb6ad7
22 changed files with 86 additions and 58 deletions

View File

@@ -43,14 +43,17 @@ public abstract partial class SharedMoverController
/// </summary>
private void OnMobCollision(Fixture ourFixture, Fixture otherFixture, float frameTime, Vector2 worldNormal)
{
if (!_pushingEnabled) return;
if (!_pushingEnabled)
return;
var otherBody = otherFixture.Body;
if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return;
if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard)
return;
if (!EntityManager.TryGetComponent(ourFixture.Body.Owner, out MobMoverComponent? mobMover) || worldNormal == Vector2.Zero) return;
if (!EntityManager.TryGetComponent(ourFixture.Body.Owner, out MobMoverComponent? mobMover) || worldNormal == Vector2.Zero)
return;
otherBody.ApplyLinearImpulse(-worldNormal * mobMover.PushStrengthVV * frameTime);
PhysicsSystem.ApplyLinearImpulse(otherBody, -worldNormal * mobMover.PushStrengthVV * frameTime);
}
}