@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Cargo;
|
using Content.Server.Cargo;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Shared.GameObjects.Components.Cargo;
|
using Content.Shared.GameObjects.Components.Cargo;
|
||||||
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Shared.Prototypes.Cargo;
|
using Content.Shared.Prototypes.Cargo;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
@@ -40,6 +41,9 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
|
|
||||||
private bool _requestOnly = false;
|
private bool _requestOnly = false;
|
||||||
|
|
||||||
|
private PowerDeviceComponent _powerDevice;
|
||||||
|
private bool Powered => _powerDevice.Powered;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -47,6 +51,7 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
Orders = Owner.GetComponent<CargoOrderDatabaseComponent>();
|
Orders = Owner.GetComponent<CargoOrderDatabaseComponent>();
|
||||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(CargoConsoleUiKey.Key);
|
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(CargoConsoleUiKey.Key);
|
||||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||||
|
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||||
_galacticBankManager.AddComponent(this);
|
_galacticBankManager.AddComponent(this);
|
||||||
BankId = 0;
|
BankId = 0;
|
||||||
}
|
}
|
||||||
@@ -66,6 +71,8 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
var message = serverMsg.Message;
|
var message = serverMsg.Message;
|
||||||
if (!Orders.ConnectedToDatabase)
|
if (!Orders.ConnectedToDatabase)
|
||||||
return;
|
return;
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case CargoConsoleAddOrderMessage msg:
|
case CargoConsoleAddOrderMessage msg:
|
||||||
@@ -119,6 +126,8 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
_userInterface.Open(actor.playerSession);
|
_userInterface.Open(actor.playerSession);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
@@ -46,6 +47,11 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private SolutionComponent Solution => _beakerContainer.ContainedEntity.GetComponent<SolutionComponent>();
|
private SolutionComponent Solution => _beakerContainer.ContainedEntity.GetComponent<SolutionComponent>();
|
||||||
|
|
||||||
|
///implementing PowerDeviceComponent
|
||||||
|
private PowerDeviceComponent _powerDevice;
|
||||||
|
private bool Powered => _powerDevice.Powered;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the serializer how to save/load this components yaml prototype.
|
/// Shows the serializer how to save/load this components yaml prototype.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -70,6 +76,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
_beakerContainer =
|
_beakerContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
||||||
|
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||||
|
|
||||||
InitializeFromPrototype();
|
InitializeFromPrototype();
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
@@ -159,6 +166,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
//Check if player can interact in their current state
|
//Check if player can interact in their current state
|
||||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||||
return false;
|
return false;
|
||||||
|
//Check if device is powered
|
||||||
|
if (!Powered)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -251,6 +261,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHand?.Owner;
|
var activeHandEntity = hands.GetActiveHand?.Owner;
|
||||||
if (activeHandEntity == null)
|
if (activeHandEntity == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Medical;
|
using Content.Shared.GameObjects.Components.Medical;
|
||||||
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
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);
|
private readonly Vector2 _ejectOffset = new Vector2(-0.5f, 0f);
|
||||||
public bool IsOccupied => _bodyContainer.ContainedEntity != null;
|
public bool IsOccupied => _bodyContainer.ContainedEntity != null;
|
||||||
|
|
||||||
|
///implementing PowerDeviceComponent
|
||||||
|
private PowerDeviceComponent _powerDevice;
|
||||||
|
private bool Powered => _powerDevice.Powered;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -31,6 +36,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||||
.GetBoundUserInterface(MedicalScannerUiKey.Key);
|
.GetBoundUserInterface(MedicalScannerUiKey.Key);
|
||||||
_bodyContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-bodyContainer", Owner);
|
_bodyContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-bodyContainer", Owner);
|
||||||
|
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +85,8 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
|
|
||||||
private void UpdateUserInterface()
|
private void UpdateUserInterface()
|
||||||
{
|
{
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
var newState = GetUserInterfaceState();
|
var newState = GetUserInterfaceState();
|
||||||
_userInterface.SetState(newState);
|
_userInterface.SetState(newState);
|
||||||
}
|
}
|
||||||
@@ -112,6 +120,8 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
_userInterface.Open(actor.playerSession);
|
_userInterface.Open(actor.playerSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
|
|
||||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||||
{
|
{
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (message.Message)
|
switch (message.Message)
|
||||||
{
|
{
|
||||||
case LatheQueueRecipeMessage msg:
|
case LatheQueueRecipeMessage msg:
|
||||||
@@ -89,11 +92,13 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)
|
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();
|
protoDatabase.Sync();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool Produce(LatheRecipePrototype recipe)
|
internal bool Produce(LatheRecipePrototype recipe)
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)) return;
|
if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database)) return;
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (message.Message)
|
switch (message.Message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
var wires = Owner.GetComponent<WiresComponent>();
|
var wires = Owner.GetComponent<WiresComponent>();
|
||||||
if (wires.IsPanelOpen)
|
if (wires.IsPanelOpen)
|
||||||
@@ -121,6 +123,9 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
|||||||
|
|
||||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||||
{
|
{
|
||||||
|
if (!Powered)
|
||||||
|
return;
|
||||||
|
|
||||||
var message = serverMsg.Message;
|
var message = serverMsg.Message;
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
texture: Buildings/chemicals.rsi/industrial_dispenser.png
|
texture: Buildings/chemicals.rsi/industrial_dispenser.png
|
||||||
- type: ReagentDispenser
|
- type: ReagentDispenser
|
||||||
pack: ChemDispenserStandardInventory
|
pack: ChemDispenserStandardInventory
|
||||||
|
- type: PowerDevice
|
||||||
|
|
||||||
- type: reagentDispenserInventory
|
- type: reagentDispenserInventory
|
||||||
id: ChemDispenserStandardInventory
|
id: ChemDispenserStandardInventory
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
map: ["enum.MedicalScannerVisualLayers.Machine"]
|
map: ["enum.MedicalScannerVisualLayers.Machine"]
|
||||||
- state: scanner_terminal_blue
|
- state: scanner_terminal_blue
|
||||||
map: ["enum.MedicalScannerVisualLayers.Terminal"]
|
map: ["enum.MedicalScannerVisualLayers.Terminal"]
|
||||||
|
- type: PowerDevice
|
||||||
- type: Icon
|
- type: Icon
|
||||||
sprite: Buildings/medical_scanner.rsi
|
sprite: Buildings/medical_scanner.rsi
|
||||||
state: scanner_open
|
state: scanner_open
|
||||||
|
|||||||
Reference in New Issue
Block a user