From 7d07f44b3eb9159352d1cbe159e996990e196c69 Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Tue, 11 Oct 2022 20:01:10 -0400 Subject: [PATCH] move to global scope --- src/Netscript/RamCostGenerator.ts | 1 - src/NetscriptFunctions/Extra.ts | 7 ------- src/Terminal.ts | 8 +++++++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index e470a1e03..165c256a2 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -546,7 +546,6 @@ export const RamCosts: RamCostTree> = { // Easter egg function break: 0, }, - printRaw: 0, formulas: { mockServer: 0, diff --git a/src/NetscriptFunctions/Extra.ts b/src/NetscriptFunctions/Extra.ts index a9dce1ce5..5ce2ca8d4 100644 --- a/src/NetscriptFunctions/Extra.ts +++ b/src/NetscriptFunctions/Extra.ts @@ -4,8 +4,6 @@ import * as bcrypt from "bcryptjs"; import { Apr1Events as devMenu } from "../ui/Apr1"; import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; import { helpers } from "../Netscript/NetscriptHelpers"; -import { ReactNode } from "react"; -import { Terminal } from "../Terminal"; export interface INetscriptExtra { heart: { @@ -16,7 +14,6 @@ export interface INetscriptExtra { bypass(doc: Document): void; alterReality(): void; rainbow(guess: string): void; - printRaw(node: ReactNode): void; } export function NetscriptExtra(): InternalAPI { @@ -78,9 +75,5 @@ export function NetscriptExtra(): InternalAPI { } return tryGuess(); }, - printRaw: () => (node: unknown) => { - // Just wraps the internal function to allow player use - players can use at own risk - Terminal.printRaw(node as ReactNode); - }, }; } diff --git a/src/Terminal.ts b/src/Terminal.ts index 99835551e..1afe3ac44 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1,3 +1,9 @@ import { Terminal as TTerminal } from "./Terminal/Terminal"; - +import { ReactNode } from "react"; +declare global { + interface Window { + tprintRaw: (node: ReactNode) => void; + } +} export const Terminal = new TTerminal(); +window["tprintRaw"] = Terminal.printRaw.bind(Terminal);