Commit Graph

46 Commits

Author SHA1 Message Date
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
Tom Prince 854c1a5921 MISC: Remove unsed attribues of internal ScriptDeath. (#1513) 2024-07-23 17:50:51 -07:00
David Walker 384d1c1a2b NETSCRIPT: A minorly breaking change around script launch, and refactoring. (#1213) 2024-04-23 20:21:05 -04: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 6732549196 ENUMS: Initial Enum Helper rework + Reorganization (#596) 2023-06-12 00:34:20 -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 2b54c6c9b9 NETSCRIPT: Add ramOverride as a RunOption (#441)
Allows overriding the static ram calculation. Dynamic ram limit still applies.
2023-03-22 10:09:12 -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
David Walker 7b5080a42b NETSCRIPT: Add undocumented function printRaw() (#277)
This is analagous to tprintRaw (enabled by ns.iKnowWhatImDoing()), but
for logs instead of the terminal. This provides a supported* method of
creating complicated UIs for scripts.

*No actual support, expressed or implied, is provided for use of this
function.
2023-01-05 20:30:34 -05:00
Snarling fb1f95c26e VARIOUS: Various changes prior to release 2.2 (#271)
See PR #271 description
2022-12-29 20:28:53 -05:00
omuretsu 1dec0d00bd Add documentation for ns.pid 2022-12-13 09:09:12 -05:00
Snarling b275f88053 NETSCRIPT: Expose more enums for player use (#198)
* Add support for enums at other ns layers
* APIWrapper: simplified wrapping algorithm and modified to just use cloneDeep to copy enums instead of recursively wrapping enums as if they were new API layers
* Improve APIWrapper typing
* Changed some typings at RamCostGenerator to allow for enums at different levels without enums needing a ram cost
* Added enums to ns.corporation, removed getter functions that were being used instead.
* Add FactionWorkType for player use
* Add ClassType and CompanyWorkPos enums
* Change netscriptDefinitions to expect members of these new enums where appropriate.
2022-11-09 13:46:21 -05:00
Snarling aa80cf6451 See description
Reverted ToastVariant back to an enum internally. Still exposed to player as just possible strings.
Changed all 1-line documentation comments to actually be 1-line. Moved some because they were not providing documentation for the thing they were trying to.
2022-10-04 06:40:10 -04:00
Snarling 50f14b4f58 Commit1 2022-10-03 12:12:16 -04:00
Snarling ef1f376c09 format, lint, remove unused "running" property on ws 2022-08-27 22:32:48 -04:00
Olivier Gagnon ceb9fa1249 fix more any 2022-07-20 01:13:06 -04:00
Olivier Gagnon 4bee746576 rm any 2022-07-15 01:51:30 -04:00
Olivier Gagnon 216055b3e0 allbuild commit b60f3da8 2022-05-25 18:38:01 -04:00
Olivier Gagnon c1650e332b lint fixes 2022-05-25 15:08:48 -04:00
Olivier Gagnon ce61f06319 allbuild commit 8159dad5 2022-05-24 16:57:25 -04:00
Olivier Gagnon fb08139903 Implemented infinite loop safety net. 2022-05-07 17:43:45 -04:00
Heikki Aitakangas 1ed1f78222 Fixed a wrong comment 2022-04-02 23:27:06 +03:00
phyzical 9949cc9a1e removed ip references 2022-03-17 21:50:23 +08:00
Heikki Aitakangas 59da79a427 Refactor netscriptDelay and script kill interaction
Store the Promise reject function instead of resolve in WorkerScript, since
it's only used when killing a script that's blocked in delay. And when killing
a script, reject the delay Promise with the WorkerScript as cause.
2022-01-09 02:36:54 +02:00
Olivier Gagnon c05518e162 workerscript log takes a function now, hopefully this will increase performance. 2021-11-26 18:30:58 -05:00
Olivier Gagnon c1d4ced331 autocomplete 2021-10-15 13:12:18 -04:00
Olivier Gagnon 3fddb3c9f2 added atExit 2021-10-14 20:13:26 -04:00
Olivier Gagnon 7d0536a4d2 finish convert to hostname 2021-10-07 17:55:49 -04:00
Olivier Gagnon a7dfb1a537 more convertion from ip to hostname 2021-10-07 16:56:01 -04:00
Olivier Gagnon be29481689 unexport AllServers 2021-10-07 16:04:04 -04:00
Olivier Gagnon dc2bf871cf all typescript 2021-09-24 21:49:49 -04:00
Olivier Gagnon ad75fa5ebc convert to ts 2021-09-24 18:13:20 -04:00
Olivier Gagnon 2a13db39c7 fix sleeve memory bug 2021-09-08 23:47:34 -04:00
Olivier Gagnon a18bdd6afc prettify, sorry for the big ass commit 2021-09-04 19:09:30 -04:00
Cass fe25460997 Replace "ALL" log flag with individually disabling every log.
https://github.com/danielyxie/bitburner/issues/1116
2021-08-31 21:03:39 +01:00
Olivier Gagnon d745150c45 all the lints 2021-05-01 03:17:31 -04:00
Olivier Gagnon 3fad505096 run auto fix lint 2021-04-29 23:52:56 -04:00
Olivier Gagnon 2ce6ff2041 work to make documentation unified. 2021-03-12 02:51:56 -05:00
Olivier Gagnon cd972dabe3 crash now prints ns stack trace, workerscript now does the shouldLog check on its own, many ns function are way simpler. 2021-03-11 03:02:05 -05:00
danielyxie 821725cf4d Initial commit for converting workerScripts pool to Map data structure 2019-06-24 22:48:54 -07:00
danielyxie 42804b0cd3 Refactored 'workerScripts' array and killWorkerScript() fn to be their own modules in TypeScript 2019-05-15 23:05:36 -07:00
danielyxie 9dd68947f1 Added Dynamic RAM calculation unit tests 2019-05-10 02:24:50 -07:00
danielyxie 8a5b6f6cbc Refactored stock buying/selling code into its own file. Refactored WorkerScript & NetscriptEnvironment into their own Typescript classes. Refactored a ton of code to remove circular dependencies 2019-05-04 21:03:40 -07:00