Files
crystall-punk-14/Content.Server/Cargo/Systems/CargoSystem.cs

59 lines
1.6 KiB
C#
Raw Normal View History

2022-06-23 14:36:47 +10:00
using Content.Server.Cargo.Components;
using Content.Server.Station.Systems;
using Content.Shared.Cargo;
using Content.Shared.Containers.ItemSlots;
2023-03-10 16:41:22 +11:00
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.Cargo.Systems;
public sealed partial class CargoSystem : SharedCargoSystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly ItemSlotsSystem _slots = default!;
2023-01-10 04:55:59 -05:00
[Dependency] private readonly SharedAudioSystem _audio = default!;
2022-06-23 14:36:47 +10:00
private ISawmill _sawmill = default!;
public override void Initialize()
{
base.Initialize();
2022-06-23 14:36:47 +10:00
_sawmill = Logger.GetSawmill("cargo");
InitializeConsole();
2022-06-23 14:36:47 +10:00
InitializeShuttle();
InitializeTelepad();
2022-06-23 14:36:47 +10:00
}
public override void Shutdown()
{
base.Shutdown();
2023-05-31 11:13:02 +10:00
CleanupCargoShuttle();
2022-06-23 14:36:47 +10:00
}
public override void Update(float frameTime)
{
base.Update(frameTime);
UpdateConsole(frameTime);
UpdateTelepad(frameTime);
}
2023-03-10 16:41:22 +11:00
[PublicAPI]
2023-05-31 11:13:02 +10:00
public void UpdateBankAccount(EntityUid uid, StationBankAccountComponent component, int balanceAdded)
{
2023-01-10 04:55:59 -05:00
component.Balance += balanceAdded;
2023-05-31 11:13:02 +10:00
var query = EntityQueryEnumerator<CargoOrderConsoleComponent>();
while (query.MoveNext(out var oUid, out var oComp))
2023-03-10 16:41:22 +11:00
{
2023-05-31 11:13:02 +10:00
if (!_uiSystem.IsUiOpen(oUid, CargoConsoleUiKey.Orders))
continue;
2023-03-10 16:41:22 +11:00
2023-05-31 11:13:02 +10:00
var station = _station.GetOwningStation(oUid);
if (station != uid)
2023-03-10 16:41:22 +11:00
continue;
2023-05-31 11:13:02 +10:00
UpdateOrderState(oComp, station);
2023-03-10 16:41:22 +11:00
}
}
}