Merge pull request #2243 from TheMas3212/dev

Add Function Call signatures to ns.kill so typescript is able to call ns.kill correctly
This commit is contained in:
hydroflame 2022-01-02 11:39:56 -05:00 committed by GitHub
commit a6be7ecc3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

@ -1009,7 +1009,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
workerScript.log("spawn", () => "Exiting...");
}
},
kill: function (filename: any, hostname: any, ...scriptArgs: any): any {
kill: function (filename: any, hostname?: any, ...scriptArgs: any): any {
updateDynamicRam("kill", getRamCost("kill"));
let res;
@ -2025,7 +2025,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
return calculateWeakenTime(server, Player) * 1000;
},
getScriptIncome: function (scriptname: any, hostname: any, ...args: any[]): any {
getScriptIncome: function (scriptname?: any, hostname?: any, ...args: any[]): any {
updateDynamicRam("getScriptIncome", getRamCost("getScriptIncome"));
if (arguments.length === 0) {
const res = [];
@ -2054,7 +2054,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;
}
},
getScriptExpGain: function (scriptname: any, hostname: any, ...args: any[]): any {
getScriptExpGain: function (scriptname?: any, hostname?: any, ...args: any[]): any {
updateDynamicRam("getScriptExpGain", getRamCost("getScriptExpGain"));
if (arguments.length === 0) {
let total = 0;

@ -4680,8 +4680,9 @@ export interface NS extends Singularity {
* @param args - Arguments to identify which script to kill.
* @returns True if the script is successfully killed, and false otherwise.
*/
kill(script: string | number, host: string, ...args: string[]): boolean;
kill(script: number): boolean;
kill(script: string, host: string, ...args: string[]): boolean;
/**
* Terminate all scripts on a server.
* @remarks
@ -5543,7 +5544,8 @@ export interface NS extends Singularity {
* @param args - Arguments that the script is running with.
* @returns Amount of income the specified script generates while online.
*/
getScriptIncome(script: string, host: string, ...args: string[]): number | [number, number];
getScriptIncome(): [number, number];
getScriptIncome(script: string, host: string, ...args: string[]): number;
/**
* Get the exp gain of a script.
@ -5562,6 +5564,7 @@ export interface NS extends Singularity {
* @param args - Arguments that the script is running with.
* @returns Amount of hacking experience the specified script generates while online.
*/
getScriptExpGain(): number;
getScriptExpGain(script: string, host: string, ...args: string[]): number;
/**