Commit Graph

41 Commits

Author SHA1 Message Date
Michael Ficocelli 1b6b07faae DNET: Player feedback (#2545) 2026-03-19 21:07:43 -07:00
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
Adam Weeden 7af9dca6bc CONTRACTS: Display contract answers on completely failed contracts (#2440) 2026-01-08 13:21:52 -08:00
Paul Setzer 968c0c2a8c CONTRACTS: Generate test contracts on executing host by default. Add support for optional parameter to specify the server. (#2417) 2025-12-16 16:23:59 -08:00
gmcew 3fc65a2de4 CONTRACTS: Proposal for Contract Progression System (#2230) 2025-07-10 14:25:36 -07:00
catloversg 1eca42c75e API: Make ns.codingcontract.createDummyContract throw error if type is invalid (#2188) 2025-06-20 12:08:49 -07:00
catloversg 856ce9a5c9 BUGFIX: Coding contract UI does not handle error properly when answer format is invalid (#2171) 2025-06-02 02:33:57 -07:00
Naga 0aaa28054a NETSCRIPT: Add functionality and support to fully allow Players to use IP addresses in place of hostnames (#1990) 2025-04-10 18:41:37 -07:00
catloversg 97e9e13f12 BUGFIX: Player can manipulate internal state of coding contract (#2040) 2025-03-20 15:51:52 -07:00
G4mingJon4s b61e93b246 CODINGCONTRACT: Move internals to a separate folder (#1932) 2025-02-11 22:04:23 -08:00
G4mingJon4s ffae0045a4 CODINGCONTRACT: Add support for other answer formats (#1892) 2025-01-26 09:35:04 -08:00
Bart Kuijper 6a3d22d7bd CONTRACTS: createDummyContract returns filename (#1129) 2024-03-01 23:12:04 -05:00
Snarling 373ced2efe GO: Various changes before 2.6.0 (#1120) 2024-02-26 08:05:10 -05:00
LJ fd5b0f8241 MISC: Use structuredClone() for deep cloning (#1077) 2024-02-10 04:10:19 -05:00
LJ 011d5e8fd6 BUGFIX: Properly deep copy array data for coding contracts (#1064) 2024-01-31 19:43:04 -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
Snarling 837c6bd1c2 CONTRACT: codingcontract.attempt always returns a string (#231)
* ns.codingcontract always returns a string (reward on success, empty on fail), simplifying usage and documentation of function.
* Because of the above, return value still works when used as a boolean, as long as no direct equality comparison to true/false.
* Documentation expanded and examples added.
Co-authored by @quacksouls
2022-11-28 09:15:09 -05:00
omuretsu 7a384d53f4 typefix netscriptFunctions (see desc)
* Types for InternalFunction and ExternalFunction have been modified to actually typecheck ns functions against docs.
* Internal functions are required to use unknown for any params on the inner function.
* Return types for internal function inner-function must match the respective external function.
* Added new typecheck assertion function for asserting dynamic object types, to allow unknownifying params that were previously hardcoded objec structures.
* Because type assertion for parameter types and return types is enforced by InternalAPI, removed all duplicate type declarations on NetscriptFunction params and returns.
2022-10-12 08:49:27 -04:00
Olivier Gagnon f4668b21ca functions to generate dummy contracts 2022-10-09 02:56:11 -04:00
Snarling ef1f376c09 format, lint, remove unused "running" property on ws 2022-08-27 22:32:48 -04:00
Alain Bryden 359def2b61 Don't stringify answer if already a string 2022-08-24 11:09:35 -03:00
Olivier Gagnon 7cb48f4612 fix compile error 2022-08-23 12:04:09 -04:00
hydroflame 486ab7aad8 Merge branch 'dev' into contractFix 2022-08-23 12:44:21 -03:00
Snarling 931ea730a5 Move entire ns object to top-level 2022-08-09 18:09:26 -04:00
Snarling 01e63b10a1 move ctx.log to NetscriptHelpers 2022-08-09 18:09:26 -04:00
Snarling 208495e269 Initial commit 2022-08-09 18:09:24 -04:00
Snarling 47d51391e3 fix typechecking and documentation for attempt 2022-08-02 11:30:28 -04:00
Snarling b700b0246b Fix contract input handling 2022-08-02 11:11:49 -04:00
Olivier Gagnon 8312710b0d fix contracts 2022-07-20 11:50:26 -04:00
Olivier Gagnon c3a10d5d95 fix more anys 2022-07-19 18:25:06 -04:00
Olivier Gagnon 1b90b42881 rm more any 2022-07-18 02:28:21 -04:00
Olivier Gagnon c6806caca2 Wrap most of the API 2022-05-07 19:08:07 -04:00
phyzical 18af3f8413 moved updateRam to first call to avoid lack of mocks for tests
* added wrapper funcs to simplify updateRam
* added static parser tests and skiped what isnt worker still for next person to try and fix
2022-03-31 21:41:19 +08:00
Olivier Gagnon 4d9a8e7bba unknown-ify coding contract API. 2022-03-29 20:29:05 -04:00
Jeffrey A. Robinson 910c9d9e7e Correctly label functions so that disableLog will work 2022-01-12 16:55:45 -08:00
Olivier Gagnon c59a267437 change sf4 2022-01-04 19:09:34 -05: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 f035457efc build part pr 2021-11-20 15:01:04 -05:00
Olivier Gagnon 14150d3e33 work on making the netscript api tighter 2021-11-03 20:19:52 -04:00
Olivier Gagnon c5fb5155f3 work on making sure all the functions are accounted for 2021-11-03 18:16:10 -04:00
Olivier Gagnon d3fc6a9d48 split NetscriptFunctions 2021-10-14 03:22:02 -04:00