mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
Merge pull request #2041 from hexnaught/job-shortcut-key-patch
Only run job shortcut if the player has a job
This commit is contained in:
commit
890b1df593
@ -242,6 +242,7 @@ export interface IPlayer {
|
|||||||
getIntelligenceBonus(weight: number): number;
|
getIntelligenceBonus(weight: number): number;
|
||||||
getCasinoWinnings(): number;
|
getCasinoWinnings(): number;
|
||||||
quitJob(company: string): void;
|
quitJob(company: string): void;
|
||||||
|
hasJob(): boolean;
|
||||||
createHacknetServer(): HacknetServer;
|
createHacknetServer(): HacknetServer;
|
||||||
startCreateProgramWork(router: IRouter, programName: string, time: number, reqLevel: number): void;
|
startCreateProgramWork(router: IRouter, programName: string, time: number, reqLevel: number): void;
|
||||||
queueAugmentation(augmentationName: string): void;
|
queueAugmentation(augmentationName: string): void;
|
||||||
|
@ -247,6 +247,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
getIntelligenceBonus: (weight: number) => number;
|
getIntelligenceBonus: (weight: number) => number;
|
||||||
getCasinoWinnings: () => number;
|
getCasinoWinnings: () => number;
|
||||||
quitJob: (company: string) => void;
|
quitJob: (company: string) => void;
|
||||||
|
hasJob: () => boolean;
|
||||||
process: (router: IRouter, numCycles?: number) => void;
|
process: (router: IRouter, numCycles?: number) => void;
|
||||||
createHacknetServer: () => HacknetServer;
|
createHacknetServer: () => HacknetServer;
|
||||||
startCreateProgramWork: (router: IRouter, programName: string, time: number, reqLevel: number) => void;
|
startCreateProgramWork: (router: IRouter, programName: string, time: number, reqLevel: number) => void;
|
||||||
@ -531,6 +532,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
this.applyForJob = generalMethods.applyForJob;
|
this.applyForJob = generalMethods.applyForJob;
|
||||||
this.getNextCompanyPosition = generalMethods.getNextCompanyPosition;
|
this.getNextCompanyPosition = generalMethods.getNextCompanyPosition;
|
||||||
this.quitJob = generalMethods.quitJob;
|
this.quitJob = generalMethods.quitJob;
|
||||||
|
this.hasJob = generalMethods.hasJob;
|
||||||
this.applyForSoftwareJob = generalMethods.applyForSoftwareJob;
|
this.applyForSoftwareJob = generalMethods.applyForSoftwareJob;
|
||||||
this.applyForSoftwareConsultantJob = generalMethods.applyForSoftwareConsultantJob;
|
this.applyForSoftwareConsultantJob = generalMethods.applyForSoftwareConsultantJob;
|
||||||
this.applyForItJob = generalMethods.applyForItJob;
|
this.applyForItJob = generalMethods.applyForItJob;
|
||||||
|
@ -1782,6 +1782,15 @@ export function quitJob(this: IPlayer, company: string): void {
|
|||||||
delete this.jobs[company];
|
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 {
|
export function applyForSoftwareJob(this: IPlayer, sing = false): boolean {
|
||||||
return this.applyForJob(CompanyPositions[posNames.SoftwareCompanyPositions[0]], sing);
|
return this.applyForJob(CompanyPositions[posNames.SoftwareCompanyPositions[0]], sing);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
|||||||
} else if (event.keyCode === KEY.W && event.altKey) {
|
} else if (event.keyCode === KEY.W && event.altKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
clickCity();
|
clickCity();
|
||||||
} else if (event.keyCode === KEY.J && event.altKey && !event.ctrlKey && !event.metaKey) {
|
} else if (event.keyCode === KEY.J && event.altKey && !event.ctrlKey && !event.metaKey && props.player.hasJob()) {
|
||||||
// ctrl/cmd + alt + j is shortcut to open Chrome dev tools
|
// ctrl/cmd + alt + j is shortcut to open Chrome dev tools
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
clickJob();
|
clickJob();
|
||||||
|
Loading…
Reference in New Issue
Block a user