Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature add etrd stat tracking #789

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add EnergyTerminalReceivedDomestic stat tracking
schealex committed Apr 4, 2024
commit 2863e4732850d93b5cb622d61be74fa29b4a6802
2 changes: 2 additions & 0 deletions src/constants/stats.ts
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ export enum RoomStatsKeys {
MinHaulerCost = 'mhc',
EnergyOutputTransactionCosts = 'eotc',
EnergyTerminalSentDomestic = 'etsd',
EnergyTerminalReceivedDomestic = 'etrd',
EnergyTerminalSentOther = 'etso',
CpuUsed = 'cpu',

@@ -61,6 +62,7 @@ export const averageStatNames: Set<keyof CommuneStats | keyof RoomStats> = new S
RoomStatsKeys.RemoteEnergyOutputBuild,
RoomStatsKeys.EnergyOutputTransactionCosts,
RoomStatsKeys.EnergyTerminalSentDomestic,
RoomStatsKeys.EnergyTerminalReceivedDomestic,
RoomStatsKeys.EnergyTerminalSentOther,
RoomStatsKeys.CpuUsed,
])
1 change: 1 addition & 0 deletions src/international/stats.ts
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ export class StatsManager {
[RoomStatsKeys.MinHaulerCost]: 0,
[RoomStatsKeys.EnergyOutputTransactionCosts]: 0,
[RoomStatsKeys.EnergyTerminalSentDomestic]: 0,
[RoomStatsKeys.EnergyTerminalReceivedDomestic]: 0,
[RoomStatsKeys.EnergyTerminalSentOther]: 0,
[RoomStatsKeys.CpuUsed]: 0,
})
5 changes: 5 additions & 0 deletions src/international/transactions.ts
Original file line number Diff line number Diff line change
@@ -90,6 +90,11 @@ export class TransactionsManager {
RoomStatsKeys.EnergyTerminalSentDomestic,
transaction.amount,
)
StatsManager.updateCommuneStat(
transaction.to,
RoomStatsKeys.EnergyTerminalReceivedDomestic,
transaction.amount,
)
}
// Not a domestic trade
else {
1 change: 1 addition & 0 deletions src/types/stats.ts
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ export interface CommuneStats extends RoomStats {
[RoomStatsKeys.MinHaulerCost]: number
[RoomStatsKeys.EnergyOutputTransactionCosts]: number
[RoomStatsKeys.EnergyTerminalSentDomestic]: number
[RoomStatsKeys.EnergyTerminalReceivedDomestic]: number
[RoomStatsKeys.EnergyTerminalSentOther]: number
[RoomStatsKeys.BatteriesStoredTimes10]: number
[RoomStatsKeys.CpuUsed]: number