Files
Delta-v/Content.Shared/_Goobstation/Factory/Slots/AutomatedStorage.cs
T
AlgisAlphonse f7db03182a Port goobstation factorio (#4035)
* Initial port of goobstation factorio, missing disposals integration and faxing. Also ports impstations modification for robotic arms to have static power draw. Also adds automation slots to silos and advanced microwave.

* Ports goobstation factorio fax automation, adds to the guidebook entry info about gas canisters.

* Ported Goob Disposals. Removed part about taking
mats out of storage silo cuz it ain't implemented
yet. Seems to work.

* Adds constructor circuitboard to research cuz I
forgor
2025-07-27 13:31:36 +01:00

49 lines
1.3 KiB
C#

// SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
using Content.Shared.Storage;
using Content.Shared.Storage.EntitySystems;
namespace Content.Shared._Goobstation.Factory.Slots;
/// <summary>
/// Abstraction over a <see cref="StorageComponent"/> grid inventory.
/// </summary>
public sealed partial class AutomatedStorage : AutomationSlot
{
private SharedStorageSystem _storage;
private StorageComponent _comp;
public override void Initialize()
{
base.Initialize();
_storage = EntMan.System<SharedStorageSystem>();
_comp = EntMan.GetComponent<StorageComponent>(Owner);
}
public override bool Insert(EntityUid item)
{
return base.Insert(item) &&
_storage.Insert(Owner, item, out _, storageComp: _comp);
}
public override bool CanInsert(EntityUid item)
{
return base.CanInsert(item) &&
_storage.CanInsert(Owner, item, out _, storageComp: _comp);
}
public override EntityUid? GetItem(EntityUid? filter)
{
foreach (var item in _comp.Container.ContainedEntities)
{
if (_filter.IsAllowed(filter, item))
return item;
}
return null;
}
}