mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 22:23:51 +01:00
Merge pull request #3577 from phyzical/feature/WEB-3567
FEATURE: added logic to allow quitJob to be called from singularity
This commit is contained in:
commit
bffa166fc3
@ -156,6 +156,7 @@ const singularity: IMap<any> = {
|
||||
getUpgradeHomeCoresCost: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 2),
|
||||
workForCompany: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost),
|
||||
applyToCompany: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost),
|
||||
quitJob: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost),
|
||||
getCompanyRep: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 3),
|
||||
getCompanyFavor: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 3),
|
||||
getCompanyFavorGain: SF4Cost(RamCostConstants.ScriptSingularityFn2RamCost / 4),
|
||||
|
@ -947,6 +947,12 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
}
|
||||
return res;
|
||||
},
|
||||
quitJob: (_ctx: NetscriptContext) =>
|
||||
function (_companyName: unknown): void {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
const companyName = _ctx.helper.string("companyName", _companyName);
|
||||
player.quitJob(companyName);
|
||||
},
|
||||
getCompanyRep: (_ctx: NetscriptContext) =>
|
||||
function (_companyName: unknown): number {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
|
@ -248,7 +248,7 @@ export interface IPlayer {
|
||||
queryStatFromString(str: string): number;
|
||||
getIntelligenceBonus(weight: number): number;
|
||||
getCasinoWinnings(): number;
|
||||
quitJob(company: string): void;
|
||||
quitJob(company: string, sing?: boolean): void;
|
||||
hasJob(): boolean;
|
||||
createHacknetServer(): HacknetServer;
|
||||
startCreateProgramWork(programName: string, time: number, reqLevel: number): void;
|
||||
|
@ -258,7 +258,7 @@ export class PlayerObject implements IPlayer {
|
||||
queryStatFromString: (str: string) => number;
|
||||
getIntelligenceBonus: (weight: number) => number;
|
||||
getCasinoWinnings: () => number;
|
||||
quitJob: (company: string) => void;
|
||||
quitJob: (company: string, sing?: boolean) => void;
|
||||
hasJob: () => boolean;
|
||||
process: (router: IRouter, numCycles?: number) => void;
|
||||
createHacknetServer: () => HacknetServer;
|
||||
|
@ -1869,7 +1869,7 @@ export function getNextCompanyPosition(
|
||||
return entryPosType;
|
||||
}
|
||||
|
||||
export function quitJob(this: IPlayer, company: string): void {
|
||||
export function quitJob(this: IPlayer, company: string, _sing = false): void {
|
||||
if (this.isWorking == true && this.workType.includes("Working for Company") && this.companyName == company) {
|
||||
this.finishWork(true);
|
||||
}
|
||||
|
12
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
12
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1800,6 +1800,18 @@ export interface Singularity {
|
||||
*/
|
||||
workForCompany(companyName?: string, focus?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Quit jobs by company.
|
||||
* @remarks
|
||||
* RAM cost: 3 GB * 16/4/1
|
||||
*
|
||||
*
|
||||
* This function will finish work with the company provided and quit any jobs.
|
||||
*
|
||||
* @param companyName - Name of the company.
|
||||
*/
|
||||
quitJob(companyName?: string): void;
|
||||
|
||||
/**
|
||||
* Apply for a job at a company.
|
||||
* @remarks
|
||||
|
Loading…
Reference in New Issue
Block a user