API: Fix removed functions (#720)

This commit is contained in:
Snarling
2023-08-07 02:38:38 -04:00
committed by GitHub
parent d637828759
commit 4ca598defb
8 changed files with 99 additions and 84 deletions
+21 -17
View File
@@ -57,7 +57,7 @@ import * as corpConstants from "../Corporation/data/Constants";
import { ResearchMap } from "../Corporation/ResearchMap";
import { Factions } from "../Faction/Factions";
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper";
import { InternalAPI, NetscriptContext, setRemovedFunctions } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
import { getEnumHelper } from "../utils/EnumHelper";
import { MaterialInfo } from "../Corporation/MaterialInfo";
@@ -841,22 +841,26 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
},
};
// TODO 3.0: Remove these removedFunctions warnings.
Object.assign(corpFunctions, {
assignJob: removedFunction(
"v2.2.0",
"Removed due to employees no longer being objects. Use ns.corporation.setAutoJobAssignment instead.",
true,
),
getEmployee: removedFunction("v2.2.0", "Removed due to employees no longer being individual objects.", true),
getExpandCityCost: removedFunction("v2.2.0", "corporation.getConstants().officeInitialCost"),
getExpandIndustryCost: removedFunction("v2.2.0", "corporation.getIndustryData"),
getIndustryTypes: removedFunction("v2.2.0", "corporation.getConstants().industryNames"),
getMaterialNames: removedFunction("v2.2.0", "corporation.getConstants().materialNames"),
getPurchaseWarehouseCost: removedFunction("v2.2.0", "corporation.getConstants().warehouseInitialCost"),
getResearchNames: removedFunction("v2.2.0", "corporation.getConstants().researchNames"),
getUnlockables: removedFunction("v2.2.0", "corporation.getConstants().unlockNames"),
getUpgradeNames: removedFunction("v2.2.0", "corporation.getConstants().upgradeNames"),
// Removed functions
setRemovedFunctions(corpFunctions, {
assignJob: {
version: "2.2.0",
replacement: "Removed due to employees no longer being objects. Use ns.corporation.setAutoJobAssignment instead.",
replaceMsg: true,
},
getEmployee: {
version: "2.2.0",
replacement: "Removed due to employees no longer being individual objects.",
replaceMsg: true,
},
getExpandCityCost: { version: "2.2.0", replacement: "corporation.getConstants().officeInitialCost" },
getExpandIndustryCost: { version: "2.2.0", replacement: "corporation.getIndustryData" },
getIndustryTypes: { version: "2.2.0", replacement: "corporation.getConstants().industryNames" },
getMaterialNames: { version: "2.2.0", replacement: "corporation.getConstants().materialNames" },
getPurchaseWarehouseCost: { version: "2.2.0", replacement: "corporation.getConstants().warehouseInitialCost" },
getResearchNames: { version: "2.2.0", replacement: "corporation.getConstants().researchNames" },
getUnlockables: { version: "2.2.0", replacement: "corporation.getConstants().unlockNames" },
getUpgradeNames: { version: "2.2.0", replacement: "corporation.getConstants().upgradeNames" },
});
return corpFunctions;
}
+5 -5
View File
@@ -46,7 +46,7 @@ import {
} from "../Gang/formulas/formulas";
import { favorToRep as calculateFavorToRep, repToFavor as calculateRepToFavor } from "../Faction/formulas/favor";
import { repFromDonation } from "../Faction/formulas/donation";
import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper";
import { InternalAPI, NetscriptContext, setRemovedFunctions } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
import { calculateCrimeWorkStats } from "../Work/Formulas";
import { calculateCompanyWorkStats } from "../Work/Formulas";
@@ -427,10 +427,10 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
},
},
};
// Removed undocumented functions added using Object.assign because typescript.
// TODO: Remove these at 3.0
Object.assign(formulasFunctions.work, {
classGains: removedFunction("2.2.0", "formulas.work.universityGains or formulas.work.gymGains"),
// Removed functions
setRemovedFunctions(formulasFunctions.work, {
classGains: { version: "2.2.0", replacement: "formulas.work.universityGains or formulas.work.gymGains" },
});
return formulasFunctions;
}
+8 -6
View File
@@ -40,7 +40,7 @@ import { Server } from "../Server/Server";
import { netscriptCanHack } from "../Hacking/netscriptCanHack";
import { FactionInfos } from "../Faction/FactionInfo";
import { donate, repNeededToDonate } from "../Faction/formulas/donation";
import { InternalAPI, removedFunction } from "../Netscript/APIWrapper";
import { InternalAPI, setRemovedFunctions } from "../Netscript/APIWrapper";
import { enterBitNode } from "../RedPill";
import { ClassWork } from "../Work/ClassWork";
import { CreateProgramWork, isCreateProgramWork } from "../Work/CreateProgramWork";
@@ -1204,11 +1204,13 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
return canGetBonus();
},
};
Object.assign(singularityAPI, {
getAugmentationCost: removedFunction(
"v2.2.0",
"singularity.getAugmentationPrice and singularity.getAugmentationRepReq",
),
// Removed functions
setRemovedFunctions(singularityAPI, {
getAugmentationCost: {
version: "2.2.0",
replacement: "singularity.getAugmentationPrice and singularity.getAugmentationRepReq",
},
});
return singularityAPI;
}
+6 -6
View File
@@ -5,7 +5,7 @@ import { Player } from "@player";
import { Augmentations } from "../Augmentation/Augmentations";
import { findCrime } from "../Crime/CrimeHelpers";
import { getEnumHelper } from "../utils/EnumHelper";
import { InternalAPI, NetscriptContext, removedFunction } from "../Netscript/APIWrapper";
import { InternalAPI, NetscriptContext, setRemovedFunctions } from "../Netscript/APIWrapper";
import { isSleeveBladeburnerWork } from "../PersonObjects/Sleeve/Work/SleeveBladeburnerWork";
import { isSleeveFactionWork } from "../PersonObjects/Sleeve/Work/SleeveFactionWork";
import { isSleeveCompanyWork } from "../PersonObjects/Sleeve/Work/SleeveCompanyWork";
@@ -262,11 +262,11 @@ export function NetscriptSleeve(): InternalAPI<NetscriptSleeve> {
return Player.sleeves[sleeveNumber].bladeburner(action, contract);
},
};
// Removed undocumented functions added using Object.assign because typescript.
// TODO: Remove these at 3.0
Object.assign(sleeveFunctions, {
getSleeveStats: removedFunction("v2.2.0", "sleeve.getSleeve"),
getInformation: removedFunction("v2.2.0", "sleeve.getSleeve"),
// Removed functions
setRemovedFunctions(sleeveFunctions, {
getSleeveStats: { version: "2.2.0", replacement: "sleeve.getSleeve" },
getInformation: { version: "2.2.0", replacement: "sleeve.getSleeve" },
});
return sleeveFunctions;
}