Fix airlock crush (#2348)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-10-21 19:22:38 +11:00
committed by GitHub
parent c7e7ff4065
commit c70066aede

View File

@@ -378,12 +378,17 @@ namespace Content.Server.GameObjects.Components.Doors
public bool Close()
{
bool shouldCheckCrush = false;
if (Owner.TryGetComponent(out IPhysicsComponent? physics))
physics.CanCollide = true;
if (_canCrush && Owner.TryGetComponent(out IPhysicsComponent? physics) &&
if (_canCrush && physics != null &&
physics.IsColliding(Vector2.Zero, false))
{
if (Safety)
{
physics.CanCollide = false;
return false;
}
// check if we crush someone while closing
shouldCheckCrush = true;