Skip to content

Commit

Permalink
dedup type and const array definitions of player actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Jamrozik committed Jul 10, 2024
1 parent 2370728 commit 8a166c7
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions web/src/lib/codesync/PlayerActionEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,27 @@ export type PlayerActionEvent = GameEventBase & {
readonly TargetId: number | undefined
}

export type PlayerActionName =
| 'AdvanceTimePlayerAction'
| 'BuyTransportCapacityPlayerAction'
| 'HireAgentsPlayerAction'
| 'LaunchMissionPlayerAction'
| 'InvestIntelPlayerAction'
| AgentPlayerActionName
export const AgentPlayerActionNameVal = [
'RecallAgentsPlayerAction',
'SackAgentsPlayerAction',
'SendAgentsToGatherIntelPlayerAction',
'SendAgentsToGenerateIncomePlayerAction',
'SendAgentsToTrainingPlayerAction',
] as const

export type AgentPlayerActionName =
| 'SackAgentsPlayerAction'
| 'SendAgentsToGenerateIncomePlayerAction'
| 'SendAgentsToGatherIntelPlayerAction'
| 'SendAgentsToTrainingPlayerAction'
| 'RecallAgentsPlayerAction'
export type AgentPlayerActionName = (typeof AgentPlayerActionNameVal)[number]

export const PlayerActionNameVal: PlayerActionName[] = [
export const PlayerActionNameVal = [
'AdvanceTimePlayerAction',
'BuyTransportCapacityPlayerAction',
'HireAgentsPlayerAction',
'InvestIntelPlayerAction',
'LaunchMissionPlayerAction',
'SackAgentsPlayerAction',
'SendAgentsToGenerateIncomePlayerAction',
'SendAgentsToGatherIntelPlayerAction',
'SendAgentsToTrainingPlayerAction',
'RecallAgentsPlayerAction',
]
...AgentPlayerActionNameVal,
] as const

export type PlayerActionName = (typeof PlayerActionNameVal)[number]

export type PlayerActionNameInTurn = Exclude<
PlayerActionName,
Expand Down

0 comments on commit 8a166c7

Please sign in to comment.