mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 10:07:15 +02:00
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.
30 lines
736 B
C#
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);
|
|
}
|
|
}
|
|
}
|