mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
33 lines
903 B
C#
33 lines
903 B
C#
using System.Collections.Generic;
|
|
using Robust.Server.GameStates;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Utility;
|
|
|
|
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)
|
|
{
|
|
DebugTools.Assert(ent.Comp.OpenInterfaces[ui].Count > 0);
|
|
DebugTools.Assert(HasComp<UserInterfaceComponent>(ui));
|
|
args.Entities.Add(ui);
|
|
}
|
|
}
|
|
}
|