From bb6297390568e32404db72cebeff3687b5a45cba Mon Sep 17 00:00:00 2001 From: Steven Malis Date: Fri, 1 Apr 2022 01:09:09 -0400 Subject: [PATCH 1/2] Fix docs for employeeProd and add employeeJobs. --- dist/bitburner.d.ts | 4 +++- src/Corporation/OfficeSpace.ts | 23 ++++++++++++++++++++++ src/NetscriptFunctions/Corporation.ts | 8 ++++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 4 +++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/dist/bitburner.d.ts b/dist/bitburner.d.ts index 2553d10f0..ec8f84056 100644 --- a/dist/bitburner.d.ts +++ b/dist/bitburner.d.ts @@ -4671,8 +4671,10 @@ export declare interface Office { maxMor: number; /** Name of all the employees */ employees: string[]; - /** Positions of the employees */ + /** Production of the employees */ employeeProd: EmployeeJobs; + /** Positions of the employees */ + employeeJobs: EmployeeJobs; } /** diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts index 87af22971..e7e8d455f 100644 --- a/src/Corporation/OfficeSpace.ts +++ b/src/Corporation/OfficeSpace.ts @@ -29,6 +29,14 @@ export class OfficeSpace { [EmployeePositions.RandD]: 0, total: 0, }; + employeeJobs: { [key: string]: number } = { + [EmployeePositions.Operations]: 0, + [EmployeePositions.Engineer]: 0, + [EmployeePositions.Business]: 0, + [EmployeePositions.Management]: 0, + [EmployeePositions.RandD]: 0, + total: 0, + }; constructor(params: IParams = {}) { this.loc = params.loc ? params.loc : ""; @@ -48,6 +56,8 @@ export class OfficeSpace { } } + this.calculateTotalEmployees(corporation, industry); + // Process Office properties this.maxEne = 100; this.maxHap = 100; @@ -101,6 +111,19 @@ export class OfficeSpace { return salaryPaid; } + calculateTotalEmployees(corporation: ICorporation, industry: IIndustry): void { + //Reset + for (const name of Object.keys(this.employeeJobs)) { + this.employeeJobs[name] = 0; + } + + for (let i = 0; i < this.employees.length; ++i) { + const employee = this.employees[i]; + this.employeeJobs[employee.pos]++; + } + this.employeeJobs.total = this.employees.length; + } + calculateEmployeeProductivity(corporation: ICorporation, industry: IIndustry): void { //Reset for (const name of Object.keys(this.employeeProd)) { diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 95b82c99f..09a6f5c16 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -753,6 +753,14 @@ export function NetscriptCorporation( "Research & Development": office.employeeProd[EmployeePositions.RandD], Training: office.employeeProd[EmployeePositions.Training], }, + employeeJobs: { + Operations: office.employeeJobs[EmployeePositions.Operations], + Engineer: office.employeeJobs[EmployeePositions.Engineer], + Business: office.employeeJobs[EmployeePositions.Business], + Management: office.employeeJobs[EmployeePositions.Management], + "Research & Development": office.employeeJobs[EmployeePositions.RandD], + Training: office.employeeJobs[EmployeePositions.Training], + }, }; }, getEmployee: function (_divisionName: unknown, _cityName: unknown, _employeeName: unknown): NSEmployee { diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 169b22aed..0473cf408 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6965,8 +6965,10 @@ interface Office { maxMor: number; /** Name of all the employees */ employees: string[]; - /** Positions of the employees */ + /** Production of the employees */ employeeProd: EmployeeJobs; + /** Positions of the employees */ + employeeJobs: EmployeeJobs; } /** From e572c6e13997a1fa41cdb0e93a1cd336f49cde9a Mon Sep 17 00:00:00 2001 From: Steven Malis Date: Fri, 1 Apr 2022 01:44:53 -0400 Subject: [PATCH 2/2] Add unassigned and training. --- src/Corporation/OfficeSpace.ts | 2 ++ src/NetscriptFunctions/Corporation.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts index e7e8d455f..4a4e984b1 100644 --- a/src/Corporation/OfficeSpace.ts +++ b/src/Corporation/OfficeSpace.ts @@ -35,6 +35,8 @@ export class OfficeSpace { [EmployeePositions.Business]: 0, [EmployeePositions.Management]: 0, [EmployeePositions.RandD]: 0, + [EmployeePositions.Training]: 0, + [EmployeePositions.Unassigned]: 0, total: 0, }; diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 09a6f5c16..db93a8139 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -760,6 +760,7 @@ export function NetscriptCorporation( Management: office.employeeJobs[EmployeePositions.Management], "Research & Development": office.employeeJobs[EmployeePositions.RandD], Training: office.employeeJobs[EmployeePositions.Training], + Unassigned: office.employeeJobs[EmployeePositions.Unassigned], }, }; },