2021-10-05 14:29:03 +11:00
|
|
|
using Content.Server.Chemistry.Components;
|
2021-11-24 20:03:07 +13:00
|
|
|
using Content.Shared.Chemistry.EntitySystems;
|
2022-02-17 21:43:24 -05:00
|
|
|
using Content.Shared.Emag.Systems;
|
|
|
|
|
using Content.Shared.Chemistry.Dispenser;
|
2021-09-06 15:49:44 +02:00
|
|
|
using JetBrains.Annotations;
|
2021-11-02 09:04:07 +00:00
|
|
|
using Robust.Shared.Containers;
|
2022-02-17 21:43:24 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-09-06 15:49:44 +02:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.EntitySystems
|
|
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2021-11-24 20:03:07 +13:00
|
|
|
public sealed class ReagentDispenserSystem : SharedReagentDispenserSystem
|
2021-09-06 15:49:44 +02:00
|
|
|
{
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
2021-11-24 20:03:07 +13:00
|
|
|
SubscribeLocalEvent<ReagentDispenserComponent, ComponentStartup>((_, comp, _) => comp.UpdateUserInterface());
|
|
|
|
|
SubscribeLocalEvent<ReagentDispenserComponent, SolutionChangedEvent>((_, comp, _) => comp.UpdateUserInterface());
|
|
|
|
|
SubscribeLocalEvent<ReagentDispenserComponent, EntInsertedIntoContainerMessage>((_, comp, _) => comp.UpdateUserInterface());
|
|
|
|
|
SubscribeLocalEvent<ReagentDispenserComponent, EntRemovedFromContainerMessage>((_, comp, _) => comp.UpdateUserInterface());
|
2022-02-17 21:43:24 -05:00
|
|
|
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;
|
|
|
|
|
}
|
2021-09-06 15:49:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|