ECS airlocks (#13500)

This commit is contained in:
metalgearsloth
2023-01-18 05:44:32 +11:00
committed by GitHub
parent 8550baa218
commit 2873a830bd
19 changed files with 270 additions and 291 deletions

View File

@@ -19,6 +19,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using System.Linq;
using Content.Server.Power.EntitySystems;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
@@ -27,6 +28,7 @@ namespace Content.Server.Doors.Systems;
public sealed class DoorSystem : SharedDoorSystem
{
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
[Dependency] private readonly AirlockSystem _airlock = default!;
[Dependency] private readonly AirtightSystem _airtightSystem = default!;
[Dependency] private readonly ConstructionSystem _constructionSystem = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!;
@@ -230,7 +232,7 @@ public sealed class DoorSystem : SharedDoorSystem
return true;
// If the door is on emergency access we skip the checks.
if (TryComp<SharedAirlockComponent>(uid, out var airlock) && airlock.EmergencyAccess)
if (TryComp<AirlockComponent>(uid, out var airlock) && airlock.EmergencyAccess)
return true;
if (!Resolve(uid, ref access, false))
@@ -270,7 +272,7 @@ public sealed class DoorSystem : SharedDoorSystem
{
if(TryComp<AirlockComponent>(uid, out var airlockComponent))
{
if (airlockComponent.BoltsDown || !airlockComponent.IsPowered())
if (airlockComponent.BoltsDown || !this.IsPowered(uid, EntityManager))
return;
if (door.State == DoorState.Closed)
@@ -294,8 +296,8 @@ public sealed class DoorSystem : SharedDoorSystem
if (door.OpenSound != null)
PlaySound(uid, door.OpenSound, AudioParams.Default.WithVolume(-5), user, predicted);
if(lastState == DoorState.Emagging && TryComp<AirlockComponent>(door.Owner, out var airlockComponent))
airlockComponent?.SetBoltsWithAudio(!airlockComponent.IsBolted());
if(lastState == DoorState.Emagging && TryComp<AirlockComponent>(uid, out var airlockComponent))
_airlock.SetBoltsWithAudio(uid, airlockComponent, !airlockComponent.BoltsDown);
}
protected override void CheckDoorBump(DoorComponent component, PhysicsComponent body)