Small instrument system fix (#7432)

This commit is contained in:
mirrorcult
2022-04-05 00:08:05 -07:00
committed by GitHub
parent b7ff72ba6e
commit 7f2ceeb8e2

View File

@@ -67,6 +67,9 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
private void OnBoundUIClosed(EntityUid uid, InstrumentComponent component, BoundUIClosedEvent args)
{
if (args.UiKey is not InstrumentUiKey)
return;
if (HasComp<ActiveInstrumentComponent>(uid)
&& _userInterfaceSystem.TryGetUi(uid, args.UiKey, out var bui)
&& bui.SubscribedSessions.Count == 0)
@@ -79,6 +82,9 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
private void OnBoundUIOpened(EntityUid uid, InstrumentComponent component, BoundUIOpenedEvent args)
{
if (args.UiKey is not InstrumentUiKey)
return;
EnsureComp<ActiveInstrumentComponent>(uid);
Clean(uid, component);
}