Component that represents a lobby slot, exposing its index and which player occupies it. It computes IsOccupied and OccupyingPlayer by querying Scene for Player components matching SlotIndex.
using Sandbox;
public sealed class LobbyPlayerSlot : Component
{
[Property] public int SlotIndex { get; set; }
public bool IsOccupied => Scene.GetAllComponents<Player>().Any( x => x.LobbySlotIndex == SlotIndex );
public Player OccupyingPlayer => Scene.GetAllComponents<Player>().FirstOrDefault( x => x.LobbySlotIndex == SlotIndex );
}