Update CargoConsoleComponent.cs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Cargo;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Shared.Prototypes.Cargo;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
@@ -40,6 +41,9 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
|
||||
private bool _requestOnly = false;
|
||||
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -47,6 +51,7 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
Orders = Owner.GetComponent<CargoOrderDatabaseComponent>();
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(CargoConsoleUiKey.Key);
|
||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_galacticBankManager.AddComponent(this);
|
||||
BankId = 0;
|
||||
}
|
||||
@@ -66,6 +71,8 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
var message = serverMsg.Message;
|
||||
if (!Orders.ConnectedToDatabase)
|
||||
return;
|
||||
if (!Powered)
|
||||
return;
|
||||
switch (message)
|
||||
{
|
||||
case CargoConsoleAddOrderMessage msg:
|
||||
@@ -119,6 +126,8 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
_userInterface.Open(actor.playerSession);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user