mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
* 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
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
// SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
|
|
// SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Shared._Goobstation.Factory.Slots;
|
|
|
|
/// <summary>
|
|
/// Abstraction over a <see cref="BaseContainer"/> on the machine.
|
|
/// </summary>
|
|
public sealed partial class AutomatedContainer : AutomationSlot
|
|
{
|
|
/// <summary>
|
|
/// The ID of the container to use.
|
|
/// </summary>
|
|
[DataField(required: true)]
|
|
public string ContainerId = string.Empty;
|
|
|
|
[DataField(required: true)]
|
|
public int MaxItems;
|
|
|
|
private SharedContainerSystem _container;
|
|
|
|
public BaseContainer Container;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_container = EntMan.System<SharedContainerSystem>();
|
|
|
|
Container = _container.GetContainer(Owner, ContainerId);
|
|
}
|
|
|
|
public override bool Insert(EntityUid item)
|
|
{
|
|
return base.Insert(item) && _container.Insert(item, Container);
|
|
}
|
|
|
|
public override bool CanInsert(EntityUid item)
|
|
{
|
|
return base.CanInsert(item)
|
|
&& Container.Count < MaxItems
|
|
&& _container.CanInsert(item, Container);
|
|
}
|
|
|
|
public override EntityUid? GetItem(EntityUid? filter)
|
|
{
|
|
foreach (var item in Container.ContainedEntities)
|
|
{
|
|
if (_filter.IsAllowed(filter, item))
|
|
return item;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|