Merge pull request #4180 from Snarling/growthAnalyzeSecurityFix

NETSCRIPT: growthAnalyzeSecurity no longer fails if the optional cores parameter was omitted
This commit is contained in:
hydroflame 2022-09-29 01:09:21 -03:00 committed by GitHub
commit 5e4a393495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -308,10 +308,10 @@ const base: InternalAPI<NS> = {
}, },
growthAnalyzeSecurity: growthAnalyzeSecurity:
(ctx: NetscriptContext) => (ctx: NetscriptContext) =>
(_threads: unknown, _hostname?: unknown, _cores?: unknown): number => { (_threads: unknown, _hostname?: unknown, _cores: unknown = 1): number => {
let threads = helpers.number(ctx, "threads", _threads); let threads = helpers.number(ctx, "threads", _threads);
if (_hostname) { if (_hostname) {
const cores = helpers.number(ctx, "cores", _cores) || 1; const cores = helpers.number(ctx, "cores", _cores);
const hostname = helpers.string(ctx, "hostname", _hostname); const hostname = helpers.string(ctx, "hostname", _hostname);
const server = helpers.getServer(ctx, hostname); const server = helpers.getServer(ctx, hostname);