mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
few bugfix
This commit is contained in:
parent
a954259e25
commit
558b671206
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
|||||||
* This is the component for displaying a single faction's UI, not the list of all
|
* This is the component for displaying a single faction's UI, not the list of all
|
||||||
* accessible factions
|
* accessible factions
|
||||||
*/
|
*/
|
||||||
import React, { useState } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
import { AugmentationsPage } from "./AugmentationsPage";
|
import { AugmentationsPage } from "./AugmentationsPage";
|
||||||
import { DonateOption } from "./DonateOption";
|
import { DonateOption } from "./DonateOption";
|
||||||
@ -66,11 +66,20 @@ const GangNames = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export function FactionRoot(props: IProps): React.ReactElement {
|
export function FactionRoot(props: IProps): React.ReactElement {
|
||||||
|
const setRerender = useState(false)[1];
|
||||||
|
function rerender(): void {
|
||||||
|
setRerender((old) => !old);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(rerender, 1000);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const faction = props.faction;
|
const faction = props.faction;
|
||||||
|
|
||||||
const player = use.Player();
|
const player = use.Player();
|
||||||
const router = use.Router();
|
const router = use.Router();
|
||||||
const [, setRerenderFlag] = useState(false);
|
|
||||||
const [purchasingAugs, setPurchasingAugs] = useState(false);
|
const [purchasingAugs, setPurchasingAugs] = useState(false);
|
||||||
|
|
||||||
function manageGang(faction: Faction): void {
|
function manageGang(faction: Faction): void {
|
||||||
@ -88,9 +97,6 @@ export function FactionRoot(props: IProps): React.ReactElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function rerender(): void {
|
|
||||||
setRerenderFlag((old) => !old);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Route to the main faction page
|
// Route to the main faction page
|
||||||
function routeToMain(): void {
|
function routeToMain(): void {
|
||||||
|
@ -3340,6 +3340,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
updateDynamicRam("stopAction", getRamCost("stopAction"));
|
updateDynamicRam("stopAction", getRamCost("stopAction"));
|
||||||
checkSingularityAccess("stopAction", 1);
|
checkSingularityAccess("stopAction", 1);
|
||||||
if (Player.isWorking) {
|
if (Player.isWorking) {
|
||||||
|
Router.toTerminal();
|
||||||
var txt = Player.singularityStopWork();
|
var txt = Player.singularityStopWork();
|
||||||
workerScript.log("stopAction", txt);
|
workerScript.log("stopAction", txt);
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,6 +25,7 @@ import { WorkerScript } from "../../Netscript/WorkerScript";
|
|||||||
import { Settings } from "../../Settings/Settings";
|
import { Settings } from "../../Settings/Settings";
|
||||||
import { iTutorialNextStep, ITutorial, iTutorialSteps } from "../../InteractiveTutorial";
|
import { iTutorialNextStep, ITutorial, iTutorialSteps } from "../../InteractiveTutorial";
|
||||||
|
|
||||||
|
let loaded=false;
|
||||||
let symbols: string[] = [];
|
let symbols: string[] = [];
|
||||||
(function () {
|
(function () {
|
||||||
const ns = NetscriptFunctions({} as WorkerScript);
|
const ns = NetscriptFunctions({} as WorkerScript);
|
||||||
@ -309,6 +310,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
});
|
});
|
||||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, "netscript.d.ts");
|
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, "netscript.d.ts");
|
||||||
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, "netscript.d.ts");
|
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, "netscript.d.ts");
|
||||||
|
loaded=true
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -20,9 +20,11 @@ export class Output {
|
|||||||
|
|
||||||
export class Link {
|
export class Link {
|
||||||
hostname: string;
|
hostname: string;
|
||||||
constructor(hostname: string) {
|
dashes: string;
|
||||||
if (Settings.EnableTimestamps) hostname = "[" + getTimestamp() + "] " + hostname;
|
constructor(dashes: string, hostname: string) {
|
||||||
|
if (Settings.EnableTimestamps) dashes = "[" + getTimestamp() + "] " + dashes;
|
||||||
this.hostname = hostname;
|
this.hostname = hostname;
|
||||||
|
this.dashes = dashes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,9 +401,9 @@ export class Terminal implements ITerminal {
|
|||||||
} // Don't print current server
|
} // Don't print current server
|
||||||
const titleDashes = Array((d - 1) * 4 + 1).join("-");
|
const titleDashes = Array((d - 1) * 4 + 1).join("-");
|
||||||
if (player.hasProgram(Programs.AutoLink.name)) {
|
if (player.hasProgram(Programs.AutoLink.name)) {
|
||||||
this.append(new Link(s.hostname));
|
this.append(new Link(titleDashes, s.hostname));
|
||||||
} else {
|
} else {
|
||||||
this.print(s.hostname);
|
this.print(titleDashes+s.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dashes = titleDashes + "--";
|
const dashes = titleDashes + "--";
|
||||||
@ -420,19 +420,6 @@ export class Terminal implements ITerminal {
|
|||||||
this.print(dashes + "RAM: " + numeralWrapper.formatRAM(s.maxRam));
|
this.print(dashes + "RAM: " + numeralWrapper.formatRAM(s.maxRam));
|
||||||
this.print(" ");
|
this.print(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
const links = document.getElementsByClassName("scan-analyze-link");
|
|
||||||
for (let i = 0; i < links.length; ++i) {
|
|
||||||
(() => {
|
|
||||||
const hostname = links[i].innerHTML.toString();
|
|
||||||
links[i].addEventListener("onclick", () => {
|
|
||||||
if (this.action !== null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.connectToServer(player, hostname);
|
|
||||||
});
|
|
||||||
})(); // Immediate invocation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connectToServer(player: IPlayer, server: string): void {
|
connectToServer(player: IPlayer, server: string): void {
|
||||||
|
@ -93,13 +93,13 @@ export function TerminalRoot({ terminal, router, player }: IProps): React.ReactE
|
|||||||
if (item instanceof Link)
|
if (item instanceof Link)
|
||||||
return (
|
return (
|
||||||
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
||||||
<MuiLink
|
<Typography>{item.dashes}> </Typography><MuiLink
|
||||||
classes={{ root: classes.preformatted }}
|
classes={{ root: classes.preformatted }}
|
||||||
color={"secondary"}
|
color={"secondary"}
|
||||||
paragraph={false}
|
paragraph={false}
|
||||||
onClick={() => terminal.connectToServer(player, item.hostname)}
|
onClick={() => terminal.connectToServer(player, item.hostname)}
|
||||||
>
|
>
|
||||||
> {item.hostname}
|
{item.hostname}
|
||||||
</MuiLink>
|
</MuiLink>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user