Gravity fixes (#2272)

* Adjust your rotation as you move (against walls and drifting)
* Can't use bullets / firelocks / items to push off of.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-10-17 00:29:29 +11:00
committed by GitHub
parent bd30a73026
commit 0dc6f98fa9
2 changed files with 6 additions and 6 deletions

View File

@@ -58,12 +58,9 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>()) foreach (var (moverComponent, physics) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>(false))
{ {
var entity = moverComponent.Owner; var entity = moverComponent.Owner;
if (_pauseManager.IsEntityPaused(entity))
continue;
UpdateKinematics(entity.Transform, moverComponent, physics); UpdateKinematics(entity.Transform, moverComponent, physics);
} }
} }

View File

@@ -65,6 +65,7 @@ namespace Content.Shared.GameObjects.EntitySystems
if (!touching) if (!touching)
{ {
transform.LocalRotation = physics.LinearVelocity.GetDir().ToAngle();
return; return;
} }
} }
@@ -88,7 +89,7 @@ namespace Content.Shared.GameObjects.EntitySystems
controller.Push(combined, mover.CurrentPushSpeed); controller.Push(combined, mover.CurrentPushSpeed);
} }
transform.LocalRotation = walkDir.GetDir().ToAngle(); transform.LocalRotation = physics.LinearVelocity.GetDir().ToAngle();
return; return;
} }
@@ -122,7 +123,9 @@ namespace Content.Shared.GameObjects.EntitySystems
continue; // Don't try to push off of yourself! continue; // Don't try to push off of yourself!
} }
if (!entity.TryGetComponent<IPhysicsComponent>(out var otherCollider)) if (!entity.TryGetComponent<IPhysicsComponent>(out var otherCollider) ||
!otherCollider.CanCollide ||
(collider.CollisionMask & otherCollider.CollisionLayer) == 0)
{ {
continue; continue;
} }