From 0b3c48827ba87c197959242428d22413040bcc17 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 20 Aug 2021 15:30:19 -0400 Subject: [PATCH] Ok we can load a thing but it has no effect. --- src/ScriptEditor/ui/Root.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ScriptEditor/ui/Root.tsx b/src/ScriptEditor/ui/Root.tsx index 876787799..0733d33a3 100644 --- a/src/ScriptEditor/ui/Root.tsx +++ b/src/ScriptEditor/ui/Root.tsx @@ -201,6 +201,27 @@ export function Root(props: IProps): React.ReactElement { editorRef.current.focus(); } + function beforeMount(monaco: any): void { + + // extra libraries + const libSource = ` +export declare function upgradeHomeRam(): number; +export declare function getUpgradeHomeRamCost(): number; +export declare function workForCompany(companyName: string): boolean; +export declare function applyToCompany(companyName: string, field: string): boolean; +export declare function getCompanyRep(companyName: string): number; +export declare function getCompanyFavor(companyName: string): number; +export declare function getCompanyFavorGain(companyName: string): number; +export declare function checkFactionInvitations(): string[]; +export declare function joinFaction(name: string): boolean; +export declare function workForFaction(name: string, type: string): boolean; +export declare function getFactionRep(name: string): number; +export declare function getFactionFavor(name: string): number;`; + + monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource); + monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource); + } + return (

Script name:

@@ -208,6 +229,7 @@ export function Root(props: IProps): React.ReactElement {
Loading script editor!

} height="80%"