mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 16:17:27 +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
2.1 KiB
C#
60 lines
2.1 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 Content.Shared._Goobstation.Factory;
|
|
using Content.Server.DeviceLinking.Systems;
|
|
using Content.Shared.DeviceLinking;
|
|
using Content.Shared.Singularity.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server._Goobstation.Singularity;
|
|
|
|
public sealed class RadCollectorSignalSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly AutomationSystem _automation = default!;
|
|
[Dependency] private readonly DeviceLinkSystem _device = default!;
|
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
|
|
|
public static readonly ProtoId<SourcePortPrototype> EmptyPort = "RadEmpty";
|
|
public static readonly ProtoId<SourcePortPrototype> LowPort = "RadLow";
|
|
public static readonly ProtoId<SourcePortPrototype> FullPort = "RadFull";
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var query = EntityQueryEnumerator<RadCollectorSignalComponent>();
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
if (!_automation.IsAutomated(uid))
|
|
continue;
|
|
|
|
var ent = (uid, comp);
|
|
_appearance.TryGetData<int>(uid, RadiationCollectorVisuals.PressureState, out var rawState);
|
|
var state = rawState switch
|
|
{
|
|
3 => RadCollectorState.Full,
|
|
2 => RadCollectorState.Low,
|
|
_ => RadCollectorState.Empty
|
|
};
|
|
|
|
// nothing changed
|
|
if (comp.LastState == state)
|
|
continue;
|
|
|
|
_device.SendSignal(uid, GetPort(comp.LastState), false);
|
|
comp.LastState = state;
|
|
_device.SendSignal(uid, GetPort(state), true);
|
|
}
|
|
}
|
|
|
|
private static string GetPort(RadCollectorState state) => state switch
|
|
{
|
|
RadCollectorState.Empty => EmptyPort,
|
|
RadCollectorState.Low => LowPort,
|
|
RadCollectorState.Full => FullPort
|
|
};
|
|
}
|