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%"