mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 04:17:05 +02:00
NETSCRIPT: Expose more enums for player use (#198)
* Add support for enums at other ns layers * APIWrapper: simplified wrapping algorithm and modified to just use cloneDeep to copy enums instead of recursively wrapping enums as if they were new API layers * Improve APIWrapper typing * Changed some typings at RamCostGenerator to allow for enums at different levels without enums needing a ram cost * Added enums to ns.corporation, removed getter functions that were being used instead. * Add FactionWorkType for player use * Add ClassType and CompanyWorkPos enums * Change netscriptDefinitions to expect members of these new enums where appropriate.
This commit is contained in:
@@ -703,6 +703,10 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
};
|
||||
|
||||
return {
|
||||
enums: {
|
||||
EmployeePositions,
|
||||
IndustryType,
|
||||
},
|
||||
...warehouseAPI,
|
||||
...officeAPI,
|
||||
hasCorporation: () => () => !!Player.corporation,
|
||||
@@ -711,14 +715,6 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
checkAccess(ctx);
|
||||
return [...CorporationConstants.AllMaterials];
|
||||
},
|
||||
getIndustryTypes: (ctx) => () => {
|
||||
checkAccess(ctx);
|
||||
return Object.values(IndustryType);
|
||||
},
|
||||
getEmployeePositions: (ctx) => () => {
|
||||
checkAccess(ctx);
|
||||
return Object.values(EmployeePositions);
|
||||
},
|
||||
getUnlockables: (ctx) => () => {
|
||||
checkAccess(ctx);
|
||||
return [...CorporationConstants.AllUnlocks];
|
||||
@@ -776,9 +772,6 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
if (!corporation.public) throw helpers.makeRuntimeErrorMsg(ctx, `Your company has not gone public!`);
|
||||
IssueDividends(corporation, rate);
|
||||
},
|
||||
|
||||
// If you modify these objects you will affect them for real, it's not
|
||||
// copies.
|
||||
getDivision: (ctx) => (_divisionName) => {
|
||||
checkAccess(ctx);
|
||||
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
||||
|
||||
Reference in New Issue
Block a user