Files
RobustToolbox/Robust.Server/GameObjects/EntitySystems/UserInterfaceSystem.cs
T
metalgearslothandGitHub 0a149fa91c Expand PVS BUIs (#5179)
Mainly happens to aghosts who go out of range. Shouldn't be a huge perf impact as the User component is added / removed as BUIs get opened.
2024-05-31 09:51:11 +10:00

30 lines
736 B
C#

using System.Collections.Generic;
using Robust.Server.GameStates;
using Robust.Shared.GameObjects;
namespace Robust.Server.GameObjects;
public sealed class UserInterfaceSystem : SharedUserInterfaceSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<UserInterfaceUserComponent, ExpandPvsEvent>(OnBuiUserExpand);
}
private void OnBuiUserExpand(Entity<UserInterfaceUserComponent> ent, ref ExpandPvsEvent args)
{
var buis = ent.Comp.OpenInterfaces.Keys;
if (buis.Count == 0)
return;
args.Entities ??= new List<EntityUid>(buis.Count);
foreach (var ui in buis)
{
args.Entities.Add(ui);
}
}
}