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

@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Utility;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
using Content.Shared.GameObjects.EntitySystems;
@@ -52,12 +53,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
[ViewVariables]
private BoundUserInterface? UserInterface =>
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
ui.TryGetBoundUserInterface(ReagentDispenserUiKey.Key, out var boundUi)
? boundUi
: null;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ReagentDispenserUiKey.Key);
/// <summary>
/// Shows the serializer how to save/load this components yaml prototype.