diff --git a/Content.Server/GameObjects/Components/Research/LatheComponent.cs b/Content.Server/GameObjects/Components/Research/LatheComponent.cs index 548ef3b368..726a6f17b5 100644 --- a/Content.Server/GameObjects/Components/Research/LatheComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheComponent.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System.Collections.Generic; +using Content.Server.GameObjects.Components.Power; using Content.Server.GameObjects.Components.Stack; using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.Components.Materials; @@ -30,12 +31,15 @@ namespace Content.Server.GameObjects.Components.Research public bool Producing { get; private set; } = false; private LatheRecipePrototype _producingRecipe = null; + private PowerDeviceComponent _powerDevice; + private bool Powered => _powerDevice.Powered; public override void Initialize() { base.Initialize(); _userInterface = Owner.GetComponent().GetBoundUserInterface(LatheUiKey.Key); _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage; + _powerDevice = Owner.GetComponent(); } private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message) @@ -75,7 +79,10 @@ namespace Content.Server.GameObjects.Components.Research } internal bool Produce(LatheRecipePrototype recipe) - { + { if(!Powered) + { + return false; + } if (Producing || !CanProduce(recipe) || !Owner.TryGetComponent(out MaterialStorageComponent storage)) return false; _userInterface.SendMessage(new LatheFullQueueMessage(GetIDQueue())); @@ -111,7 +118,10 @@ namespace Content.Server.GameObjects.Components.Research { if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) return; - + if (!Powered) + { + return; + } OpenUserInterface(actor.playerSession); return; } diff --git a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs index 9992f709fd..f20d45ed51 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs @@ -1,7 +1,9 @@ -using Content.Server.GameObjects.EntitySystems; +using Content.Server.GameObjects.Components.Power; +using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; using Content.Shared.GameObjects.Components.Research; using Content.Shared.Research; +using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.UserInterface; using Robust.Server.GameObjects.EntitySystems; using Robust.Server.Interfaces.GameObjects; @@ -30,13 +32,18 @@ namespace Content.Server.GameObjects.Components.Research private BoundUserInterface _userInterface; private ResearchClientComponent _client; + private PowerDeviceComponent _powerDevice; private const string _soundCollectionName = "keyboard"; + + private bool Powered => _powerDevice.Powered; + public override void Initialize() { base.Initialize(); _userInterface = Owner.GetComponent().GetBoundUserInterface(ResearchConsoleUiKey.Key); _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage; _client = Owner.GetComponent(); + _powerDevice = Owner.GetComponent(); } private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message) @@ -99,7 +106,10 @@ namespace Content.Server.GameObjects.Components.Research { if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) return; - + if (!Powered) + { + return; + } OpenUserInterface(actor.playerSession); PlayKeyboardSound(); return; @@ -112,5 +122,7 @@ namespace Content.Server.GameObjects.Components.Research var audioSystem = _entitySystemManager.GetEntitySystem(); audioSystem.Play(file); } + + } } diff --git a/Resources/Prototypes/Entities/Research.yml b/Resources/Prototypes/Entities/Research.yml index 5eedf1a99c..ce459b32b7 100644 --- a/Resources/Prototypes/Entities/Research.yml +++ b/Resources/Prototypes/Entities/Research.yml @@ -14,7 +14,11 @@ offset: Center - type: ResearchServer - type: TechnologyDatabase - + - type: PowerDevice + drawtype: Both + load: 200 + priority: Low + - type: entity id: baseResearchAndDevelopmentPointSource name: "Base R&D Point Source" diff --git a/Resources/Prototypes/Entities/buildings/computers.yml b/Resources/Prototypes/Entities/buildings/computers.yml index 8e2222d0b2..ccf64ae12b 100644 --- a/Resources/Prototypes/Entities/buildings/computers.yml +++ b/Resources/Prototypes/Entities/buildings/computers.yml @@ -109,7 +109,10 @@ type: ResearchConsoleBoundUserInterface - key: enum.ResearchClientUiKey.Key type: ResearchClientBoundUserInterface - + - type: PowerDevice + drawtype: Both + load: 200 + priority: Low - type: entity id: computerId