few bugfix

This commit is contained in:
Olivier Gagnon 2021-09-22 11:32:04 -04:00
parent a954259e25
commit 558b671206
8 changed files with 25 additions and 27 deletions

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}&gt;&nbsp;</Typography><MuiLink
classes={{ root: classes.preformatted }}
color={"secondary"}
paragraph={false}
onClick={() => terminal.connectToServer(player, item.hostname)}
>
&gt;&nbsp;{item.hostname}
{item.hostname}
</MuiLink>
</ListItem>
);