Commit Graph

833 Commits

Author SHA1 Message Date
catloversg 6d8084f40e MISC: Improve tutorial, documentation and discoverability of NS API documentation (#1697) 2024-10-20 20:37:42 -07:00
catloversg 2fa8dd41ac BUGFIX: Missing tooltip when doing faction work (#1679) 2024-10-07 23:51:02 -07:00
Yichi Zhang 2b4410739d HACKNET: Remove hacknet servers from ServerType.Foreign (#1665) 2024-09-25 16:19:25 -07:00
catloversg ade92ed297 BUGFIX: Wrong size of table cell in Import Save Comparison UI (#1659) 2024-09-20 21:02:57 -07:00
David Walker 21ffa5322f MISC: Refactor coding contracts for type safety (#1653)
* MISC: Refactor coding contracts for type safety

This refactor does three things without any behavior changes:
* Adds type safety by introducing generic type parameters to the coding
  contract definitions, so they can use concrete types instead of
  "unknown". This also eliminates a bunch of boilerplate casts.
* Removes the unneeded CodingContractType class. We can use the metadata
  type directly.
* Introduces a new hidden state to coding contracts. Instead of
  generating and storing the data (which is what is shown to the user as
  the problem's input), the state is stored instead. This allows
  problems to (for instance) generate the answer up-front, and check the
  solution directly against the answer, instead of needing to embed a
  solver in the problem (which can then easily be ripped from the source
  code).

For compatibility, state == data by default. I plan to make use of this
feature in a followup, but it is unused currently.
2024-09-15 23:53:10 -07:00
catloversg 3750363d95 MISC: Show more information about documentation in last step of tutorial (#1630) 2024-08-25 10:04:55 -07:00
catloversg 2e42a1f781 DOCUMENTATION: Minor changes in index page (#1626) 2024-08-24 14:11:11 -07:00
David Walker 5b2a4eafcb MISC: Improve several things relating to PID lookups (#1594)
findRunningScriptByPid needlessly took a "server" argument. This caused
there to be a "getRunningScriptByPid" version that did *not*, and it was
looping through all servers in order to function, which is needlessly
inefficient.

By removing the parameter and the needless inefficient helper method,
the following changes:
- Many Netscript functions such as isRunning() and getScript() become faster.
- The terminal "tail" command now works by pid regardless of the current
  server. Note that "kill" already worked this way.

I also improved the docs around "tail", since the pid argument wasn't
in the help.
2024-08-17 14:03:00 -07:00
Nicole 7029ac9bcc UI: Add apostrophe to stanek's gift strings (#1568) 2024-08-11 16:38:40 -07:00
catloversg 9a77b47241 MISC: Remove js-sha256 (#1278) 2024-08-05 13:40:16 -07:00
catloversg 7c7293b687 BUGFIX: Prompt does not reset text value (#1539) 2024-08-04 00:01:01 -07:00
Tom Prince 2f95d21503 UI: Sync UI updates to game updates. (#1512)
There are a bunch of React components that update at the same rate
that the game engine processes cycles. Rather than have each place
that does so start its own timer to update that often, add a new
react hook that triggers an update shortly after the engine completes
a cycle.
2024-08-01 23:57:43 -07:00
catloversg 9308301b12 UI: Fix misleading favor numbers (#1530) 2024-08-01 22:44:03 -07:00
robofinch 42bcfa1889 BUGFIX: Prevent runtime NotAllowedError on Safari (#1507)
Could occur when the browser’s window is resized.
2024-07-20 01:16:02 -07:00
David Walker 4502fd443e BUGFIX: Don't spin forever if IDB can't be loaded (#1500)
Our IndexDB handling did not have very good error handling. It wasn't
reporting the actual errors that occured, nor was it using actual Error
objects. In some cases it also had overly convoluted Promise use, and it
didn't need to be .tsx either.

The biggest issue was that if any problem occured during the main
load(), this would end up as an unhandled rejection and so it would only
be logged to the console. This extends the previous catch to also cover
this, so that the recovery screen is activated.
2024-07-19 19:27:04 -07:00
Tom Prince d1f190c894 BUGFIX: Fix mathjax path on dev server. (#1501) 2024-07-19 17:13:42 -07:00
Tom Prince dc93d166f0 BUGFIX: Use mathjax from npm, rather than vendored copy. (#1491) 2024-07-18 16:27:01 -07:00
David Walker abe7a43eec MISC: Always include stack trace in Recovery Mode (#1487)
We are getting some more error reports coming in that don't have enough
info in them. It turns out that populating the stack trace was gated
behind the dev flag; in reality, production builds are where we need it
most. Even if it ends up being obfuscated (source maps should prevent
this), we can figure out the actual source lines with enough effort if
need be.

This also changes to using the actual stack trace, rather than the
"component" trace (the tree of JSX objects), since knowing where the
code failed is far more valuable. Also, it ensures we get the full error
details when things go wrong in savefile loading.
2024-07-14 22:51:18 -07:00
catloversg 864613c616 MISC: Support JSX, TS, TSX script files (#1216) 2024-07-14 14:47:10 -07:00
catloversg 783120c886 FEATURE: BitNode options (#1411) 2024-07-14 14:30:30 -07:00
David Walker 06553d9700 BUGFIX: Fix "Router called before initialization" race (#1474)
If the game takes long enough to load, certain counters can become
eligible to run as soon as Engine.start() runs. When this happens,
eventually Router.page() is called, which throws an Error since Router
isn't initialized yet. (Dropping a breakpoint before Engine.start() and
waiting at least 30 seconds is enough to reliably repro, but I have seen
this both live and in tests.)

This fixes it so that Router.page() is valid immediately, returning a
value of Page.LoadingScreen. It also removes the isInitialized field,
since this is now redundant. Trying to switch pages is still an error,
but that doesn't happen without user input, whereas checking the current
page is quite common.

This also consolidates a check for "should we show toasts" behind a
function in Router, making the logic central and equal for a few
usecases. This means (for instance) that the "autosave is disabled"
logic won't run during infiltration. (The toast should have already been
suppressed.)
2024-07-07 22:13:37 -07:00
catloversg b7a996718b UI: Tweak Hacknet summary (#1466) 2024-07-07 14:33:49 -07:00
Tom Prince b277975656 EDITOR: Provide type definitions for React and ReactDOM in in-game editor. (#1458)
* Fix the type declaration of `!!raw-loader!` modules.

Instead of declaring them to export an object with a single key
`default` which is a string, the modules have a default export, which
is a string.

Note, that this doesn't actually change the generated code, just the
types that typescript sees. The code worked before because the only
thing done to the values was to coerce the values to a string, which
turned into a no-op.

* Switch from using `raw-loader` to using a source asset module.

`raw-loader` was deprecated in webpack v5.
2024-07-07 00:08:33 -07:00
catloversg f18d28fc6e DOCUMENTATION: Add link to NS API documentation (#1460) 2024-07-06 12:54:56 -07:00
catloversg 02f5c5b727 MISC: Update description of source files (#1461) 2024-07-05 14:17:06 -07:00
catloversg 031b8b9cbb UI: Remember last position of documentation pages (#1434) 2024-06-28 02:08:10 -07:00
Michael Ficocelli 49668f10b2 IPVGO: Fix displayed mult to match the actual bonus of SF 14.1 (#1419) 2024-06-24 20:31:09 -07:00
catloversg 4382f860db CCT: Clarify empty string solution in UI (#1400) 2024-06-15 16:37:14 -07:00
catloversg ceb58bc6b3 UI: Show BitNode multipliers in BN 5.1 (#1398) 2024-06-15 16:35:32 -07:00
G4mingJon4s bec6e82d7f EDITOR: changed editor tabs to have their own editor mode (#1372) 2024-06-12 19:19:40 -07:00
G4mingJon4s ab80ee66c8 EDITOR: re-added vim notifications and register view (#1382) 2024-06-12 01:24:10 -07:00
catloversg a0fc9cc713 UI: Automatically show Bitverse UI if BN is finished (#1358) 2024-06-08 13:54:44 -07:00
catloversg 30a6419b11 MISC: Use camel case for CSS properties (#1353) 2024-06-05 18:18:19 -07:00
Caldwell cb92643c7e IMPROVEMENT: partial migration @mui/styles to tss-react (#1338) 2024-06-03 12:27:13 -04:00
TheAimMan e622b9b904 UI: change time elapsed to time remaining for programs and grafting (#1328) 2024-06-02 20:51:21 -07:00
catloversg 53f187fb89 MISC: Fix wrong text in Tutorial and NetscriptDefinitions.d.ts (#1319) 2024-05-27 15:30:32 -07:00
catloversg 7bb36ec111 MISC: Refactor InvitationModal and AlertManager (#1287) 2024-05-22 21:43:31 -04:00
gmcew 7113ee5425 UI: Hacknet terminology consistency (#1256)
* UI labels/Augment effects reworded to remove the "Node" parts
* No changes to API-facing labels/savedata/functions
2024-05-17 04:44:09 -07:00
catloversg 9dc3b22919 BUGFIX: Tail window position does not update when being dragged (#1275) 2024-05-13 00:27:21 -07:00
catloversg 8ebfcdb089 MISC: Fix bugs in useRerender hook and ns.moveTail (#1263) 2024-05-10 18:55:45 -07:00
catloversg 35c32e2871 BUGFIX: Fix unresolved promise in ns.prompt API (#1257) 2024-05-10 01:55:50 -07:00
catloversg 2414949c2c MISC: Update formatHashes function (#1252)
When hash/hashRate value is too small, formatHashes converts it to the useless string 0.000. This PR fixes that.
2024-05-10 01:38:38 -07:00
catloversg 309cd55085 UI: Change buttons in Tutorial (#1251) 2024-05-10 01:34:45 -07:00
catloversg 8289b23cff UI: Wrap long text in Active Scripts UI (#1247) 2024-05-09 17:07:41 -07:00
catloversg aef362204d MISC: Handle error when getting save data (#1241) 2024-05-09 02:19:30 -07:00
catloversg 6a1691fe54 CORPORATION: Update tooltip of storage space (#1237)
The tooltip of the storage space only shows sizes of materials/products. This is confusing for newbies. They use "Unit" (number of material/product units) when buying materials, but that tooltip only shows sizes without any description.
2024-05-08 16:29:03 -07:00
catloversg de8883ed0f BUGFIX: Fix #998 (#1233)
CorruptableText wasn't updating state properly
2024-04-27 02:10:17 -07:00
catloversg 7b993f3550 MISC: Remove file-saver (#1217)
Also refactor to dedup our own download code
2024-04-19 13:38:44 -07:00
Snarling 6669c4da6a BLADEBURNER: Typesafety / refactoring (#1154) 2024-03-28 21:52:37 -04:00
catloversg 8553bcb8fc MISC: Support compression of save data (#1162)
* Use Compression Streams API instead of jszip or other libraries.
* Remove usage of base64 in the new binary format.
* Do not convert binary data to string and back. The type of save data is SaveData, it's either string (old base64 format) or Uint8Array (new binary format).
* Proper support for interacting with electron-related code. Electron-related code assumes that save data is in the base64 format.
* Proper support for other tools (DevMenu, pretty-save.js). Full support for DevMenu will be added in a follow-up PR. Check the comments in src\DevMenu\ui\SaveFileDev.tsx for details.
2024-03-27 21:08:09 -07:00