@@ -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);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Shared.Chemistry;
|
||||
@@ -46,6 +47,11 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
[ViewVariables]
|
||||
private SolutionComponent Solution => _beakerContainer.ContainedEntity.GetComponent<SolutionComponent>();
|
||||
|
||||
///implementing PowerDeviceComponent
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Shows the serializer how to save/load this components yaml prototype.
|
||||
/// </summary>
|
||||
@@ -70,6 +76,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
_beakerContainer =
|
||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
|
||||
InitializeFromPrototype();
|
||||
UpdateUserInterface();
|
||||
@@ -159,6 +166,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
//Check if player can interact in their current state
|
||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (!Powered)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -251,6 +261,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
var activeHandEntity = hands.GetActiveHand?.Owner;
|
||||
if (activeHandEntity == null)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Medical;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
@@ -24,6 +25,10 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
private readonly Vector2 _ejectOffset = new Vector2(-0.5f, 0f);
|
||||
public bool IsOccupied => _bodyContainer.ContainedEntity != null;
|
||||
|
||||
///implementing PowerDeviceComponent
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -31,6 +36,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||
.GetBoundUserInterface(MedicalScannerUiKey.Key);
|
||||
_bodyContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-bodyContainer", Owner);
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
@@ -79,6 +85,8 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
|
||||
private void UpdateUserInterface()
|
||||
{
|
||||
if (!Powered)
|
||||
return;
|
||||
var newState = GetUserInterfaceState();
|
||||
_userInterface.SetState(newState);
|
||||
}
|
||||
@@ -112,6 +120,8 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
return;
|
||||
_userInterface.Open(actor.playerSession);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||
{
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
switch (message.Message)
|
||||
{
|
||||
case LatheQueueRecipeMessage msg:
|
||||
@@ -87,13 +90,15 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
|
||||
case LatheServerSyncMessage msg:
|
||||
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)
|
||||
|| !Owner.TryGetComponent(out ProtolatheDatabaseComponent protoDatabase)) return;
|
||||
|| !Owner.TryGetComponent(out ProtolatheDatabaseComponent protoDatabase)) return;
|
||||
|
||||
if(database.SyncWithServer())
|
||||
if (database.SyncWithServer())
|
||||
protoDatabase.Sync();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal bool Produce(LatheRecipePrototype recipe)
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)) return;
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
switch (message.Message)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
var wires = Owner.GetComponent<WiresComponent>();
|
||||
if (wires.IsPanelOpen)
|
||||
@@ -121,6 +123,9 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||
{
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
var message = serverMsg.Message;
|
||||
switch (message)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user