Fix use-before-defined import issue

This commit is contained in:
Snarling 2022-09-13 13:15:36 -04:00
parent 91a69d7d8f
commit 1ac57d2e48
5 changed files with 33 additions and 29 deletions

@ -5,7 +5,7 @@ import { uniqueId } from "lodash";
import React from "react";
import { SpecialServers } from "../../Server/data/SpecialServers";
import { Settings } from "../../Settings/Settings";
import { Player } from "../../ui/Player";
import { Player } from "../../Player";
import { StatsRow } from "../../ui/React/StatsRow";
import { defaultMultipliers, getBitNodeMultipliers } from "../BitNode";
import { IBitNodeMultipliers } from "../BitNodeMultipliers";

@ -2,7 +2,9 @@ import { DarkWebItem } from "./DarkWebItem";
import { IMap } from "../types";
import { Programs } from "../Programs/Programs";
export const DarkWebItems: IMap<DarkWebItem> = {
export const DarkWebItems: IMap<DarkWebItem> = {};
export function initDarkWebItems() {
Object.assign(DarkWebItems, {
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."),
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."),
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."),
@ -17,4 +19,5 @@ export const DarkWebItems: IMap<DarkWebItem> = {
DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."),
AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze'."),
FormulasProgram: new DarkWebItem(Programs.Formulas.name, 5e9, "Unlock access to the formulas API."),
};
});
}

@ -44,39 +44,39 @@ export function GenericLocation({ loc }: IProps): React.ReactElement {
const content: React.ReactNode[] = [];
if (loc.types.includes(LocationType.Company)) {
content.push(<CompanyLocation key={"companylocation"} locName={loc.name} />);
content.push(<CompanyLocation locName={loc.name} />);
}
if (loc.types.includes(LocationType.Gym)) {
content.push(<GymLocation key={"gymlocation"} loc={loc} />);
content.push(<GymLocation loc={loc} />);
}
if (loc.types.includes(LocationType.Hospital)) {
content.push(<HospitalLocation key={"hospitallocation"} />);
content.push(<HospitalLocation />);
}
if (loc.types.includes(LocationType.Slums)) {
content.push(<SlumsLocation key={"slumslocation"} />);
content.push(<SlumsLocation />);
}
if (loc.types.includes(LocationType.Special)) {
content.push(<SpecialLocation key={"speciallocation"} loc={loc} />);
content.push(<SpecialLocation loc={loc} />);
}
if (loc.types.includes(LocationType.TechVendor)) {
content.push(<TechVendorLocation key={"techvendorlocation"} loc={loc} />);
content.push(<TechVendorLocation loc={loc} />);
}
if (loc.types.includes(LocationType.TravelAgency)) {
content.push(<TravelAgencyRoot key={"travelagencylocation"} />);
content.push(<TravelAgencyRoot />);
}
if (loc.types.includes(LocationType.University)) {
content.push(<UniversityLocation key={"universitylocation"} loc={loc} />);
content.push(<UniversityLocation loc={loc} />);
}
if (loc.types.includes(LocationType.Casino)) {
content.push(<CasinoLocation key={"casinoLocation"} />);
content.push(<CasinoLocation />);
}
return content;

@ -17,6 +17,7 @@ type IState = {
currHp: number;
};
//Todo: Make this a functional component
export class HospitalLocation extends React.Component<Record<string, never>, IState> {
/**
* Stores button styling that sets them all to block display
@ -26,9 +27,6 @@ export class HospitalLocation extends React.Component<Record<string, never>, ISt
constructor() {
super({});
this.getCost = this.getCost.bind(this);
this.getHealed = this.getHealed.bind(this);
this.state = {
currHp: Player.hp.current,
};

@ -5,6 +5,7 @@ import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions"
import { initAugmentations } from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { initBitNodeMultipliers } from "./BitNode/BitNode";
import { initDarkWebItems } from "./DarkWeb/DarkWebItems";
import { Bladeburner } from "./Bladeburner/Bladeburner";
import { generateRandomContract } from "./CodingContractGenerator";
import { initCompanies } from "./Company/Companies";
@ -241,6 +242,7 @@ const Engine: {
ThemeEvents.emit();
initBitNodeMultipliers();
initDarkWebItems();
initAugmentations(); // Also calls Player.reapplyAllAugmentations()
Player.reapplyAllSourceFiles();
if (Player.hasWseAccount) {
@ -398,6 +400,7 @@ const Engine: {
initForeignServers(Player.getHomeComputer());
initCompanies();
initFactions();
initDarkWebItems();
initAugmentations();
// Start interactive tutorial