@@ -1,4 +1,4 @@
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -12,18 +12,28 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (Owner.TryGetComponent(out PowerDeviceComponent powerDevice))
|
||||
if (Owner.TryGetComponent(out PowerReceiverComponent powerReceiver))
|
||||
{
|
||||
powerDevice.OnPowerStateChanged += PowerDeviceOnOnPowerStateChanged;
|
||||
powerReceiver.OnPowerStateChanged += PowerReceiverOnOnPowerStateChanged;
|
||||
|
||||
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||
{
|
||||
appearance.SetData(ComputerVisuals.Powered, powerDevice.Powered);
|
||||
appearance.SetData(ComputerVisuals.Powered, powerReceiver.Powered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PowerDeviceOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
|
||||
public override void OnRemove()
|
||||
{
|
||||
if (Owner.TryGetComponent(out PowerReceiverComponent powerReceiver))
|
||||
{
|
||||
powerReceiver.OnPowerStateChanged -= PowerReceiverOnOnPowerStateChanged;
|
||||
}
|
||||
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
private void PowerReceiverOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
|
||||
{
|
||||
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user