mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
SLEEVE: Add sleeve.setToIdle function (#374)
This commit is contained in:
parent
bd4fe19fde
commit
028199aa7d
@ -289,6 +289,7 @@ const codingcontract = {
|
|||||||
// Duplicate Sleeve API
|
// Duplicate Sleeve API
|
||||||
const sleeve = {
|
const sleeve = {
|
||||||
getNumSleeves: RamCostConstants.SleeveBase,
|
getNumSleeves: RamCostConstants.SleeveBase,
|
||||||
|
setToIdle: RamCostConstants.SleeveBase,
|
||||||
setToShockRecovery: RamCostConstants.SleeveBase,
|
setToShockRecovery: RamCostConstants.SleeveBase,
|
||||||
setToSynchronize: RamCostConstants.SleeveBase,
|
setToSynchronize: RamCostConstants.SleeveBase,
|
||||||
setToCommitCrime: RamCostConstants.SleeveBase,
|
setToCommitCrime: RamCostConstants.SleeveBase,
|
||||||
|
@ -36,6 +36,12 @@ export function NetscriptSleeve(): InternalAPI<Sleeve> {
|
|||||||
checkSleeveAPIAccess(ctx);
|
checkSleeveAPIAccess(ctx);
|
||||||
return Player.sleeves.length;
|
return Player.sleeves.length;
|
||||||
},
|
},
|
||||||
|
setToIdle: (ctx) => (_sleeveNumber) => {
|
||||||
|
const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber);
|
||||||
|
checkSleeveAPIAccess(ctx);
|
||||||
|
checkSleeveNumber(ctx, sleeveNumber);
|
||||||
|
Player.sleeves[sleeveNumber].stopWork();
|
||||||
|
},
|
||||||
setToShockRecovery: (ctx) => (_sleeveNumber) => {
|
setToShockRecovery: (ctx) => (_sleeveNumber) => {
|
||||||
const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber);
|
const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber);
|
||||||
checkSleeveAPIAccess(ctx);
|
checkSleeveAPIAccess(ctx);
|
||||||
|
9
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
9
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3587,6 +3587,15 @@ export interface Sleeve {
|
|||||||
*/
|
*/
|
||||||
getTask(sleeveNumber: number): SleeveTask | null;
|
getTask(sleeveNumber: number): SleeveTask | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a sleeve to idle.
|
||||||
|
* @remarks
|
||||||
|
* RAM cost: 4 GB
|
||||||
|
*
|
||||||
|
* @param sleeveNumber - Index of the sleeve to idle.
|
||||||
|
*/
|
||||||
|
setToIdle(sleeveNumber: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a sleeve to shock recovery.
|
* Set a sleeve to shock recovery.
|
||||||
* @remarks
|
* @remarks
|
||||||
|
Loading…
Reference in New Issue
Block a user