* Fixes #4114 Disposals now drop their contents if destroyed or if unwrenched * Update DisposalUnitSystem.cs * Update DisposalUnitSystem.cs
29 lines
906 B
C#
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();
|
|
}
|
|
}
|
|
}
|