gateway changes (#20304)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-09-18 02:09:21 +01:00
committed by GitHub
parent 84495c3d52
commit fc6638d7e0
6 changed files with 121 additions and 40 deletions

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Shared.Teleportation.Components;
using Robust.Shared.GameStates;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Content.Shared.Teleportation.Systems;
@@ -113,5 +114,25 @@ public sealed class LinkedEntitySystem : EntitySystem
return success;
}
/// <summary>
/// Get the first entity this entity is linked to.
/// If multiple are linked only the first one is picked.
/// </summary>
public bool GetLink(EntityUid uid, [NotNullWhen(true)] out EntityUid? dest, LinkedEntityComponent? comp = null)
{
dest = null;
if (!Resolve(uid, ref comp, false))
return false;
var first = comp.LinkedEntities.FirstOrDefault();
if (first != default)
{
dest = first;
return true;
}
return false;
}
#endregion
}