Files
tbd-station-14/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
metalgearsloth b87806f7ed Fix some build warnings (#6832)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
2022-02-21 14:41:50 +11:00

35 lines
1.4 KiB
C#

using Content.Server.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Emag.Systems;
using Content.Shared.Chemistry.Dispenser;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.EntitySystems
{
[UsedImplicitly]
public sealed class ReagentDispenserSystem : SharedReagentDispenserSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ReagentDispenserComponent, ComponentStartup>((_, comp, _) => comp.UpdateUserInterface());
SubscribeLocalEvent<ReagentDispenserComponent, SolutionChangedEvent>((_, comp, _) => comp.UpdateUserInterface());
SubscribeLocalEvent<ReagentDispenserComponent, EntInsertedIntoContainerMessage>((_, comp, _) => comp.UpdateUserInterface());
SubscribeLocalEvent<ReagentDispenserComponent, EntRemovedFromContainerMessage>((_, comp, _) => comp.UpdateUserInterface());
SubscribeLocalEvent<ReagentDispenserComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnEmagged(EntityUid uid, ReagentDispenserComponent comp, GotEmaggedEvent args)
{
if (!comp.AlreadyEmagged)
{
comp.AddFromPrototype(comp.EmagPackPrototypeId);
comp.AlreadyEmagged = true;
args.Handled = true;
}
}
}
}