gateway changes (#20304)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user