From 41b6f0b87b77fb03a4b6adaec834a1bdc2e970a1 Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Tue, 11 Oct 2022 21:02:04 -0400 Subject: [PATCH] add hoop before exposing --- src/Netscript/RamCostGenerator.ts | 1 + src/NetscriptFunctions/Extra.ts | 7 +++++++ src/Terminal.ts | 7 ------- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 165c256a2..9c72aecea 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -546,6 +546,7 @@ export const RamCosts: RamCostTree> = { // Easter egg function break: 0, }, + iKnowWhatImDoing: 0, formulas: { mockServer: 0, diff --git a/src/NetscriptFunctions/Extra.ts b/src/NetscriptFunctions/Extra.ts index 5ce2ca8d4..c0f1a4780 100644 --- a/src/NetscriptFunctions/Extra.ts +++ b/src/NetscriptFunctions/Extra.ts @@ -4,6 +4,7 @@ import * as bcrypt from "bcryptjs"; import { Apr1Events as devMenu } from "../ui/Apr1"; import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; import { helpers } from "../Netscript/NetscriptHelpers"; +import { Terminal } from "../Terminal"; export interface INetscriptExtra { heart: { @@ -14,6 +15,7 @@ export interface INetscriptExtra { bypass(doc: Document): void; alterReality(): void; rainbow(guess: string): void; + iKnowWhatImDoing(): void; } export function NetscriptExtra(): InternalAPI { @@ -75,5 +77,10 @@ export function NetscriptExtra(): InternalAPI { } return tryGuess(); }, + iKnowWhatImDoing: (ctx) => () => { + helpers.log(ctx, () => "Unlocking unsupported feature: window.tprintRaw"); + // @ts-ignore window has no tprintRaw property defined + window.tprintRaw = Terminal.printRaw.bind(Terminal); + }, }; } diff --git a/src/Terminal.ts b/src/Terminal.ts index 1afe3ac44..c28f17050 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1,9 +1,2 @@ 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);