Don't re-close closed doors (#15007)

Fixes them re-closing on shuttle departure. If this is bad can just make shuttle code handle it but this seemed more appropriate?
This commit is contained in:
metalgearsloth
2023-04-04 04:28:27 +10:00
committed by GitHub
parent fc61b9da62
commit 846274b7b8
4 changed files with 73 additions and 61 deletions

View File

@@ -361,12 +361,14 @@ public sealed partial class ShuttleSystem
private void SetDocks(EntityUid uid, bool enabled)
{
foreach (var (dock, xform) in EntityQuery<DockingComponent, TransformComponent>(true))
var query = AllEntityQuery<DockingComponent, TransformComponent>();
while (query.MoveNext(out var dockUid, out var dock, out var xform))
{
if (xform.ParentUid != uid || dock.Enabled == enabled)
continue;
_dockSystem.Undock(dock);
_dockSystem.Undock(dockUid, dock);
dock.Enabled = enabled;
}
}