mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 15:28:43 +02:00
fix(shortcut): job shortcut only run when have job
The shortcut was always allowed to run, meaning when the player doesn't have a job, they were sent to the job screen with no job and lost the view context/sidebar. - Add utility method to check if the player 'hasJob', being at least 1 job. - Check if player has job when the key combination is pressed Resolves danielyxie/bitburner#2013
This commit is contained in:
@@ -1782,6 +1782,15 @@ export function quitJob(this: IPlayer, company: string): void {
|
||||
delete this.jobs[company];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to see if the player has at least one job assigned to them
|
||||
* @param this The player instance
|
||||
* @returns Whether the user has at least one job
|
||||
*/
|
||||
export function hasJob(this: IPlayer): boolean {
|
||||
return Boolean(Object.keys(this.jobs).length);
|
||||
}
|
||||
|
||||
export function applyForSoftwareJob(this: IPlayer, sing = false): boolean {
|
||||
return this.applyForJob(CompanyPositions[posNames.SoftwareCompanyPositions[0]], sing);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user