Fix recycled containers deleting items inside them (#26045)
* Removes items from containers in reclaimers * Made it into an event instead * Sloth review comment * Fix indentation and rename field
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Hands.Components;
|
||||
@@ -11,6 +12,7 @@ using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
@@ -95,6 +97,9 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
SubscribeAllEvent<StorageSetItemLocationEvent>(OnSetItemLocation);
|
||||
SubscribeAllEvent<StorageInsertItemIntoLocationEvent>(OnInsertItemIntoLocation);
|
||||
SubscribeAllEvent<StorageRemoveItemEvent>(OnRemoveItem);
|
||||
|
||||
SubscribeLocalEvent<StorageComponent, GotReclaimedEvent>(OnReclaimed);
|
||||
|
||||
UpdatePrototypeCache();
|
||||
}
|
||||
|
||||
@@ -388,6 +393,11 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnReclaimed(EntityUid uid, StorageComponent storageComp, GotReclaimedEvent args)
|
||||
{
|
||||
_containerSystem.EmptyContainer(storageComp.Container, destination: args.ReclaimerCoordinates);
|
||||
}
|
||||
|
||||
private void OnDestroy(EntityUid uid, StorageComponent storageComp, DestructionEventArgs args)
|
||||
{
|
||||
var coordinates = TransformSystem.GetMoverCoordinates(uid);
|
||||
|
||||
Reference in New Issue
Block a user