Airlocks can now be opened only by moving towards them (#1028)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Access;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Movement;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Doors;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -96,6 +98,12 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
if (entity.HasComponent(typeof(SpeciesComponent)))
|
||||
{
|
||||
if (!entity.TryGetComponent<IMoverComponent>(out var mover)) return;
|
||||
|
||||
// TODO: temporary hack to fix the physics system raising collision events akwardly.
|
||||
// E.g. when moving parallel to a door by going off the side of a wall.
|
||||
var dotProduct = Vector2.Dot(mover.VelocityDir.Normalized, (entity.Transform.WorldPosition - Owner.Transform.WorldPosition).Normalized);
|
||||
if (dotProduct <= -0.9f)
|
||||
TryOpen(entity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user