Fix airlock collision (#2265)

* Allow hitscan to go through open doors

So the door itself sets physics.Hard as false although that doesn't seem to include hard which I guess makes sense.

* Do the firelock thing

* Fix saltern

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-10-15 22:37:55 +11:00
committed by GitHub
parent edc01b20a5
commit be096f7ebf
3 changed files with 95 additions and 215 deletions

View File

@@ -51,31 +51,6 @@ namespace Content.Server.GameObjects.Components.Doors
_state = value;
// Didn't do in Open and Close as some stuff spawns as open so this is just easier.
if (Owner.TryGetComponent(out IPhysicsComponent? physicsComponent))
{
switch (_state)
{
case DoorState.Closed:
case DoorState.Closing:
// WE should probably track what we updated but I doubt doors will get more than 1 physics shape anyway... right?
foreach (var shape in physicsComponent.PhysicsShapes)
{
shape.CollisionLayer |= (int) CollisionGroup.Opaque;
}
break;
case DoorState.Open:
case DoorState.Opening:
foreach (var shape in physicsComponent.PhysicsShapes)
{
shape.CollisionLayer &= (int) ~CollisionGroup.Opaque;
}
break;
default:
throw new ArgumentOutOfRangeException();
}
}
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new DoorStateMessage(this, State));
}
}
@@ -283,7 +258,7 @@ namespace Content.Server.GameObjects.Components.Doors
if (Owner.TryGetComponent(out IPhysicsComponent? physics))
{
physics.Hard = false;
physics.CanCollide = false;
}
await Timer.Delay(OpenTimeTwo, _cancellationTokenSource.Token);
@@ -436,7 +411,7 @@ namespace Content.Server.GameObjects.Components.Doors
if (Owner.TryGetComponent(out IPhysicsComponent? body))
{
body.Hard = true;
body.CanCollide = true;
}
await Timer.Delay(CloseTimeTwo, _cancellationTokenSource.Token);