From c6a2664296dff2da01049848f41d6160e1f6232f Mon Sep 17 00:00:00 2001 From: DavidGrinberg Date: Fri, 25 Mar 2022 13:06:12 -0400 Subject: [PATCH 1/2] purchaseTor returns true if player already has tor Change `purchaseTor` to return `true` if the player already has purchased Tor. Previously it would return `false` Changing this to true puts the behavior inline with the already existing behavior of `purchaseProgram`, which returns true if you have already purchased the program. Additionally this lets us call `purcahseTor` with the same logic that we use to call `purchaseProgram` --- src/NetscriptFunctions/Singularity.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 26fbd760d..3972d0bb2 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -499,7 +499,7 @@ export function NetscriptSingularity( if (player.hasTorRouter()) { workerScript.log("purchaseTor", () => "You already have a TOR router!"); - return false; + return true; } if (player.money < CONSTANTS.TorRouterCost) { From 4497fbdda0f0ed91bcf953b3f0559add827fba74 Mon Sep 17 00:00:00 2001 From: DavidGrinberg Date: Fri, 25 Mar 2022 23:02:23 -0400 Subject: [PATCH 2/2] Update documentation for purchaseTor Reflect the changes to the logic --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index a062ddd29..1782e8c8c 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1597,7 +1597,7 @@ export interface Singularity { * purchasing a TOR router using this function is the same as if you were to * manually purchase one. * - * @returns True if actions is successful, false otherwise. + * @returns True if actions is successful or you already own TOR router, false otherwise. */ purchaseTor(): boolean;