mirror of
https://github.com/thepeacockproject/Peacock
synced 2024-11-22 22:12:45 +01:00
Expose SMF lastDeploy to plugins
This commit is contained in:
parent
f1d6bf82aa
commit
1777a283e4
@ -390,9 +390,9 @@ export class Controller {
|
||||
escalationMappings: Map<string, Record<string, string>> = new Map()
|
||||
public progressionService: ProgressionService
|
||||
/**
|
||||
* A list of Simple Mod Framework mods installed.
|
||||
* SMF's lastDeploy.json
|
||||
*/
|
||||
public readonly installedMods: readonly string[]
|
||||
public readonly lastDeploy: SMFLastDeploy
|
||||
private _pubIdToContractId: Map<string, string> = new Map()
|
||||
/** Internal elusive target contracts - only accessible during bootstrap. */
|
||||
private _internalElusives: MissionManifest[] | undefined
|
||||
@ -418,15 +418,13 @@ export class Controller {
|
||||
}
|
||||
|
||||
if (modFrameworkDataPath && existsSync(modFrameworkDataPath)) {
|
||||
this.installedMods = (
|
||||
parse(
|
||||
readFileSync(modFrameworkDataPath!).toString(),
|
||||
) as SMFLastDeploy
|
||||
)?.loadOrder as readonly string[]
|
||||
this.lastDeploy = parse(
|
||||
readFileSync(modFrameworkDataPath!).toString(),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
this.installedMods = []
|
||||
this.lastDeploy = null
|
||||
}
|
||||
|
||||
/**
|
||||
@ -437,7 +435,7 @@ export class Controller {
|
||||
*/
|
||||
public modIsInstalled(modId: string): boolean {
|
||||
return (
|
||||
this.installedMods.includes(modId) ||
|
||||
this.lastDeploy.loadOrder.includes(modId) ||
|
||||
getFlag("overrideFrameworkChecks") === true
|
||||
)
|
||||
}
|
||||
@ -477,11 +475,7 @@ export class Controller {
|
||||
"boot",
|
||||
)
|
||||
|
||||
const lastServerSideData = (
|
||||
parse(
|
||||
readFileSync(modFrameworkDataPath!).toString(),
|
||||
) as SMFLastDeploy
|
||||
).lastServerSideStates
|
||||
const lastServerSideData = this.lastDeploy.lastServerSideStates
|
||||
|
||||
if (lastServerSideData?.unlockables) {
|
||||
this.configManager.configs["allunlockables"] =
|
||||
|
@ -1531,8 +1531,21 @@ export type ContractProgressionData = Record<string, string | number | boolean>
|
||||
|
||||
/** SMF's lastDeploy.json */
|
||||
export interface SMFLastDeploy {
|
||||
runtimePath: string
|
||||
retailPath: string
|
||||
skipIntro: boolean
|
||||
outputToSeparateDirectory: boolean
|
||||
loadOrder: string[]
|
||||
modOptions: {
|
||||
[modId: string]: string[]
|
||||
}
|
||||
outputConfigToAppDataOnDeploy: boolean
|
||||
reportErrors: boolean
|
||||
developerMode: boolean
|
||||
knownMods: string[]
|
||||
platform: string
|
||||
lastServerSideStates?: {
|
||||
peacockPlugins: string[]
|
||||
unlockables?: Unlockable[]
|
||||
contracts?: {
|
||||
[k: string]: MissionManifest
|
||||
|
Loading…
Reference in New Issue
Block a user