2021-07-16 05:22:29 +02:00
|
|
|
using Content.Server.Disposal.Unit.Components;
|
|
|
|
|
using Content.Server.Construction.Components;
|
2021-05-13 02:05:46 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Disposal.Unit.EntitySystems
|
2021-05-13 02:05:46 +02:00
|
|
|
{
|
|
|
|
|
public sealed class DisposalUnitSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2021-07-16 05:22:29 +02:00
|
|
|
SubscribeLocalEvent<DisposalUnitComponent, AnchoredEvent>(OnAnchored);
|
|
|
|
|
SubscribeLocalEvent<DisposalUnitComponent, UnanchoredEvent>(OnUnanchored);
|
2021-05-13 02:05:46 +02:00
|
|
|
}
|
|
|
|
|
|
2021-07-16 05:22:29 +02:00
|
|
|
private static void OnAnchored(EntityUid uid, DisposalUnitComponent component, AnchoredEvent args)
|
2021-05-13 02:05:46 +02:00
|
|
|
{
|
|
|
|
|
component.UpdateVisualState();
|
|
|
|
|
}
|
2021-07-16 05:22:29 +02:00
|
|
|
|
|
|
|
|
private static void OnUnanchored(EntityUid uid, DisposalUnitComponent component, UnanchoredEvent args)
|
|
|
|
|
{
|
|
|
|
|
component.UpdateVisualState();
|
|
|
|
|
component.TryEjectContents();
|
|
|
|
|
}
|
2021-05-13 02:05:46 +02:00
|
|
|
}
|
|
|
|
|
}
|