diff --git a/Content.Server/Research/Systems/ResearchSystem.Client.cs b/Content.Server/Research/Systems/ResearchSystem.Client.cs index 1bb18825167..6182adeb85f 100644 --- a/Content.Server/Research/Systems/ResearchSystem.Client.cs +++ b/Content.Server/Research/Systems/ResearchSystem.Client.cs @@ -81,9 +81,9 @@ private void UpdateClientInterface(EntityUid uid, ResearchClientComponent? compo if (!TryGetClientServer(uid, out _, out var serverComponent, component)) return; - var names = GetServerNames(); + var names = GetNFServerNames(uid); var state = new ResearchClientBoundInterfaceState(names.Length, names, - GetServerIds(), component.ConnectedToServer ? serverComponent.Id : -1); + GetNFServerIds(uid), component.ConnectedToServer ? serverComponent.Id : -1); _uiSystem.TrySetUiState(uid, ResearchClientUiKey.Key, state); } diff --git a/Content.Server/Research/Systems/ResearchSystem.cs b/Content.Server/Research/Systems/ResearchSystem.cs index 7adc30ea298..329d1b57d27 100644 --- a/Content.Server/Research/Systems/ResearchSystem.cs +++ b/Content.Server/Research/Systems/ResearchSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Content.Server.Administration.Logs; +using Content.Server.Station.Systems; using Content.Shared.Access.Systems; using Content.Shared.Popups; using Content.Shared.Research.Components; @@ -19,6 +20,7 @@ public sealed partial class ResearchSystem : SharedResearchSystem [Dependency] private readonly AccessReaderSystem _accessReader = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly StationSystem _station = default!; public override void Initialize() { @@ -87,6 +89,49 @@ public int[] GetServerIds() return list; } + /// + /// Frontier copies of the original get servers. We need our research system to be isolated on a per-grid basis. + /// + /// + /// + public string[] GetNFServerNames(EntityUid gridUid) + { + var allServers = EntityQueryEnumerator(); + var list = new List(); + var station = _station.GetOwningStation(gridUid); + + if (station is { } stationUid) + { + while (allServers.MoveNext(out var uid, out var comp)) + { + if (_station.GetOwningStation(uid) == stationUid) + list.Add(comp.ServerName); + } + } + + var serverList = list.ToArray(); + return serverList; + } + + public int[] GetNFServerIds(EntityUid gridUid) + { + var allServers = EntityQueryEnumerator(); + var list = new List(); + var station = _station.GetOwningStation(gridUid); + + if (station is { } stationUid) + { + while (allServers.MoveNext(out var uid, out var comp)) + { + if (_station.GetOwningStation(uid) == stationUid) + list.Add(comp.Id); + } + } + + var serverList = list.ToArray(); + return serverList; + } + public override void Update(float frameTime) { foreach (var server in EntityQuery())