@@ -20,6 +20,7 @@ using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Timers;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Research
|
||||
{
|
||||
@@ -47,8 +48,8 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
}
|
||||
|
||||
private LatheRecipePrototype _producingRecipe = null;
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
private bool Powered => _powerReceiver.Powered;
|
||||
|
||||
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
||||
|
||||
@@ -57,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
base.Initialize();
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(LatheUiKey.Key);
|
||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_powerReceiver = Owner.GetComponent<PowerReceiverComponent>();
|
||||
_appearance = Owner.GetComponent<AppearanceComponent>();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Audio;
|
||||
@@ -31,10 +32,10 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
|
||||
private BoundUserInterface _userInterface;
|
||||
private ResearchClientComponent _client;
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
private const string _soundCollectionName = "keyboard";
|
||||
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
private bool Powered => _powerReceiver.Powered;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -42,7 +43,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(ResearchConsoleUiKey.Key);
|
||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
_client = Owner.GetComponent<ResearchClientComponent>();
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_powerReceiver = Owner.GetComponent<PowerReceiverComponent>();
|
||||
}
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -14,7 +15,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
|
||||
private int _pointsPerSecond;
|
||||
private bool _active;
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
|
||||
[ViewVariables]
|
||||
public int PointsPerSecond
|
||||
@@ -33,13 +34,13 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
/// <summary>
|
||||
/// Whether this can be used to produce research points.
|
||||
/// </summary>
|
||||
/// <remarks>If no <see cref="PowerDeviceComponent"/> is found, it's assumed power is not required.</remarks>
|
||||
public bool CanProduce => Active && (_powerDevice is null || _powerDevice.Powered);
|
||||
/// <remarks>If no <see cref="PowerReceiverComponent"/> is found, it's assumed power is not required.</remarks>
|
||||
public bool CanProduce => Active && (_powerReceiver is null || _powerReceiver.Powered);
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Owner.TryGetComponent(out _powerDevice);
|
||||
Owner.TryGetComponent(out _powerReceiver);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
|
||||
@@ -9,6 +9,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Research
|
||||
{
|
||||
@@ -65,11 +66,11 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks>If no <see cref="PowerDeviceComponent"/> is found, it's assumed power is not required.</remarks>
|
||||
/// <remarks>If no <see cref="PowerReceiverComponent"/> is found, it's assumed power is not required.</remarks>
|
||||
[ViewVariables]
|
||||
public bool CanRun => _powerDevice is null || _powerDevice.Powered;
|
||||
public bool CanRun => _powerReceiver is null || _powerReceiver.Powered;
|
||||
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -77,7 +78,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
Id = ServerCount++;
|
||||
EntitySystem.Get<ResearchSystem>()?.RegisterServer(this);
|
||||
Database = Owner.GetComponent<TechnologyDatabaseComponent>();
|
||||
Owner.TryGetComponent(out _powerDevice);
|
||||
Owner.TryGetComponent(out _powerReceiver);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user