1
0

BankClientComponent.cs 900 B

12345678910111213141516171819202122232425
  1. using Robust.Shared.GameStates;
  2. namespace Content.Shared.Cargo.Components;
  3. /// <summary>
  4. /// Makes an entity a client of the station's bank account.
  5. /// When its balance changes it will have <see cref="BankBalanceUpdatedEvent"/> raised on it.
  6. /// Other systems can then use this for logic or to update ui states.
  7. /// </summary>
  8. [RegisterComponent, NetworkedComponent, Access(typeof(SharedCargoSystem))]
  9. [AutoGenerateComponentState]
  10. public sealed partial class BankClientComponent : Component
  11. {
  12. /// <summary>
  13. /// The balance updated for the last station this entity was a part of.
  14. /// </summary>
  15. [DataField, AutoNetworkedField]
  16. public int Balance;
  17. }
  18. /// <summary>
  19. /// Raised on an entity with <see cref="BankClientComponent"/> when the bank's balance is updated.
  20. /// </summary>
  21. [ByRefEvent]
  22. public readonly record struct BankBalanceUpdatedEvent(EntityUid Station, int Balance);