mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
BUGFIX: Contracts now fail if there are 0 of them remaining (#889)
This commit is contained in:
parent
0bdab7bec8
commit
2a149df13e
@ -1663,7 +1663,13 @@ export class Bladeburner {
|
|||||||
if (!this.action) {
|
if (!this.action) {
|
||||||
throw new Error("Bladeburner.action is not an ActionIdentifier Object");
|
throw new Error("Bladeburner.action is not an ActionIdentifier Object");
|
||||||
}
|
}
|
||||||
|
//Check to see if action is a contract, and then to verify a sleeve didn't finish it first
|
||||||
|
if (this.action.type === 2) {
|
||||||
|
const remainingActions = this.contracts[this.action.name].count;
|
||||||
|
if (remainingActions < 1) {
|
||||||
|
return this.resetAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
// If the previous action went past its completion time, add to the next action
|
// If the previous action went past its completion time, add to the next action
|
||||||
// This is not added immediately in case the automation changes the action
|
// This is not added immediately in case the automation changes the action
|
||||||
this.actionTimeCurrent += seconds + this.actionTimeOverflow;
|
this.actionTimeCurrent += seconds + this.actionTimeOverflow;
|
||||||
|
@ -40,14 +40,14 @@ export class SleeveBladeburnerWork extends SleeveWorkClass {
|
|||||||
if (this.actionType === "Contracts") {
|
if (this.actionType === "Contracts") {
|
||||||
const action = Player.bladeburner.getActionObject(actionIdent);
|
const action = Player.bladeburner.getActionObject(actionIdent);
|
||||||
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||||
if (action.count <= 0) return sleeve.stopWork();
|
if (action.count < 1) return sleeve.stopWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (this.cyclesWorked > this.cyclesNeeded(sleeve)) {
|
while (this.cyclesWorked > this.cyclesNeeded(sleeve)) {
|
||||||
if (this.actionType === "Contracts") {
|
if (this.actionType === "Contracts") {
|
||||||
const action = Player.bladeburner.getActionObject(actionIdent);
|
const action = Player.bladeburner.getActionObject(actionIdent);
|
||||||
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
if (!action) throw new Error(`Error getting ${this.actionName} action object`);
|
||||||
if (action.count <= 0) return sleeve.stopWork();
|
if (action.count < 1) return sleeve.stopWork();
|
||||||
}
|
}
|
||||||
const retValue = Player.bladeburner.completeAction(sleeve, actionIdent, false);
|
const retValue = Player.bladeburner.completeAction(sleeve, actionIdent, false);
|
||||||
if (this.actionType === "General") {
|
if (this.actionType === "General") {
|
||||||
|
Loading…
Reference in New Issue
Block a user