Refactor UserInterface properties to use a helper (#1896)

This commit is contained in:
DrSmugleaf
2020-08-24 20:47:17 +02:00
committed by GitHub
parent d9f02a6a0a
commit 520e523d30
29 changed files with 76 additions and 166 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces;
using Content.Server.Mobs;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Instruments;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
@@ -106,12 +107,7 @@ namespace Content.Server.GameObjects.Components.Instruments
}
}
[ViewVariables]
private BoundUserInterface? UserInterface =>
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
ui.TryGetBoundUserInterface(InstrumentUiKey.Key, out var boundUi)
? boundUi
: null;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
{