Docking system can no longer forcibly open welded doors. (#12149)

* Docking system can no longer forcibly open welded doors.

* bolt the doors after trying to open them

* more door logic
This commit is contained in:
Mervill
2022-11-08 12:22:50 -08:00
committed by GitHub
parent 1d153f8694
commit 615c57bf0b
2 changed files with 30 additions and 19 deletions

View File

@@ -352,26 +352,28 @@ namespace Content.Server.Shuttles.Systems
dockB.DockJoint = joint;
dockB.DockJointId = joint.ID;
if (TryComp<AirlockComponent>(dockA.Owner, out var airlockA))
{
airlockA.SetBoltsWithAudio(true);
}
if (TryComp<AirlockComponent>(dockB.Owner, out var airlockB))
{
airlockB.SetBoltsWithAudio(true);
}
if (TryComp(dockA.Owner, out DoorComponent? doorA))
{
doorA.ChangeAirtight = false;
_doorSystem.StartOpening(doorA.Owner, doorA);
{
if (_doorSystem.TryOpen(doorA.Owner, doorA))
{
doorA.ChangeAirtight = false;
if (TryComp<AirlockComponent>(dockA.Owner, out var airlockA))
{
airlockA.SetBoltsWithAudio(true);
}
}
}
if (TryComp(dockB.Owner, out DoorComponent? doorB))
{
doorB.ChangeAirtight = false;
_doorSystem.StartOpening(doorB.Owner, doorB);
if (_doorSystem.TryOpen(doorB.Owner, doorB))
{
doorB.ChangeAirtight = false;
if (TryComp<AirlockComponent>(dockB.Owner, out var airlockB))
{
airlockB.SetBoltsWithAudio(true);
}
}
}
if (_pathfinding.TryCreatePortal(dockAXform.Coordinates, dockBXform.Coordinates, out var handle))
@@ -464,14 +466,18 @@ namespace Content.Server.Shuttles.Systems
if (TryComp(dock.Owner, out DoorComponent? doorA))
{
doorA.ChangeAirtight = true;
_doorSystem.TryClose(doorA.Owner, doorA);
if (_doorSystem.TryClose(doorA.Owner, doorA))
{
doorA.ChangeAirtight = true;
}
}
if (TryComp(dock.DockedWith, out DoorComponent? doorB))
{
doorB.ChangeAirtight = true;
_doorSystem.TryClose(doorB.Owner, doorB);
if (_doorSystem.TryClose(doorB.Owner, doorB))
{
doorB.ChangeAirtight = true;
}
}
if (LifeStage(dock.Owner) < EntityLifeStage.Terminating)

View File

@@ -316,6 +316,11 @@ public abstract class SharedDoorSystem : EntitySystem
if (!Resolve(uid, ref door))
return false;
// since both closing/closed and welded are door states, we need to prevent 'closing'
// a welded door or else there will be weird state bugs
if (door.State == DoorState.Welded)
return false;
var ev = new BeforeDoorClosedEvent(door.PerformCollisionCheck);
RaiseLocalEvent(uid, ev, false);
if (ev.Cancelled)