Skip to content

Commit

Permalink
fix again without reparenting
Browse files Browse the repository at this point in the history
  • Loading branch information
goet committed Sep 24, 2024
1 parent 7196c77 commit 5dace9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ 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 { get; } = ContrabandWireKey.StatusKey;
public override object? TimeoutKey { get; } = 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))
Expand All @@ -28,7 +37,7 @@ public override void ToggleValue(EntityUid owner, bool setting)
{
if (EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending))
{
vending.Contraband = !setting;
_vendingMachineSystem.SetContraband(owner, !vending.Contraband, vending);
}
}

Expand Down
1 change: 1 addition & 0 deletions Content.Shared/VendingMachines/VendingMachineComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public sealed partial class VendingMachineComponent : Component
[DataField, AutoNetworkedField]
public Dictionary<string, VendingMachineInventoryEntry> ContrabandInventory = new();

[DataField, AutoNetworkedField]
public bool Contraband;

public bool Ejecting;
Expand Down

0 comments on commit 5dace9e

Please sign in to comment.