Add FTL fallback (#16644)
This commit is contained in:
@@ -10,6 +10,7 @@ using Robust.Shared.Player;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.Shuttles.Events;
|
using Content.Server.Shuttles.Events;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
@@ -309,12 +310,25 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
if (comp.TargetUid != null && shuttle != null)
|
if (comp.TargetUid != null && shuttle != null)
|
||||||
{
|
{
|
||||||
if (comp.Dock)
|
if (!Deleted(comp.TargetUid))
|
||||||
TryFTLDock(uid, shuttle, comp.TargetUid.Value, comp.PriorityTag);
|
{
|
||||||
else
|
if (comp.Dock)
|
||||||
TryFTLProximity(uid, shuttle, comp.TargetUid.Value);
|
TryFTLDock(uid, shuttle, comp.TargetUid.Value, comp.PriorityTag);
|
||||||
|
else
|
||||||
|
TryFTLProximity(uid, shuttle, comp.TargetUid.Value);
|
||||||
|
|
||||||
mapId = Transform(comp.TargetUid.Value).MapID;
|
mapId = Transform(comp.TargetUid.Value).MapID;
|
||||||
|
}
|
||||||
|
// oh boy, fallback time
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Pick earliest map?
|
||||||
|
var maps = EntityQuery<MapComponent>().Select(o => o.MapId).ToList();
|
||||||
|
var map = maps.Min(o => o.GetHashCode());
|
||||||
|
|
||||||
|
mapId = new MapId(map);
|
||||||
|
TryFTLProximity(uid, shuttle, _mapManager.GetMapEntityId(mapId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user