mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
CODEBASE: Add Jsonable Map and Set types, move player.sourceFiles to a map (#473)
This commit is contained in:
@@ -15,7 +15,7 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
|
||||
return;
|
||||
};
|
||||
const getBladeburner = function (ctx: NetscriptContext): Bladeburner {
|
||||
const apiAccess = Player.bitNodeN === 7 || Player.sourceFiles.some((a) => a.n === 7);
|
||||
const apiAccess = Player.bitNodeN === 7 || Player.sourceFileLvl(7) > 0;
|
||||
if (!apiAccess) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "You have not unlocked the bladeburner API.", "API ACCESS");
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
numPeopleKilled: 0,
|
||||
money: 0,
|
||||
city: CityName.Sector12,
|
||||
location: "",
|
||||
location: LocationName.TravelAgency,
|
||||
bitNodeN: 0,
|
||||
totalPlaytime: 0,
|
||||
jobs: {},
|
||||
|
||||
@@ -50,7 +50,6 @@ import { canGetBonus, onExport } from "../ExportBonus";
|
||||
import { saveObject } from "../SaveObject";
|
||||
import { calculateCrimeWorkStats } from "../Work/Formulas";
|
||||
import { findEnumMember } from "../utils/helpers/enum";
|
||||
import { areFilesEqual } from "../Terminal/DirectoryHelpers";
|
||||
import { Engine } from "../engine";
|
||||
import { checkEnum } from "../utils/helpers/enum";
|
||||
|
||||
@@ -81,7 +80,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
//Run a script after reset
|
||||
if (!cbScript) return;
|
||||
const home = Player.getHomeComputer();
|
||||
const script = home.scripts.find((serverScript) => areFilesEqual(serverScript.filename, cbScript));
|
||||
const script = home.scripts.get(cbScript);
|
||||
if (!script) return;
|
||||
const ramUsage = script.getRamUsage(home.scripts);
|
||||
if (!ramUsage) {
|
||||
@@ -110,9 +109,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return res;
|
||||
},
|
||||
getOwnedSourceFiles: () => () => {
|
||||
return Player.sourceFiles.map((sf) => {
|
||||
return { n: sf.n, lvl: sf.lvl };
|
||||
});
|
||||
return [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl }));
|
||||
},
|
||||
getAugmentationsFromFaction: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
|
||||
Reference in New Issue
Block a user