tail box close on soft reset

This commit is contained in:
Olivier Gagnon 2021-11-26 18:47:12 -05:00
parent 6e71258a53
commit f17870926b
2 changed files with 11 additions and 1 deletions

@ -28,6 +28,7 @@ import { dialogBoxCreate } from "./ui/React/DialogBox";
import { ProgramsSeen } from "./Programs/ui/ProgramsRoot"; import { ProgramsSeen } from "./Programs/ui/ProgramsRoot";
import { InvitationsSeen } from "./Faction/ui/FactionsRoot"; import { InvitationsSeen } from "./Faction/ui/FactionsRoot";
import { LogBoxClearEvents } from "./ui/React/LogBoxManager";
const BitNode8StartingMoney = 250e6; const BitNode8StartingMoney = 250e6;
@ -85,11 +86,12 @@ export function prestigeAugmentation(): void {
} }
} }
// Stop a Terminal action if there is onerror // Stop a Terminal action if there is one.
if (Terminal.action !== null) { if (Terminal.action !== null) {
Terminal.finishAction(Router, Player, true); Terminal.finishAction(Router, Player, true);
} }
Terminal.clear(); Terminal.clear();
LogBoxClearEvents.emit();
// Re-initialize things - This will update any changes // Re-initialize things - This will update any changes
initFactions(); // Factions must be initialized before augmentations initFactions(); // Factions must be initialized before augmentations

@ -19,6 +19,7 @@ import { Theme } from "@mui/material";
let layerCounter = 0; let layerCounter = 0;
export const LogBoxEvents = new EventEmitter<[RunningScript]>(); export const LogBoxEvents = new EventEmitter<[RunningScript]>();
export const LogBoxClearEvents = new EventEmitter<[]>();
interface Log { interface Log {
id: string; id: string;
@ -46,6 +47,13 @@ export function LogBoxManager(): React.ReactElement {
[], [],
); );
useEffect(() =>
LogBoxClearEvents.subscribe(() => {
logs = [];
rerender();
}),
);
function close(id: string): void { function close(id: string): void {
logs = logs.filter((l) => l.id !== id); logs = logs.filter((l) => l.id !== id);
rerender(); rerender();