Skip to content

Commit

Permalink
Vending machine repairability
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnemotechnician committed Jan 26, 2025
1 parent cafd4d7 commit 3586311
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Content.Shared.Emag.Systems;
using Content.Shared.Emp;
using Content.Shared.Popups;
using Content.Shared.Repairable;
using Content.Shared.Throwing;
using Content.Shared.UserInterface;
using Content.Shared.VendingMachines;
Expand Down Expand Up @@ -46,6 +47,7 @@ public override void Initialize()
SubscribeLocalEvent<VendingMachineComponent, MapInitEvent>(OnComponentMapInit);
SubscribeLocalEvent<VendingMachineComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<VendingMachineComponent, BreakageEventArgs>(OnBreak);
SubscribeLocalEvent<VendingMachineComponent, SharedRepairableSystem.RepairFinishedEvent>(OnRepaired); // Floofstation
SubscribeLocalEvent<VendingMachineComponent, GotEmaggedEvent>(OnEmagged);
SubscribeLocalEvent<VendingMachineComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<VendingMachineComponent, PriceCalculationEvent>(OnVendingPrice);
Expand Down Expand Up @@ -88,7 +90,6 @@ private void OnVendingPrice(EntityUid uid, VendingMachineComponent component, re

args.Price += price;
}

protected override void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
{
base.OnComponentInit(uid, component, args);
Expand Down Expand Up @@ -139,6 +140,17 @@ private void OnBreak(EntityUid uid, VendingMachineComponent vendComponent, Break
TryUpdateVisualState(uid, vendComponent);
}

// Floofstation
private void OnRepaired(EntityUid uid, VendingMachineComponent component, SharedRepairableSystem.RepairFinishedEvent args)
{
if (args.Cancelled)
return;

// TODO it is not actually safe to assume that the repair repaired enough damage
component.Broken = false;
TryUpdateVisualState(uid, component);
}

private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref GotEmaggedEvent args)
{
// only emag if there are emag-only items
Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/Repairable/SharedRepairableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace Content.Shared.Repairable;

public abstract partial class SharedRepairableSystem : EntitySystem
{
// Floof - made public because WHY THE FUCK WAS THIS PRIVATE?!
[Serializable, NetSerializable]
protected sealed partial class RepairFinishedEvent : SimpleDoAfterEvent
public sealed partial class RepairFinishedEvent : SimpleDoAfterEvent
{
}
}
Expand Down

0 comments on commit 3586311

Please sign in to comment.