Commit Graph

81 Commits

Author SHA1 Message Date
David Walker b51ed8fd59 BUG: Fix missed cases in offline server handling (#2495)
There were two large holes in the existing offline server handling:

1. It didn't include IPs, so scripts that used IPs instead of hostnames
   would get exceptions thrown for "server not found."
2. Coverage was very low for non-Darknet APIs. Maybe most of them don't
   need to be covered, but many obvious ones like "ps", "killall" and
   "hasRootAccess" were missing. IMO the only reliable answer is one
   that enforces *all* are covered via the type system.

To accomplish the second part, helpers.getServer() was changed to return
null when a server is offline. This intentionally breaks a lot of its
utility, which was to return a server unconditionally. To compensate,
its utility was increased - it now also does unknown argument
processing, allowing it to subsume a common line that all callers were
repeating.

Some callers switched to ctx.workerScript.getServer(), because they
didn't actually need to be using helpers.getServer(). Similarly, a few
callsites switched to GetServerOrThrow(), for the cases where it should
be guaranteed that the server is valid. The rest are returning a
default/failure response when the server is offline. (Except for
contracts, which threw on failure already anyway.)
2026-02-15 10:29:47 -08:00
Michael Ficocelli 26db9f2955 DNET: More fixes and feedback (#2489)
* Add some re-rendering improvements to avoid the canvas and visual servers getting desynched

* removed underlevelled nerf to low-level servers; improved charisma level docs

* Remove offscreen dynamic culling

* PR feedback; add cache file names to tooltip

* Ensure stasis link servers get loaded properly; ensure darkweb has neighbors to prevent unit tests from failing; remove extra optional chaining accessors
2026-02-13 17:23:24 -08:00
catloversg 95b739f703 BUGFIX: Darknet state is not reset properly on prestige (#2486) 2026-02-10 09:39:31 -08:00
Michael Ficocelli bab6280735 DNET: Add JS object properties as server names; refactor save/load/server storage to support this (#2482) 2026-02-10 00:13:47 -08:00
David Walker b5da311133 REFACTOR: Consolidate checks under getFailureResult() (#2476)
There was duplicated code, and more importantly, were were handling
certain things subtly differently in exec() and scp() as a result. This
notably causes a behavior change in exec() and scp() where failure to
authenticate now returns failure instead of throwing, which I believe is
the proper response.

This also makes it easier to see in the code exactly which functions
require what (auth, session, etc.)
2026-02-08 08:39:42 -08:00
Michael Ficocelli 0eae02adcf DARKNET: Improve documentation; remove requirement that getBlockedRam and getDepth be called on a darknet server (#2472) 2026-02-05 07:28:06 -08:00
catloversg 796bef81b3 BUGFIX: Sleeves can earn exp and purchase augmentations when enabling disableSleeveExpAndAugmentation (#2467) 2026-02-05 04:47:24 -08:00
Michael Ficocelli 6073964768 DARKNET: Darkweb Expansion Project & Bitnode (#2139)
This is BN15. It is a really big change; see the PR for all the details.
2026-02-03 03:40:36 -08:00
catloversg 5a2bdfc9f1 CODEBASE: Update NodeJS to v24 (#2456) 2026-01-28 22:10:55 -08:00
TheAimMan 210c338f86 SLEEVES: Add sleeve commands to purchase sleeves and memory via the API (#2443) 2026-01-20 12:55:51 -08:00
gmcew 7c0286222c API: Move and rename purchased server functions to cloud API (#2367)
* Convert purchased server functions to cloud API

- Create `ns.cloud`
- Change `bitnode multipliers` and `server constants` wording for consistency
- change `server`, `ram` and `getting started` docs for consistency
- Added changes to 3.0.0 API Break and `setRemovedFunctions` in NetscriptFunctions.js

Tested by
- running tutorial `purchase-server-8gb.js`, and a more typical player one
- buying manually using vendor (Alpha Ent in Sector 12)
- deleting them all using script, and checked all deleted functions gave correct error
- Imported completed save to ensure auto-transfer of function work

* Revision in line with comments

- changed more `purchased` to `cloud` references
- Added BN mults auto-conversion

* Update getting_started.md

 - Corrected function names for new `cloud API`

* Don't show `cloud API` warning

v3.0.0 API break auto-replaces `cloud` functions, not warning suggested.

* API Break correction

- `cloud` affected API break replacement changed to be more descriptive and functional

* Fix typo and add empty lines

* Update many things (check commit's description)

- Comments
- Terminal message
- UI Text
- TSDoc
- md docs
- Improve error messages in src\NetscriptFunctions\Cloud.ts
2025-11-07 12:10:33 -08:00
catloversg 6837f334fd CODEBASE: Remove redundant check in getServer utility function and serverExists API (#2357) 2025-10-19 11:45:30 -07:00
catloversg d421d4fcf9 MISC: Make TIX access independent from WSE account (#2342) 2025-10-11 17:28:45 -07:00
Michael Taylor 370424af2d JEST: Quiet Jest tests output on expected failures (#2332) 2025-10-05 12:31:15 -07:00
catloversg 020b185377 JEST: Enable restoreMocks option and fix lint errors (#2333)
* JEST: Enable restoreMocks option and fix lint errors

* Fix test\jest\Save.test.ts
2025-10-04 14:38:50 -07:00
catloversg 8aa73b2c65 MISC: Detect circular dependencies when generating modules (#2194) 2025-06-21 13:32:47 -07:00
Michael Ficocelli 18f84396e2 FEATURE: Add "Recent Errors" tab and improved error modal (#2169) 2025-06-16 16:43:21 -07:00
catloversg a9900072da MISC: Remove support for running NS1 scripts (#2083) 2025-04-11 13:41:48 -07:00
catloversg 7f443427ea CODEBASE: Suppress false-positive console errors caused by RamCalculation.test.ts (#2002) 2025-03-07 15:15:54 -08:00
catloversg 23ad55554e UI: Add "Run" action to run current script in editor (#1987) 2025-03-04 02:43:31 -08:00
catloversg de6b202341 CODEBASE: Refactor Player.applyForJob (#1947) 2025-02-02 09:29:18 -08:00
catloversg a4217b448a MISC: Standardize behavior of connect CLI and Singularity API (#1933) 2025-01-31 11:20:17 -08:00
catloversg ada903f356 CODEBASE: Refactor ns.singularity.purchaseAugmentation (#1879) 2025-01-28 10:42:25 -08:00
catloversg 0f9144a059 CODEBASE: Validate theme, editor theme, and styles (#1789) 2025-01-08 19:20:05 -08:00
catloversg 1e6c9d69e2 JEST: Move TerminalMatching.test.ts (#1801) 2024-11-27 01:23:51 -08:00
catloversg bb0b857f71 JEST: Add tests for b1tflum3 and destroyW0r1dD43m0n API (#1802) 2024-11-27 00:06:11 -08:00
Denis Čahuk cde5e3f6ae MISC: Refactor BLADEBURNER Identifier Lookup (#1646) 2024-09-14 17:39:18 -07:00
Marvin Sautter dd59612121 JEST: Decrease frequency of random Bladeburner Tests by ~59% for improved performance (#1648) 2024-09-09 18:33:37 -07:00
Yichi Zhang 028e779602 NETSCRIPT: Don't make dynamicLoadedFns entries for free functions. (#1617) 2024-08-23 21:23:41 -07:00
catloversg 818d7446be MISC: Rename getRandomArbitrary (#1605) 2024-08-21 16:50:51 -07:00
catloversg cacecda72f API: Add types for parameters of gym-university-bladeburner API (Fix merging error) (#1596)
* API: Add types for parameters of gym-university-bladeburner API
* Fix merging error
2024-08-17 14:08:55 -07:00
David Walker 34db6e8b26 NETSCRIPT: Rework disableLog for efficiency (#1589)
The current implementation was naive; disableLog("ALL") was storing a
key for every function, and iterating over a different object to do it
(when iterating over objects is quite slow).

The common cases of Bitburner (and especially batching, where efficiency
matters most) are either never disabling anything, or disabling "ALL".
This optimizes for these two cases, at the expense of slightly more
complicated code to deal with the less-common edge cases.
2024-08-16 19:10:20 -07:00
catloversg 289f60d8c8 BLADEBURNER: Add API to calculate max upgrade count of skill (#1475) 2024-08-16 13:15:20 -07:00
catloversg 864613c616 MISC: Support JSX, TS, TSX script files (#1216) 2024-07-14 14:47:10 -07:00
David Walker 1f2e69631e EDITOR: Use ramOverride() to set compiled script RAM (#1446)
To use this, add a line like "ns.ramOverride(2);" as the first statement
in main(). Not only will it take effect at runtime, but it will now
*also* be parsed at compile time, changing the script's static RAM
limit. Since ns.ramOverride is a 0-cost function, the call to it on
startup then becomes a no-op.

This is an often-requested feature, and allows for scripts to set their
usage without it needing to be explicitly mentioned via args or options
when being launched. This also reduces pressure on the static RAM
analysis to be perfect all the time. (But certain limits, such as
"functions names must be unique across namespaces," remain.)

This also adds a tooltip to the RAM calculation, to make this slightly
discoverable.
2024-07-05 17:32:46 -07:00
Caldwell f40d4f8e92 BUGFIX: fix relative imports (#1305)
Relative paths work in imports, at last.
2024-06-02 17:38:01 -07:00
Shy 4aaf845fca API: make ns.atExit add the callback to an array instead of setting it (#1059) 2024-03-05 19:22:45 -05:00
Snarling 91105c6d8c TESTS: Prevent some test spam (#1126) 2024-02-26 08:22:33 -05:00
Caldwell 269a74d5c0 CODEBASE: update dependencies (#852) 2023-10-07 18:52:48 -04:00
Jesse Clark ad6f919d64 CORPORATION: Dramatically lower API RAM costs (#818) 2023-09-27 17:38:30 -04:00
Snarling 4ca598defb API: Fix removed functions (#720) 2023-08-07 02:38:38 -04:00
Snarling 2ae3ac52f1 CORPORATION: Corp changes prior to 2.3 finalization (#503) 2023-05-15 18:06:57 -04:00
David Walker 8b7166e4ed UI: Fix (most) perf issues in Active Scripts (#498) 2023-04-30 19:31:29 -04:00
David Walker aa7facd4ba NETSCRIPT: Greatly speed up script launching, and remove the limitation unique args per script (#440)
* Remove the limitation unique args per script
* Internal changes to how runningScripts are stored on the server, to make common usage faster.
2023-04-27 18:21:06 -04:00
Snarling e0272ad4af FILES: Path rework & typesafety (#479)
* Added new types for various file paths, all in the Paths folder.
* TypeSafety and other helper functions related to these types
* Added basic globbing support with * and ?. Currently only implemented for Script/Text, on nano and download terminal commands
* Enforcing the new types throughout the codebase, plus whatever rewrites happened along the way
* Server.textFiles is now a map
* TextFile no longer uses a fn property, now it is filename
* Added a shared ContentFile interface for shared functionality between TextFile and Script.
* related to ContentFile change above, the player is now allowed to move a text file to a script file and vice versa.
* File paths no longer conditionally start with slashes, and all directory names other than root have ending slashes. The player is still able to provide paths starting with / but this now indicates that the player is specifying an absolute path instead of one relative to root.
* Singularized the MessageFilename and LiteratureName enums
* Because they now only accept correct types, server.writeToXFile functions now always succeed (the only reasons they could fail before were invalid filepath).
* Fix several issues with tab completion, which included pretty much a complete rewrite
* Changed the autocomplete display options so there's less chance it clips outside the display area.
* Turned CompletedProgramName into an enum.
* Got rid of programsMetadata, and programs and DarkWebItems are now initialized immediately instead of relying on initializers called from the engine.
* For any executable (program, cct, or script file) pathing can be used directly to execute without using the run command (previously the command had to start with ./ and it wasn't actually using pathing).
2023-04-24 10:26:57 -04:00
Snarling 0df984eea0 CODEBASE: Add Jsonable Map and Set types, move player.sourceFiles to a map (#473) 2023-04-18 03:19:45 -04:00
David Walker ed9e6d5ea3 NETSCRIPT: Compiled modules will be even more shared (#468) 2023-04-07 21:08:39 -04:00
David Walker 8c4b992d59 TEST: Add a NS2 test (finally) (#458) 2023-04-01 07:45:23 -04:00
Snarling 759f86d6e5 NETSCRIPT: Rework script ram updates (#408) 2023-03-05 22:39:42 -05:00
David Walker 4eef9eec03 NETSCRIPT: More ns Proxy changes (#297) 2023-01-05 20:41:24 -05:00