Skip to content

Conversation

@alexalexmax
Copy link
Contributor

About the PR

I replaced the Accounts and RevenueDistribution fields of StationBankAccountComponent with a single field that uses a CargoAccountData record. I updated all uses of Accounts and RevenueDistribution to use the new field.

Why / Balance

The way it was handled made it really annoying to add new fields for cargo accounts. Each field had its own dictionary mapping accounts to a value. The keys in the dictionaries were all coupled and values were hardcoded into the component.

In the future, new fields can be created by adding a new datafield to CargoAccountData and adjusting the constructor.

Technical details

Replaced the Accounts and RevenueDistribution fields of StationBankAccountComponent with a single field that uses a CargoAccountData record.
Updated all uses of Accounts and RevenueDistribution to use the new field.
Created CargoAccountData record with Balance and RevenueDistribution fields.
Added TryGetAccountBalance. It does what TryGetAccount used to do, but is named better.
TryGetAccount now gets the CargoAccountData and not the balance.

Unhardcoded default balance and distribution values and moved them into base.yml.

Media

Requirements

Breaking changes

StationBankAccountComponent.Accounts is now a dictionary mapping accounts to CargoAccountData. The values that were previously held in StationBankAccountComponent.Accounts and StationBankAccountComponent.RevenueDistribution are now stored in the CargoAccountData in StationBankAccountComponent.Accounts.

TryGetAccount now gets the CargoAccountData and not the balance. Use TryGetAccountBalance to achieve the same effect as the old TryGetAccount.

Changelog

not player facing

@PJBot PJBot added S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. size/M Denotes a PR that changes 100-999 lines. Changes: UI Changes: Might require knowledge of UI design or code. labels Jan 2, 2026
@Pok27 Pok27 added P3: Standard Priority: Default priority for repository items. T: Refactor Type: Refactor of notable amount of codebase D3: Low Difficulty: Some codebase knowledge required. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Jan 2, 2026
@PJBot PJBot added S: Awaiting Changes Status: Changes are required before another review can happen and removed S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. labels Jan 7, 2026
@PJBot PJBot added S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. and removed S: Awaiting Changes Status: Changes are required before another review can happen labels Jan 8, 2026
@alexalexmax
Copy link
Contributor Author

requested changes made;

  • CargoAccountData implements IRobustCloneable and is a class now
  • CreateAccountDistribution has an ignorePrimaryAccount parameter which defaults to false
  • The timed addition of funds now correctly ignores the primary account
  • Cleanup unused dependencies and redundant code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes: UI Changes: Might require knowledge of UI design or code. D3: Low Difficulty: Some codebase knowledge required. P3: Standard Priority: Default priority for repository items. S: Needs Review Status: Requires additional reviews before being fully accepted. Not to be replaced by S: Approved. size/M Denotes a PR that changes 100-999 lines. T: Refactor Type: Refactor of notable amount of codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants