From c8cfb4f008f6287b18d724016e0a4c5561be67a2 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 8 Oct 2024 10:36:44 +0200 Subject: [PATCH] small sync --- Ramses/home/CorpControl.js | 13 +++++++++++-- Ramses/home/CorpStatus.txt | 2 +- Ramses/home/corp/HireWorkers.js | 3 +-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Ramses/home/CorpControl.js b/Ramses/home/CorpControl.js index 6abb42f..1dd9ecf 100644 --- a/Ramses/home/CorpControl.js +++ b/Ramses/home/CorpControl.js @@ -47,9 +47,18 @@ export async function main(ns) { oOfficeData = ns.readPort(nListenPID); await ns.nextPortWrite(ns.run("/corp/UpgradeOffice.js", 1, sDivisionName, sCity, nTargetSize, oOfficeData.size)) } - oCorpStatus.nStep = 200; + oCorpStatus.nStep = 30; break; case 30: + for (let sCity of aCitites) { + nListenPID = ns.run("/corp/GetOfficeData.js", 1, sDivisionName, sCity); + await ns.nextPortWrite(nListenPID); + oOfficeData = ns.readPort(nListenPID); + ns.tprint(oOfficeData); + nListenPID = ns.run("/corp/HireWorkers.js", 1, sDivisionName, sCity, oOfficeData); + await ns.nextPortWrite(nListenPID); + } + oCorpStatus.nStep = 200; break; case 40: break; @@ -69,6 +78,6 @@ export async function main(ns) { break; } ns.write("CorpStatus.txt", JSON.stringify(oCorpStatus), "w") - await ns.sleep(1000) + await ns.sleep(1) } } \ No newline at end of file diff --git a/Ramses/home/CorpStatus.txt b/Ramses/home/CorpStatus.txt index 1835133..4d87a63 100644 --- a/Ramses/home/CorpStatus.txt +++ b/Ramses/home/CorpStatus.txt @@ -1 +1 @@ -{"nStep":200} \ No newline at end of file +{"nStep":30} \ No newline at end of file diff --git a/Ramses/home/corp/HireWorkers.js b/Ramses/home/corp/HireWorkers.js index 6e71c93..e9989fc 100644 --- a/Ramses/home/corp/HireWorkers.js +++ b/Ramses/home/corp/HireWorkers.js @@ -1,7 +1,6 @@ /** @param {NS} ns */ export async function main(ns) { - let [sDivName, sCity, nTargetSize] = ns.args; - let oCurrentOffice = ns.corporation.getOffice(sDivName, sCity); + let [sDivName, sCity, oCurrentOffice] = ns.args; if (oCurrentOffice.numEmployees < oCurrentOffice.size) { (oCurrentOffice.employeeJobs.Operations < 1) ? ns.corporation.hireEmployee(sDivName, sCity,"Operations") : ""; (oCurrentOffice.employeeJobs.Engineer < 1) ? ns.corporation.hireEmployee(sDivName, sCity,"Engineer") : "";