mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +01:00
BUGFIX: BB Sleeves cannot be assigned to contract programmatically (#1314)
This commit is contained in:
parent
e674a177d6
commit
bed66f980f
@ -238,23 +238,24 @@ export function NetscriptSleeve(): InternalAPI<NetscriptSleeve> {
|
|||||||
const action = helpers.string(ctx, "action", _action);
|
const action = helpers.string(ctx, "action", _action);
|
||||||
checkSleeveAPIAccess(ctx);
|
checkSleeveAPIAccess(ctx);
|
||||||
checkSleeveNumber(ctx, sleeveNumber);
|
checkSleeveNumber(ctx, sleeveNumber);
|
||||||
|
let contractName = undefined;
|
||||||
if (action === "Take on contracts") {
|
if (action === "Take on contracts") {
|
||||||
const contract = getEnumHelper("BladeContractName").nsGetMember(ctx, _contract);
|
const contractEnum = getEnumHelper("BladeContractName").nsGetMember(ctx, _contract);
|
||||||
|
contractName = helpers.string(ctx, "contract", _contract);
|
||||||
for (let i = 0; i < Player.sleeves.length; ++i) {
|
for (let i = 0; i < Player.sleeves.length; ++i) {
|
||||||
if (i === sleeveNumber) continue;
|
if (i === sleeveNumber) continue;
|
||||||
const otherWork = Player.sleeves[i].currentWork;
|
const otherWork = Player.sleeves[i].currentWork;
|
||||||
if (otherWork?.type === SleeveWorkType.BLADEBURNER && otherWork.actionId.name === contract) {
|
if (otherWork?.type === SleeveWorkType.BLADEBURNER && otherWork.actionId.name === contractEnum) {
|
||||||
throw helpers.errorMessage(
|
throw helpers.errorMessage(
|
||||||
ctx,
|
ctx,
|
||||||
`Sleeve ${sleeveNumber} cannot take on contracts because Sleeve ${i} is already performing that action.`,
|
`Sleeve ${sleeveNumber} cannot take on contracts because Sleeve ${i} is already performing that action.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const actionId: ActionIdentifier = { type: BladeActionType.contract, name: contract };
|
const actionId: ActionIdentifier = { type: BladeActionType.contract, name: contractEnum };
|
||||||
Player.sleeves[sleeveNumber].startWork(new SleeveBladeburnerWork({ actionId }));
|
Player.sleeves[sleeveNumber].startWork(new SleeveBladeburnerWork({ actionId }));
|
||||||
}
|
}
|
||||||
|
return Player.sleeves[sleeveNumber].bladeburner(action, contractName);
|
||||||
return Player.sleeves[sleeveNumber].bladeburner(action);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user