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
This commit is contained in:
Fiftyllama
2021-07-16 05:22:29 +02:00
committed by GitHub
parent fc9a15b288
commit eb7d65ad5b
2 changed files with 19 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ using Content.Server.Interfaces;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.ActionBlocker;
using Content.Shared.Acts;
using Content.Shared.Atmos;
using Content.Shared.Disposal.Components;
using Content.Shared.DragDrop;
@@ -42,7 +43,7 @@ namespace Content.Server.Disposal.Unit.Components
[ComponentReference(typeof(SharedDisposalUnitComponent))]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IInteractUsing))]
public class DisposalUnitComponent : SharedDisposalUnitComponent, IInteractHand, IActivate, IInteractUsing, IThrowCollide, IGasMixtureHolder
public class DisposalUnitComponent : SharedDisposalUnitComponent, IInteractHand, IActivate, IInteractUsing, IThrowCollide, IGasMixtureHolder, IDestroyAct
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
@@ -304,7 +305,7 @@ namespace Content.Server.Disposal.Unit.Components
return true;
}
private void TryEjectContents()
public void TryEjectContents()
{
foreach (var entity in _container.ContainedEntities.ToArray())
{
@@ -690,5 +691,10 @@ namespace Content.Server.Disposal.Unit.Components
component.TryFlush();
}
}
void IDestroyAct.OnDestroy(DestructionEventArgs eventArgs)
{
TryEjectContents();
}
}
}