Make chemistry machines and IdCardConsole use item slots (#5428)
* chemistry item slots * item slots id card console
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Server.Construction.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
|
||||
namespace Content.Server.Containers
|
||||
{
|
||||
@@ -18,6 +17,17 @@ namespace Content.Server.Containers
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<EmptyOnMachineDeconstructComponent, MachineDeconstructedEvent>(OnDeconstruct);
|
||||
SubscribeLocalEvent<ItemSlotsComponent, MachineDeconstructedEvent>(OnSlotsDeconstruct);
|
||||
}
|
||||
|
||||
// really this should be handled by ItemSlotsSystem, but for whatever reason MachineDeconstructedEvent is server-side? So eh.
|
||||
private void OnSlotsDeconstruct(EntityUid uid, ItemSlotsComponent component, MachineDeconstructedEvent args)
|
||||
{
|
||||
foreach (var slot in component.Slots.Values)
|
||||
{
|
||||
if (slot.EjectOnDeconstruct && slot.Item != null)
|
||||
slot.ContainerSlot.Remove(slot.Item);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDeconstruct(EntityUid uid, EmptyOnMachineDeconstructComponent component, MachineDeconstructedEvent ev)
|
||||
|
||||
Reference in New Issue
Block a user