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

@@ -1,6 +1,7 @@
#nullable enable
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components.Command;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.UserInterface;
@@ -23,12 +24,7 @@ namespace Content.Server.GameObjects.Components.Command
private RoundEndSystem RoundEndSystem => _entitySystemManager.GetEntitySystem<RoundEndSystem>();
[ViewVariables]
private BoundUserInterface? UserInterface =>
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
ui.TryGetBoundUserInterface(CommunicationsConsoleUiKey.Key, out var boundUi)
? boundUi
: null;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CommunicationsConsoleUiKey.Key);
public override void Initialize()
{