From 4ebfdcc4a8ada288e3188d61ad44f6d308ada21c Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Mon, 6 Mar 2023 11:45:09 -0500 Subject: [PATCH] Changelog + misc minor changes Recovery textarea no longer spellchecks, fixed some "as" type assertions that were not necessary. --- src/Achievements/Achievements.ts | 2 +- src/Constants.ts | 22 ++++++++++++++++------ src/Netscript/NetscriptHelpers.ts | 6 +++--- src/ui/React/RecoveryRoot.tsx | 1 + 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Achievements/Achievements.ts b/src/Achievements/Achievements.ts index 79edf12a9..03465473a 100644 --- a/src/Achievements/Achievements.ts +++ b/src/Achievements/Achievements.ts @@ -341,7 +341,7 @@ export const achievements: Record = { SCRIPT_32GB: { ...achievementData["SCRIPT_32GB"], Icon: "bigcost", - Condition: () => Player.getHomeComputer().scripts.some((s) => (s.ramUsage as number) >= 32), + Condition: () => Player.getHomeComputer().scripts.some((s) => s.ramUsage ?? 0 >= 32), }, FIRST_HACKNET_NODE: { ...achievementData["FIRST_HACKNET_NODE"], diff --git a/src/Constants.ts b/src/Constants.ts index ed5e6275f..4c46b08ab 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -229,22 +229,32 @@ export const CONSTANTS: { LatestUpdate: ` v2.3 Dev +* Monaco script editor updated to a newer version + more config options. (@Snarling) +* Revamp of script ram calculation process, should be more reliable now. (@Snarling) +* The SF9.3 bonus is also given to the player when inside of BN9. (@Zelow79) +* Adjusted the SF1 bonus for hacknet costs (slight nerf), and raised the SF9 bonus to compensate. (@d0sboots) +* Sleeve shock recovery now scales with intelligence. (@Tyasuh) +* Improve ns.scp filename recognition when leading slash discrepancy (@lucebac) +* Fix memory leak when netscript ports were initialized and never used again. (@Snarling) +* Fix a bug that could result in an infinite atExit loop if a script killed itself. (@Snarling) +* Fix a bug where numeric terminal arguments were not being detected as strings when enclosed in quote marks. (@LiamGeorge1999) +* Fix a bug with hackAnalyzeThreads where infinite threads would be indicated any time a single thread would hack less than $1 (@Snarling) +* Fix a misspelled moneySourceTracker call for sleeves (@zerbosh) +* All Math Expressions contract no longer accepts wrong answers (@Snarling) +* Improve Electron's handling of external links (@Snarling) +* Documentation improvements (@Mughur, @quacksouls, @Snarling, @AdityaHegde) +* Nerf noodle bar -Major bugfix (Will backport these changes to 2.2.2 if possible) +2.2.2 Hotfixes * Fix an issue that prevented the Electron API server from communicating with the VSCode plugin. (credit to u/AnyGiraffe4367 on reddit) Other changes -* Monaco script editor updated to a newer version. Also many internal code changes to support this. (@Snarling) -* The SF9.3 bonus is also given to the player when inside of BN9. (@Zelow79) -* Sleeve shock recovery now scales with intelligence. (@Tyasuh) -* Nerf noodle bar Planned changes: * 2.3 will include a large planned rework to corporation. This may cause api breaks for any corporation scripts, and there will be large changes in how the corporation mechanic functions. * Enum changes, potentially causing API break with some enums. Enums will be more usable and there will be more of them. * Constants rework - interenal game constants will be reorganized and will be provided to the player as different categories of constants. * Improve type validation on ns functions. -* Add more Script Editor configuration options (font family, ligatures, etc). * Further deprecation of ns1. Removal of more documentation, add ingame notice to prompt player to update scripts to .js. * Nerf noodle bar `, diff --git a/src/Netscript/NetscriptHelpers.ts b/src/Netscript/NetscriptHelpers.ts index d40b2cc08..836f9e789 100644 --- a/src/Netscript/NetscriptHelpers.ts +++ b/src/Netscript/NetscriptHelpers.ts @@ -33,7 +33,7 @@ import { BaseServer } from "../Server/BaseServer"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { checkEnum } from "../utils/helpers/enum"; import { RamCostConstants } from "./RamCostGenerator"; -import { PositiveInteger } from "../types"; +import { isPositiveInteger, PositiveInteger } from "../types"; export const helpers = { string, @@ -161,10 +161,10 @@ function number(ctx: NetscriptContext, argName: string, v: unknown): number { /** Convert provided value v for argument argName to a positive integer, throwing if it looks like something else. */ function positiveInteger(ctx: NetscriptContext, argName: string, v: unknown): PositiveInteger { const n = number(ctx, argName, v); - if (n < 1 || !Number.isInteger(n)) { + if (!isPositiveInteger(n)) { throw makeRuntimeErrorMsg(ctx, `${argName} should be a positive integer, was ${n}`, "TYPE"); } - return n as PositiveInteger; + return n; } /** Returns args back if it is a ScriptArg[]. Throws an error if it is not. */ diff --git a/src/ui/React/RecoveryRoot.tsx b/src/ui/React/RecoveryRoot.tsx index 820201112..90c5c1159 100644 --- a/src/ui/React/RecoveryRoot.tsx +++ b/src/ui/React/RecoveryRoot.tsx @@ -92,6 +92,7 @@ export function RecoveryRoot({ softReset, errorData, resetError }: IProps): Reac multiline fullWidth rows={12} + spellCheck={false} sx={{ "& .MuiOutlinedInput-root": { color: Settings.theme.secondary } }} />