Files
tbd-station-14/Content.Shared/Cargo/Components/BankClientComponent.cs
deltanedas 87f7ea8aa9 make cargo balance ui updating its own component (#28295)
* add BankClientComponent and event

* query BankClient instead of hardcoded CargoOrderConsole for updating

* add BankClient to all ordering consoles

* :trollface:

* add Balance field to BankClient

* forgor

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>

* m

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
2024-07-13 16:11:14 +10:00

27 lines
919 B
C#

using Content.Shared.Cargo;
using Robust.Shared.GameStates;
namespace Content.Shared.Cargo.Components;
/// <summary>
/// Makes an entity a client of the station's bank account.
/// When its balance changes it will have <see cref="BankBalanceUpdatedEvent"/> raised on it.
/// Other systems can then use this for logic or to update ui states.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedCargoSystem))]
[AutoGenerateComponentState]
public sealed partial class BankClientComponent : Component
{
/// <summary>
/// The balance updated for the last station this entity was a part of.
/// </summary>
[DataField, AutoNetworkedField]
public int Balance;
}
/// <summary>
/// Raised on an entity with <see cref="BankClientComponent"/> when the bank's balance is updated.
/// </summary>
[ByRefEvent]
public record struct BankBalanceUpdatedEvent(EntityUid Station, int Balance);