Wire action cleanup (#13496)

This commit is contained in:
Leon Friedrich
2023-01-21 12:51:02 +13:00
committed by GitHub
parent 319cf162fd
commit b20b4b11cc
21 changed files with 294 additions and 627 deletions

View File

@@ -7,25 +7,21 @@ namespace Content.Server.VendingMachines;
[DataDefinition]
public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
{
private readonly Color _color = Color.Green;
private readonly string _text = "MNGR";
public override Color Color { get; set; } = Color.Green;
public override string Name { get; set; } = "wire-name-vending-contraband";
public override object? StatusKey { get; } = ContrabandWireKey.StatusKey;
public override object? TimeoutKey { get; } = ContrabandWireKey.TimeoutKey;
public override StatusLightData? GetStatusLightData(Wire wire)
public override StatusLightState? GetLightState(Wire wire)
{
var lightState = StatusLightState.Off;
if (IsPowered(wire.Owner) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
{
lightState = vending.Contraband
return vending.Contraband
? StatusLightState.BlinkingSlow
: StatusLightState.On;
}
return new StatusLightData(
_color,
lightState,
_text);
return StatusLightState.Off;
}
public override void ToggleValue(EntityUid owner, bool setting)