Remove sleeve message when quitting job from a script (#1357)

This commit is contained in:
Kelenius 2024-06-06 01:25:54 +03:00 committed by GitHub
parent bd5c502f53
commit 653d531d0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

@ -747,7 +747,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
quitJob: (ctx) => (_companyName) => {
helpers.checkSingularityAccess(ctx);
const companyName = getEnumHelper("CompanyName").nsGetMember(ctx, _companyName);
Player.quitJob(companyName);
Player.quitJob(companyName, true);
},
getCompanyRep: (ctx) => (_companyName) => {
helpers.checkSingularityAccess(ctx);

@ -361,16 +361,18 @@ export function getNextCompanyPosition(
return pos;
}
export function quitJob(this: PlayerObject, company: CompanyName): void {
export function quitJob(this: PlayerObject, company: CompanyName, suppressDialog?: boolean): void {
if (isCompanyWork(this.currentWork) && this.currentWork.companyName === company) {
this.finishWork(true);
}
for (const sleeve of this.sleeves) {
if (sleeve.currentWork?.type === SleeveWorkType.COMPANY && sleeve.currentWork.companyName === company) {
sleeve.stopWork();
if (!suppressDialog) {
dialogBoxCreate(`You quit ${company} while one of your sleeves was working there. The sleeve is now idle.`);
}
}
}
delete this.jobs[company];
}