DumpableComponent on an empty container no longer stops other interactions (#22831)

DumpableComponent does not block the entity from being disposed via InteractOn a DisposalUnit
This commit is contained in:
LordCarve 2023-12-22 05:26:40 +01:00 committed by Debug
parent 9d6fc40a3e
commit 65a15cada1
1 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,6 @@ using Content.Shared.Interaction;
using Content.Shared.Placeable;
using Content.Shared.Storage.Components;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Random;
@ -42,6 +41,12 @@ public sealed class DumpableSystem : EntitySystem
if (!_disposalUnitSystem.HasDisposals(args.Target) && !HasComp<PlaceableSurfaceComponent>(args.Target))
return;
if (!TryComp<StorageComponent>(uid, out var storage))
return;
if (!storage.Container.ContainedEntities.Any())
return;
StartDoAfter(uid, args.Target.Value, args.User, component);
args.Handled = true;
}
@ -103,12 +108,12 @@ public sealed class DumpableSystem : EntitySystem
}
}
public void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable)
private void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable)
{
if (!TryComp<StorageComponent>(storageUid, out var storage))
return;
float delay = storage.Container.ContainedEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
var delay = storage.Container.ContainedEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, userUid, delay, new DumpableDoAfterEvent(), storageUid, target: targetUid, used: storageUid)
{