mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 15:28:43 +02:00
Minor fixes to new Sleeve API
This commit is contained in:
@@ -73,7 +73,7 @@ import {WorkerScript, workerScripts,
|
||||
import {makeRuntimeRejectMsg, netscriptDelay,
|
||||
runScriptFromScript} from "./NetscriptEvaluator";
|
||||
import {NetscriptPort} from "./NetscriptPort";
|
||||
import {SleeveTaskType} from "./PersonObjects/Sleeve/SleeveTaskTypesEnum"
|
||||
import { SleeveTaskType } from "./PersonObjects/Sleeve/SleeveTaskTypesEnum"
|
||||
|
||||
import {Page, routing} from "./ui/navigationTracking";
|
||||
import {numeralWrapper} from "./ui/numeralFormat";
|
||||
@@ -4910,6 +4910,16 @@ function NetscriptFunctions(workerScript) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot work at the same company that another sleeve is working at
|
||||
for (let i = 0; i < Player.sleeves.length; ++i) {
|
||||
if (i === sleeveNumber) { continue; }
|
||||
const other = Player.sleeves[i];
|
||||
if (other.currentTask === SleeveTaskType.Company && other.currentTaskLocation === companyName) {
|
||||
workerScript.log(`ERROR: sleeve.setToCompanyWork() failed for Sleeve ${sleeveNumber} because Sleeve ${i} is doing the same task`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return Player.sleeves[sleeveNumber].workForCompany(Player, companyName);
|
||||
},
|
||||
setToFactionWork : function(sleeveNumber=0, factionName="", workType="") {
|
||||
@@ -4925,6 +4935,16 @@ function NetscriptFunctions(workerScript) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot work at the same faction that another sleeve is working at
|
||||
for (let i = 0; i < Player.sleeves.length; ++i) {
|
||||
if (i === sleeveNumber) { continue; }
|
||||
const other = Player.sleeves[i];
|
||||
if (other.currentTask === SleeveTaskType.Faction && other.currentTaskLocation === factionName) {
|
||||
workerScript.log(`ERROR: sleeve.setToFactionWork() failed for Sleeve ${sleeveNumber} because Sleeve ${i} is doing the same task`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return Player.sleeves[sleeveNumber].workForFaction(Player, factionName, workType);
|
||||
},
|
||||
setToGymWorkout : function(sleeveNumber=0, gymName="", stat="") {
|
||||
|
||||
Reference in New Issue
Block a user