Skip to content

Commit

Permalink
Change how plugins register escalations
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyFuller committed Apr 18, 2023
1 parent 6c787f3 commit 0edf996
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions components/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,22 +672,25 @@ export class Controller {
/**
* Adds an escalation to the game.
*
* @param groupId The escalation group ID. All levels must have the `Metadata.InGroup` value set to this!
* @param groupContract The escalation group contract, ALL levels must have the Id of this in Metadata.InGroup
* @param locationId The location of the escalation's ID.
* @param levels The escalation's levels.
*/
public addEscalation(
groupId: string,
groupContract: MissionManifest,
locationId: string,
...levels: MissionManifest[]
): void {
const fixedLevels = [...levels].filter(Boolean)

this.addMission(groupContract)
fixedLevels.forEach((level) => this.addMission(level))

this.missionsInLocations.escalations[locationId] ??= []

this.missionsInLocations.escalations[locationId].push(groupId)
this.missionsInLocations.escalations[locationId].push(
groupContract.Metadata.Id,
)

this.scanForGroups()
}
Expand Down
2 changes: 1 addition & 1 deletion components/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ export interface MissionManifestMetadata {
// Begin escalation-exclusive properties
InGroup?: string
NextContractId?: string
GroupDefinition?: ContractGroupDefinition
GroupData?: {
Level: number
TotalLevels: number
Expand All @@ -920,7 +921,6 @@ export interface MissionManifestMetadata {
IsEvergreenSafehouse?: boolean
UseContractProgressionData?: boolean
CpdId?: string
GroupDefinition?: ContractGroupDefinition
// Elusive custom property (like official's year)
Season?: number
}
Expand Down

0 comments on commit 0edf996

Please sign in to comment.