@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
||||
#pragma warning restore 649
|
||||
private AppearanceComponent _appearance;
|
||||
private BoundUserInterface _userInterface;
|
||||
private PowerDeviceComponent _powerDevice;
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
|
||||
private bool _ejecting = false;
|
||||
private TimeSpan _animationDuration = TimeSpan.Zero;
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
||||
private string _description;
|
||||
private string _spriteName;
|
||||
|
||||
private bool Powered => _powerDevice.Powered;
|
||||
private bool Powered => _powerReceiver.Powered;
|
||||
private bool _broken = false;
|
||||
|
||||
public void Activate(ActivateEventArgs eventArgs)
|
||||
@@ -103,16 +103,17 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||
.GetBoundUserInterface(VendingMachineUiKey.Key);
|
||||
_userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_powerDevice.OnPowerStateChanged += UpdatePower;
|
||||
_powerReceiver = Owner.GetComponent<PowerReceiverComponent>();
|
||||
_powerReceiver.OnPowerStateChanged += UpdatePower;
|
||||
TrySetVisualState(_powerReceiver.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off);
|
||||
InitializeFromPrototype();
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
{
|
||||
_appearance = null;
|
||||
_powerDevice.OnPowerStateChanged -= UpdatePower;
|
||||
_powerDevice = null;
|
||||
_powerReceiver.OnPowerStateChanged -= UpdatePower;
|
||||
_powerReceiver = null;
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user