mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* better * VendingMachineComponent upd * move components * small fix * move some fields to VendingMachineEjectComponent * move some fields to VendingMachineVisualsComponent * fix * move some fields to VendingMachineDispenseOnHitComponent * move NextEmpEject to VendingMachineEjectComponent * upd * split shared system to eject * no more dummies for name * fix contraband inventory * small fix * and again * move VendingMachineDispenseOnHitComponent to server * upd dispense * upd * move visuals to client * fix * move canshoot to server * fix client * fix * upd * fix merge * fix * upd1 * afterhandlestate * upd * more docs and protoid * upd visuals * upd components * reorganize * Entity<> * revert AfterAutoHandleState
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using Content.Server.Wires;
|
|
using Content.Shared.VendingMachines;
|
|
using Content.Shared.VendingMachines.Components;
|
|
using Content.Shared.Wires;
|
|
|
|
namespace Content.Server.VendingMachines;
|
|
|
|
[DataDefinition]
|
|
public sealed partial class VendingMachineContrabandWireAction : BaseToggleWireAction
|
|
{
|
|
private VendingMachineSystem _vendingMachineSystem = default!;
|
|
|
|
public override Color Color { get; set; } = Color.Green;
|
|
public override string Name { get; set; } = "wire-name-vending-contraband";
|
|
public override object StatusKey => ContrabandWireKey.StatusKey;
|
|
public override object TimeoutKey => ContrabandWireKey.TimeoutKey;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_vendingMachineSystem = EntityManager.System<VendingMachineSystem>();
|
|
}
|
|
|
|
public override StatusLightState? GetLightState(Wire wire)
|
|
{
|
|
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
|
{
|
|
return vending.Contraband
|
|
? StatusLightState.BlinkingSlow
|
|
: StatusLightState.On;
|
|
}
|
|
|
|
return StatusLightState.Off;
|
|
}
|
|
|
|
public override void ToggleValue(EntityUid owner, bool setting)
|
|
{
|
|
if (EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending))
|
|
{
|
|
_vendingMachineSystem.SetContraband((owner, vending), !vending.Contraband);
|
|
}
|
|
}
|
|
|
|
public override bool GetValue(EntityUid owner)
|
|
{
|
|
return EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending) && !vending.Contraband;
|
|
}
|
|
}
|