mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 19:43:49 +01:00
commit
b1119f623f
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
|
||||
* accessible factions
|
||||
*/
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { AugmentationsPage } from "./AugmentationsPage";
|
||||
import { DonateOption } from "./DonateOption";
|
||||
@ -66,11 +66,20 @@ const GangNames = [
|
||||
];
|
||||
|
||||
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 player = use.Player();
|
||||
const router = use.Router();
|
||||
const [, setRerenderFlag] = useState(false);
|
||||
const [purchasingAugs, setPurchasingAugs] = useState(false);
|
||||
|
||||
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
|
||||
function routeToMain(): void {
|
||||
|
@ -3340,6 +3340,7 @@ function NetscriptFunctions(workerScript) {
|
||||
updateDynamicRam("stopAction", getRamCost("stopAction"));
|
||||
checkSingularityAccess("stopAction", 1);
|
||||
if (Player.isWorking) {
|
||||
Router.toTerminal();
|
||||
var txt = Player.singularityStopWork();
|
||||
workerScript.log("stopAction", txt);
|
||||
return true;
|
||||
|
@ -25,6 +25,7 @@ import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { iTutorialNextStep, ITutorial, iTutorialSteps } from "../../InteractiveTutorial";
|
||||
|
||||
let loaded=false;
|
||||
let symbols: string[] = [];
|
||||
(function () {
|
||||
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.typescriptDefaults.addExtraLib(libSource, "netscript.d.ts");
|
||||
loaded=true
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -20,9 +20,11 @@ export class Output {
|
||||
|
||||
export class Link {
|
||||
hostname: string;
|
||||
constructor(hostname: string) {
|
||||
if (Settings.EnableTimestamps) hostname = "[" + getTimestamp() + "] " + hostname;
|
||||
dashes: string;
|
||||
constructor(dashes: string, hostname: string) {
|
||||
if (Settings.EnableTimestamps) dashes = "[" + getTimestamp() + "] " + dashes;
|
||||
this.hostname = hostname;
|
||||
this.dashes = dashes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,9 +401,9 @@ export class Terminal implements ITerminal {
|
||||
} // Don't print current server
|
||||
const titleDashes = Array((d - 1) * 4 + 1).join("-");
|
||||
if (player.hasProgram(Programs.AutoLink.name)) {
|
||||
this.append(new Link(s.hostname));
|
||||
this.append(new Link(titleDashes, s.hostname));
|
||||
} else {
|
||||
this.print(s.hostname);
|
||||
this.print(titleDashes+s.hostname);
|
||||
}
|
||||
|
||||
const dashes = titleDashes + "--";
|
||||
@ -420,19 +420,6 @@ export class Terminal implements ITerminal {
|
||||
this.print(dashes + "RAM: " + numeralWrapper.formatRAM(s.maxRam));
|
||||
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 {
|
||||
|
@ -93,13 +93,13 @@ export function TerminalRoot({ terminal, router, player }: IProps): React.ReactE
|
||||
if (item instanceof Link)
|
||||
return (
|
||||
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
||||
<MuiLink
|
||||
<Typography>{item.dashes}> </Typography><MuiLink
|
||||
classes={{ root: classes.preformatted }}
|
||||
color={"secondary"}
|
||||
paragraph={false}
|
||||
onClick={() => terminal.connectToServer(player, item.hostname)}
|
||||
>
|
||||
> {item.hostname}
|
||||
{item.hostname}
|
||||
</MuiLink>
|
||||
</ListItem>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user