mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 02:03:58 +01:00
Remove async from employee assignment functions
This commit is contained in:
parent
b9356ea782
commit
7d3a43f7b5
@ -705,7 +705,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
},
|
||||
assignJob:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_divisionName: unknown, _cityName: unknown, _employeeName: unknown, _job: unknown): Promise<void> => {
|
||||
(_divisionName: unknown, _cityName: unknown, _employeeName: unknown, _job: unknown): void => {
|
||||
checkAccess(ctx, 8);
|
||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||
const cityName = ctx.helper.city("cityName", _cityName);
|
||||
@ -715,14 +715,11 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`);
|
||||
const office = getOffice(divisionName, cityName);
|
||||
|
||||
return netscriptDelay(0, workerScript).then(function () {
|
||||
return Promise.resolve(AssignJob(office, employeeName, job));
|
||||
});
|
||||
//return AssignJob(office, employeeName, job);
|
||||
AssignJob(office, employeeName, job);
|
||||
},
|
||||
setAutoJobAssignment:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_divisionName: unknown, _cityName: unknown, _job: unknown, _amount: unknown): Promise<boolean> => {
|
||||
(_divisionName: unknown, _cityName: unknown, _job: unknown, _amount: unknown): boolean => {
|
||||
checkAccess(ctx, 8);
|
||||
const divisionName = ctx.helper.string("divisionName", _divisionName);
|
||||
const cityName = ctx.helper.city("cityName", _cityName);
|
||||
@ -732,10 +729,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`);
|
||||
const office = getOffice(divisionName, cityName);
|
||||
|
||||
return netscriptDelay(0, workerScript).then(function () {
|
||||
return Promise.resolve(AutoAssignJob(office, job, amount));
|
||||
});
|
||||
//return AutoAssignJob(office, job, amount);
|
||||
return AutoAssignJob(office, job, amount);
|
||||
},
|
||||
hireEmployee:
|
||||
(ctx: NetscriptContext) =>
|
||||
|
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -6618,9 +6618,8 @@ export interface OfficeAPI {
|
||||
* @param cityName - Name of the city
|
||||
* @param employeeName - name of the employee
|
||||
* @param job - Name of the job.
|
||||
* @returns A promise that is fulfilled when the assignment is complete.
|
||||
*/
|
||||
assignJob(divisionName: string, cityName: string, employeeName: string, job: string): Promise<void>;
|
||||
assignJob(divisionName: string, cityName: string, employeeName: string, job: string): void;
|
||||
/**
|
||||
* Hire an employee.
|
||||
* @param divisionName - Name of the division
|
||||
@ -6708,9 +6707,9 @@ export interface OfficeAPI {
|
||||
* @param cityName - Name of the city
|
||||
* @param job - Name of the job
|
||||
* @param amount - Number of employees to assign to that job
|
||||
* @returns A promise that is fulfilled when the assignment is complete.
|
||||
* @returns true if the employee count reached the target amount, false if not
|
||||
*/
|
||||
setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): Promise<boolean>;
|
||||
setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): boolean;
|
||||
/**
|
||||
* Cost to Upgrade office size.
|
||||
* @param divisionName - Name of the division
|
||||
|
Loading…
Reference in New Issue
Block a user