mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 10:03:48 +01:00
Merge pull request #1440 from danielyxie/dev
growthanalyze allows cores argument
This commit is contained in:
commit
d05afc64b0
@ -1,12 +1,13 @@
|
|||||||
growthAnalyze() Netscript Function
|
growthAnalyze() Netscript Function
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
.. js:function:: growthAnalyze(hostname, growthAmount)
|
.. js:function:: growthAnalyze(hostname, growthAmount[, cores])
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
:RAM cost: 1 GB
|
||||||
:param string hostname: Hostname of server to analyze.
|
:param string hostname: Hostname of server to analyze.
|
||||||
:param number growthAmount: Multiplicative factor by which the server is
|
:param number growthAmount: Multiplicative factor by which the server is
|
||||||
grown. Decimal form. Must be >= 1.
|
grown. Decimal form. Must be >= 1.
|
||||||
|
:param number cores: Amount of cores on the server that would run the growth, defaults to 1
|
||||||
:returns: The amount of :doc:`grow<grow>` threads needed to grow the specified
|
:returns: The amount of :doc:`grow<grow>` threads needed to grow the specified
|
||||||
server by the specified amount.
|
server by the specified amount.
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -862,7 +862,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
return Promise.resolve(moneyAfter / moneyBefore);
|
return Promise.resolve(moneyAfter / moneyBefore);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
growthAnalyze: function (ip: any, growth: any): any {
|
growthAnalyze: function (ip: any, growth: any, cores: any = 1): any {
|
||||||
updateDynamicRam("growthAnalyze", getRamCost("growthAnalyze"));
|
updateDynamicRam("growthAnalyze", getRamCost("growthAnalyze"));
|
||||||
|
|
||||||
// Check argument validity
|
// Check argument validity
|
||||||
@ -875,7 +875,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
throw makeRuntimeErrorMsg("growthAnalyze", `Invalid argument: growth must be numeric and >= 1, is ${growth}.`);
|
throw makeRuntimeErrorMsg("growthAnalyze", `Invalid argument: growth must be numeric and >= 1, is ${growth}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return numCycleForGrowth(server, Number(growth), Player, 1);
|
return numCycleForGrowth(server, Number(growth), Player, cores);
|
||||||
},
|
},
|
||||||
weaken: function (ip: any, { threads: requestedThreads }: any = {}): any {
|
weaken: function (ip: any, { threads: requestedThreads }: any = {}): any {
|
||||||
updateDynamicRam("weaken", getRamCost("weaken"));
|
updateDynamicRam("weaken", getRamCost("weaken"));
|
||||||
|
Loading…
Reference in New Issue
Block a user