Refactor UserInterface properties to use a helper (#1896)
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Access;
|
using Content.Shared.Access;
|
||||||
using Content.Shared.GameObjects.Components.Access;
|
using Content.Shared.GameObjects.Components.Access;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -30,12 +31,7 @@ namespace Content.Server.GameObjects.Components.Access
|
|||||||
private ContainerSlot _privilegedIdContainer = default!;
|
private ContainerSlot _privilegedIdContainer = default!;
|
||||||
private ContainerSlot _targetIdContainer = default!;
|
private ContainerSlot _targetIdContainer = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(IdCardConsoleUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(IdCardConsoleUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -32,12 +33,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
private bool _checkPlayer = false; // Check at the player pos or at some other tile?
|
private bool _checkPlayer = false; // Check at the player pos or at some other tile?
|
||||||
private GridCoordinates? _position; // The tile that we scanned
|
private GridCoordinates? _position; // The tile that we scanned
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GasAnalyzerUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(GasAnalyzerUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.Body;
|
using Content.Server.Body;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Body.Scanner;
|
using Content.Shared.Body.Scanner;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -17,12 +18,7 @@ namespace Content.Server.GameObjects.Components.Body
|
|||||||
{
|
{
|
||||||
public sealed override string Name => "BodyScanner";
|
public sealed override string Name => "BodyScanner";
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BodyScannerUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(BodyScannerUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Content.Server.Body;
|
using Content.Server.Body;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Body.Surgery;
|
using Content.Shared.Body.Surgery;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -34,12 +35,7 @@ namespace Content.Server.GameObjects.Components.Body
|
|||||||
|
|
||||||
[ViewVariables] public BodyPart ContainedBodyPart { get; private set; } = default!;
|
[ViewVariables] public BodyPart ContainedBodyPart { get; private set; } = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GenericSurgeryUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(GenericSurgeryUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.Body;
|
using Content.Server.Body;
|
||||||
using Content.Server.Body.Mechanisms;
|
using Content.Server.Body.Mechanisms;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Body.Mechanism;
|
using Content.Shared.Body.Mechanism;
|
||||||
using Content.Shared.Body.Surgery;
|
using Content.Shared.Body.Surgery;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
@@ -42,12 +43,7 @@ namespace Content.Server.GameObjects.Components.Body
|
|||||||
|
|
||||||
[ViewVariables] public Mechanism ContainedMechanism { get; private set; } = default!;
|
[ViewVariables] public Mechanism ContainedMechanism { get; private set; } = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GenericSurgeryUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(GenericSurgeryUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Body;
|
using Content.Server.Body;
|
||||||
using Content.Server.Body.Mechanisms;
|
using Content.Server.Body.Mechanisms;
|
||||||
using Content.Server.Body.Surgery;
|
using Content.Server.Body.Surgery;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Body.Surgery;
|
using Content.Shared.Body.Surgery;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Body;
|
using Content.Shared.GameObjects.Components.Body;
|
||||||
@@ -52,12 +53,7 @@ namespace Content.Server.GameObjects.Components.Body
|
|||||||
|
|
||||||
private SurgeryType _surgeryType;
|
private SurgeryType _surgeryType;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GenericSurgeryUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(GenericSurgeryUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.Cargo;
|
using Content.Server.Cargo;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Cargo;
|
using Content.Shared.GameObjects.Components.Cargo;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Content.Shared.Prototypes.Cargo;
|
using Content.Shared.Prototypes.Cargo;
|
||||||
@@ -59,12 +60,7 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
private CargoConsoleSystem _cargoConsoleSystem = default!;
|
private CargoConsoleSystem _cargoConsoleSystem = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CargoConsoleUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(CargoConsoleUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
|
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -55,12 +56,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
private readonly SolutionComponent BufferSolution = new SolutionComponent();
|
private readonly SolutionComponent BufferSolution = new SolutionComponent();
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ChemMasterUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(ChemMasterUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the serializer how to save/load this components yaml prototype.
|
/// Shows the serializer how to save/load this components yaml prototype.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
|
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
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;
|
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ReagentDispenserUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(ReagentDispenserUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the serializer how to save/load this components yaml prototype.
|
/// Shows the serializer how to save/load this components yaml prototype.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Command;
|
using Content.Shared.GameObjects.Components.Command;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -23,12 +24,7 @@ namespace Content.Server.GameObjects.Components.Command
|
|||||||
|
|
||||||
private RoundEndSystem RoundEndSystem => _entitySystemManager.GetEntitySystem<RoundEndSystem>();
|
private RoundEndSystem RoundEndSystem => _entitySystemManager.GetEntitySystem<RoundEndSystem>();
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CommunicationsConsoleUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(CommunicationsConsoleUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Robust.Shared.Maths;
|
|||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Content.Server.Utility;
|
||||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent;
|
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalRouterComponent;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Disposal
|
namespace Content.Server.GameObjects.Components.Disposal
|
||||||
@@ -37,12 +38,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
!Owner.TryGetComponent(out ICollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out ICollidableComponent? collidable) ||
|
||||||
collidable.Anchored;
|
collidable.Anchored;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(DisposalRouterUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override Direction NextDirection(DisposalHolderComponent holder)
|
public override Direction NextDirection(DisposalHolderComponent holder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -35,12 +36,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
||||||
collidable.Anchored;
|
collidable.Anchored;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(DisposalTaggerUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override Direction NextDirection(DisposalHolderComponent holder)
|
public override Direction NextDirection(DisposalHolderComponent holder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.GameObjects.Components.Items.Storage;
|
|||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Body;
|
using Content.Shared.GameObjects.Components.Body;
|
||||||
using Content.Shared.GameObjects.Components.Disposal;
|
using Content.Shared.GameObjects.Components.Disposal;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -112,15 +113,10 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalUnitUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(DisposalUnitUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
private DisposalUnitBoundUserInterfaceState? _lastUiState;
|
private DisposalUnitBoundUserInterfaceState? _lastUiState;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store the translated state.
|
/// Store the translated state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -296,7 +292,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
private DisposalUnitBoundUserInterfaceState GetInterfaceState()
|
private DisposalUnitBoundUserInterfaceState GetInterfaceState()
|
||||||
{
|
{
|
||||||
string stateString;
|
string stateString;
|
||||||
|
|
||||||
if (_locState.State != State)
|
if (_locState.State != State)
|
||||||
{
|
{
|
||||||
stateString = Loc.GetString($"{State}");
|
stateString = Loc.GetString($"{State}");
|
||||||
@@ -306,7 +302,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
stateString = _locState.Localized;
|
stateString = _locState.Localized;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DisposalUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged);
|
return new DisposalUnitBoundUserInterfaceState(Owner.Name, stateString, _pressure, Powered, Engaged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Threading;
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.EntitySystems.DoAfter;
|
using Content.Server.GameObjects.EntitySystems.DoAfter;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.GUI;
|
using Content.Shared.GameObjects.Components.GUI;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -27,12 +28,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
|
|
||||||
public const float StripDelay = 2f;
|
public const float StripDelay = 2f;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(StrippingUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.Components.Damage;
|
|||||||
using Content.Server.GameObjects.Components.Interactable;
|
using Content.Server.GameObjects.Components.Interactable;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Gravity;
|
using Content.Shared.GameObjects.Components.Gravity;
|
||||||
using Content.Shared.GameObjects.Components.Interactable;
|
using Content.Shared.GameObjects.Components.Interactable;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -16,6 +17,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Gravity
|
namespace Content.Server.GameObjects.Components.Gravity
|
||||||
{
|
{
|
||||||
@@ -59,11 +61,7 @@ namespace Content.Server.GameObjects.Components.Gravity
|
|||||||
|
|
||||||
public override string Name => "GravityGenerator";
|
public override string Name => "GravityGenerator";
|
||||||
|
|
||||||
private BoundUserInterface? UserInterface =>
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GravityGeneratorUiKey.Key);
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(GravityGeneratorUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Instruments;
|
using Content.Shared.GameObjects.Components.Instruments;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -106,12 +107,7 @@ namespace Content.Server.GameObjects.Components.Instruments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(InstrumentUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Server.GameObjects.EntitySystems;
|
|||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.Chat;
|
using Content.Server.Interfaces.Chat;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
@@ -73,12 +74,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
private AudioSystem _audioSystem = default!;
|
private AudioSystem _audioSystem = default!;
|
||||||
private Container _storage = default!;
|
private Container _storage = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MicrowaveUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(MicrowaveUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -17,12 +18,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
public class MagicMirrorComponent : SharedMagicMirrorComponent, IActivate
|
public class MagicMirrorComponent : SharedMagicMirrorComponent, IActivate
|
||||||
{
|
{
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(MagicMirrorUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Damage;
|
using Content.Shared.GameObjects.Components.Damage;
|
||||||
using Content.Shared.GameObjects.Components.Medical;
|
using Content.Shared.GameObjects.Components.Medical;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -32,12 +33,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MedicalScannerUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(MedicalScannerUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.GameObjects.Components.GUI;
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.PDA;
|
using Content.Server.Interfaces.PDA;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.PDA;
|
using Content.Shared.GameObjects.Components.PDA;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
@@ -48,12 +49,7 @@ namespace Content.Server.GameObjects.Components.PDA
|
|||||||
|
|
||||||
[ViewVariables] private readonly PdaAccessSet _accessSet;
|
[ViewVariables] private readonly PdaAccessSet _accessSet;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(PDAUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(PDAUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public PDAComponent()
|
public PDAComponent()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -8,6 +9,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Paper
|
namespace Content.Server.GameObjects.Components.Paper
|
||||||
{
|
{
|
||||||
@@ -17,11 +19,7 @@ namespace Content.Server.GameObjects.Components.Paper
|
|||||||
private string _content = "";
|
private string _content = "";
|
||||||
private PaperAction _mode;
|
private PaperAction _mode;
|
||||||
|
|
||||||
private BoundUserInterface? UserInterface =>
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(PaperUiKey.Key);
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(PaperUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
|
||||||
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
|
using Content.Server.GameObjects.Components.Power.PowerNetComponents;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -45,12 +46,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
|||||||
|
|
||||||
private const int VisualsChangeDelay = 1;
|
private const int VisualsChangeDelay = 1;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(ApcUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null;
|
public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -21,12 +22,7 @@ namespace Content.Server.GameObjects.Components.Power.PowerNetComponents
|
|||||||
private PowerSolarSystem _powerSolarSystem = default!;
|
private PowerSolarSystem _powerSolarSystem = default!;
|
||||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SolarControlConsoleUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(SolarControlConsoleUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Materials;
|
using Content.Shared.GameObjects.Components.Materials;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
@@ -45,12 +46,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
|
|
||||||
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(LatheUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(LatheUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
@@ -18,11 +19,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||||
|
|
||||||
// TODO: Create GUI for changing RD server.
|
// TODO: Create GUI for changing RD server.
|
||||||
private BoundUserInterface? UserInterface =>
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ResearchClientUiKey.Key);
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(ResearchClientUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public bool ConnectedToServer => Server != null;
|
public bool ConnectedToServer => Server != null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.GameObjects.Components.Research;
|
using Content.Shared.GameObjects.Components.Research;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -30,12 +31,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
|
|
||||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ResearchConsoleUiKey.Key);
|
||||||
private BoundUserInterface? UserInterface =>
|
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(ResearchConsoleUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -21,6 +22,7 @@ using Robust.Shared.Random;
|
|||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
using static Content.Shared.GameObjects.Components.SharedWiresComponent;
|
using static Content.Shared.GameObjects.Components.SharedWiresComponent;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.VendingMachines
|
namespace Content.Server.GameObjects.Components.VendingMachines
|
||||||
@@ -42,11 +44,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
|||||||
|
|
||||||
private string _soundVend = "";
|
private string _soundVend = "";
|
||||||
|
|
||||||
private BoundUserInterface? UserInterface =>
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(VendingMachineUiKey.Key);
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(VendingMachineUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public void Activate(ActivateEventArgs eventArgs)
|
public void Activate(ActivateEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.VendingMachines;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.GameObjects.Components.Interactable;
|
using Content.Shared.GameObjects.Components.Interactable;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -140,11 +141,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private string? _layoutId;
|
private string? _layoutId;
|
||||||
|
|
||||||
private BoundUserInterface? UserInterface =>
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(WiresUiKey.Key);
|
||||||
Owner.TryGetComponent(out ServerUserInterfaceComponent? ui) &&
|
|
||||||
ui.TryGetBoundUserInterface(WiresUiKey.Key, out var boundUi)
|
|
||||||
? boundUi
|
|
||||||
: null;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
14
Content.Server/Utility/UserInterfaceHelpers.cs
Normal file
14
Content.Server/Utility/UserInterfaceHelpers.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#nullable enable
|
||||||
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.Utility
|
||||||
|
{
|
||||||
|
public static class UserInterfaceHelpers
|
||||||
|
{
|
||||||
|
public static BoundUserInterface? GetUIOrNull(this IEntity entity, object uiKey)
|
||||||
|
{
|
||||||
|
return entity.GetComponentOrNull<ServerUserInterfaceComponent>()?.GetBoundUserInterfaceOrNull(uiKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user