Fix disposals bins not automatically flushing after an object is inserted (#25233)
Fix disposals bins not automatically flushing after an object is inserted.
Because of Spaghetti Code™️, AfterInsert() in DisposalUnitSystem still handles insertion itself. Except in all cases except drag/drop insert, the object is already inserted so this check fails and the remaining logic doesn't happen anymore. Fixed now.
(cherry picked from commit 571d4f735888343ca3ba90eaea0908257095cdb9)
This commit is contained in:
parent
a37bd5b2a7
commit
8cdd3d1cb7
|
|
@ -198,7 +198,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
|
||||
return;
|
||||
|
||||
AfterInsert(uid, component, args.Args.Target.Value, args.Args.User);
|
||||
AfterInsert(uid, component, args.Args.Target.Value, args.Args.User, doInsert: true);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||
|
||||
if (delay <= 0 || userId == null)
|
||||
{
|
||||
AfterInsert(unitId, unit, toInsertId, userId);
|
||||
AfterInsert(unitId, unit, toInsertId, userId, doInsert: true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -796,11 +796,11 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||
Dirty(component);
|
||||
}
|
||||
|
||||
public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null)
|
||||
public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null, bool doInsert = false)
|
||||
{
|
||||
_audioSystem.PlayPvs(component.InsertSound, uid);
|
||||
|
||||
if (!_containerSystem.Insert(inserted, component.Container))
|
||||
if (doInsert && !_containerSystem.Insert(inserted, component.Container))
|
||||
return;
|
||||
|
||||
if (user != inserted && user != null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue