VARIOUS: Various changes prior to release 2.2 (#271)

See PR #271 description
This commit is contained in:
Snarling
2022-12-29 20:28:53 -05:00
committed by GitHub
parent 24ad342203
commit fb1f95c26e
310 changed files with 3768 additions and 2583 deletions
+8 -6
View File
@@ -1,4 +1,4 @@
import { Infiltration as IInfiltration, InfiltrationLocation } from "../ScriptEditor/NetscriptDefinitions";
import { Infiltration as IInfiltration, InfiltrationLocation } from "@nsdefs";
import { Location } from "../Locations/Location";
import { Locations } from "../Locations/Locations";
import { calculateDifficulty, calculateReward } from "../Infiltration/formulas/game";
@@ -11,7 +11,7 @@ import { FactionNames } from "../Faction/data/FactionNames";
import { Factions } from "../Faction/Factions";
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { checkEnum } from "../utils/helpers/enum";
import { LocationName } from "../utils/enums";
import { CityName, LocationName } from "../Enums";
import { helpers } from "../Netscript/NetscriptHelpers";
export function NetscriptInfiltration(): InternalAPI<IInfiltration> {
@@ -41,10 +41,12 @@ export function NetscriptInfiltration(): InternalAPI<IInfiltration> {
};
return {
getPossibleLocations: () => () => {
return getLocationsWithInfiltrations.map((l) => ({
city: l.city ?? "",
name: String(l.name),
}));
return getLocationsWithInfiltrations
.filter((l) => l.city) //Guarantees no locations with a "null" entry, which should not be infiltratable anyway.
.map((l) => ({
city: l.city as CityName,
name: l.name,
}));
},
getInfiltration: (ctx) => (_location) => {
const location = helpers.string(ctx, "location", _location);