Files
tbd-station-14/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs
Fiftyllama eb7d65ad5b Disposal drop their contents if they're destroyed or unanchored. Fixes #4114 (#4269)
* Fixes #4114

Disposals now drop their contents if destroyed or if unwrenched

* Update DisposalUnitSystem.cs

* Update DisposalUnitSystem.cs
2021-07-15 20:22:29 -07:00

29 lines
906 B
C#

using Content.Server.Disposal.Unit.Components;
using Content.Server.Construction.Components;
using Robust.Shared.GameObjects;
namespace Content.Server.Disposal.Unit.EntitySystems
{
public sealed class DisposalUnitSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DisposalUnitComponent, AnchoredEvent>(OnAnchored);
SubscribeLocalEvent<DisposalUnitComponent, UnanchoredEvent>(OnUnanchored);
}
private static void OnAnchored(EntityUid uid, DisposalUnitComponent component, AnchoredEvent args)
{
component.UpdateVisualState();
}
private static void OnUnanchored(EntityUid uid, DisposalUnitComponent component, UnanchoredEvent args)
{
component.UpdateVisualState();
component.TryEjectContents();
}
}
}