New .ns scripts start with a main function.

This commit is contained in:
Olivier Gagnon 2021-03-07 13:11:29 -05:00
parent a8bb345c88
commit b35e25e5dc
2 changed files with 9 additions and 1 deletions

@ -241,6 +241,7 @@ export let CONSTANTS: IMap<any> = {
an augmentation.
* getCharacterInformation now additionally returns exp
* pid resets back to 1 when installing or destroying a BitNode.
* New '.ns' scripts start with a main function.
Misc.
* Fixed an issue where SF3 was listed as infinitly repeatable and SF12 as

@ -1760,7 +1760,14 @@ let Terminal = {
const filepath = Terminal.getFilepath(filename);
const script = Terminal.getScript(filename);
if (script == null) {
Engine.loadScriptEditorContent(filepath);
let code = ""
if(filename.endsWith(".ns")) {
code = `export async function main(ns) {
}`;
}
console.log('default code');
Engine.loadScriptEditorContent(filepath, code);
} else {
Engine.loadScriptEditorContent(filepath, script.code);
}