Commit Graph

396 Commits

Author SHA1 Message Date
Alain Bryden cd99006c4e NETSCRIPT: Update ScriptDeath to extend Error (#1685)
* Update ScriptDeath to extend Error

- Rename the "name" property to "hostname" so that it doesn't clash with inherited Error.name property.
- Extend Error, this way if a user ends up catching it they can:
  - Test the type of error caught (name) and ignore it if desired
  - Get a stack trace and find out where they went wrong
  - Not require special case error printing logic for catching things that are neither strings, nor Error objects.

It is possible (but unlikely) that this could make killing scripts slower in some circumstances.
2024-10-09 21:18:06 -07:00
catloversg 32e00aff7a BUGFIX: Wrong parameter requirement of ns.bladeburner.setTeamSize (#1673) 2024-09-30 20:18:25 -07:00
G4mingJon4s 651b17739c NETSCRIPT: Add ns.self() as a free info function (#1636)
* added utility info

* moved info to running script

* fix for RAM cost

* description changes

Co-authored-by: David Walker <d0sboots@gmail.com>

* fixed wrong formatting

* Added parent to ignored fields

---------

Co-authored-by: David Walker <d0sboots@gmail.com>
2024-09-07 17:34:24 -07:00
Nicole b4f2a5c641 set static information netscript costs to 0 (#1628) 2024-08-25 10:09:36 -07:00
Yichi Zhang 028e779602 NETSCRIPT: Don't make dynamicLoadedFns entries for free functions. (#1617) 2024-08-23 21:23:41 -07:00
catloversg be515cc195 BUGFIX: Crash in b1tflum3 and destroyW0r1dD43m0n API (#1619) 2024-08-23 21:06:53 -07:00
Nicole 7f5c4e1fe0 API: Reduced RAM cost for ns.getPurchasedServers (#1614) 2024-08-22 00:44:21 -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
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 a9cb46606c DOCUMENTATION: Update documentation of Corporation API (#1587) 2024-08-16 02:02:23 -07:00
Tom Prince 854c1a5921 MISC: Remove unsed attribues of internal ScriptDeath. (#1513) 2024-07-23 17:50:51 -07:00
catloversg 783120c886 FEATURE: BitNode options (#1411) 2024-07-14 14:30:30 -07:00
catloversg b1c1fc24a9 GRAFTING: Add new api for checking ongoing grafting (#1435) 2024-06-28 19:59:18 -07:00
David Walker 9c9a69f2e2 NETSCRIPT: Add ramOverride() function (#1346)
This adds a way to dynamically change the static RAM limit of a script,
which is also its current RAM usage. This makes it possible for scripts
to dynamically change their memory footprint, opening up new strategies
beyond current ram-dodging.

Calling functions still permanently increases the *dynamic* memory
limit; RAM-dodging is still the optimal strategy for avoiding RAM costs,
in that sense.

This also adds dynamicRamUsage to the info returned by
`getRunningScript`, to allow introspection on the currently needed ram.
2024-06-28 18:42:20 -07:00
David Walker 1c20a24079 MISC: Make spawn able to have 0 delay (#1333)
This eliminates a hole where spawn was unrelaible, because other scripts
could jump in and steal the RAM. It's not an API break, because 0 used
to be an invalid value.
2024-06-28 18:41:41 -07:00
David Walker 06d742a7f3 BUGFIX: Fix rounding issues due to ramOverride edge cases (#1339)
*All* RAM calculations must take place in units of hundredths-of-a-GB in
order for there not to be issues.

Also adds slightly more verbose logging when the dynamic RAM check
fails.
2024-06-28 17:58:17 -07:00
catloversg 5a8f0e99af SINGULARITY: Add ns.singularity.getFactionWorkTypes (#1425) 2024-06-24 20:43:36 -07:00
Michael Ficocelli cf48d666f5 IPVGO: Add history, and details to status, to go API (#1348) 2024-06-05 18:24:48 -07:00
Michael Ficocelli b53c35126e IPVGO: Provide API for getting game stats per opponent (#1255)
Give users access to wins, losses, stat bonuses, and favor gained
2024-05-10 01:57:03 -07:00
catloversg aef362204d MISC: Handle error when getting save data (#1241) 2024-05-09 02:19:30 -07:00
David Walker 384d1c1a2b NETSCRIPT: A minorly breaking change around script launch, and refactoring. (#1213) 2024-04-23 20:21:05 -04:00
catloversg 216500ed32 CORPORATION: Add a new API to sell a division (#1210)
Also refactoring around use of "player" variable (whether it is capitalized or not).
2024-04-15 21:19:47 -07:00
Paco Delozanne ae1ca8f9a6 NETSCRIPT: Add Singularity.getFactionEnemies() (#1192) 2024-03-29 01:16:54 -04:00
Snarling 6669c4da6a BLADEBURNER: Typesafety / refactoring (#1154) 2024-03-28 21:52:37 -04:00
David Walker 75dabd10be NETSCRIPT: add formulas.hacking.growAmount() (#1090)
Also, improve docs.
2024-03-26 03:26:50 -07:00
Michael Ficocelli d81358c80f IPVGO: Add support to netscript API for game state, current player, and alternate ways to check/wait on AI turn (#1142) 2024-03-19 14:07:15 -04:00
Snarling d61e12fdd1 API: Minor followup changes for #1059 (#1135) 2024-03-05 19:42:55 -05: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 373ced2efe GO: Various changes before 2.6.0 (#1120) 2024-02-26 08:05:10 -05:00
LJ f6871f0911 GANG: Clarify install behavior & add getInstallResult() (#1119)
New function returns post-install ascension ratios.

* Add ascension penalty to Gang constants
* Improve wording of Gang install message
* Add GangMember#getInstallResults()
* Update prestiging to use getInstallResults()
* Add ns.gang.getInstallResults(memberName)
* Update definitions
* Add ram cost for ns.gang.getInstallResult()
* Fix typo
* More specific wording in documentation
* Fix another typo
* Run prettier
* Rename getInstallResults to getPostInstallPoints
* Update Prestige.ts
* Update Gang.ts
2024-02-23 12:58:22 -08:00
Caldwell fccc27fe58 MISC: HGWOptions accepts non integer (#1035) 2024-02-10 07:24:11 -05:00
Caldwell 4d551915b3 MISC: move server constants into their own constant (#1075) 2024-02-10 04:13:42 -05:00
TheAimMan 330a32e1d0 MISC: Don't include temporary scripts into Recently Killed (#1045) 2024-01-31 19:43:48 -05:00
LJ 157ff8ea88 PORTS: Add ns.nextPortWrite() as a safer option (#1036) 2024-01-15 06:10:39 -05:00
Michael Ficocelli 7ef12a0323 BITNODE: IPvGO territory control strategy game (#934) 2023-12-26 11:45:27 -05:00
DJMatch3000 a6436ca4b3 MISC: Revert default HGW threads from 1 to number of script threads (#978) 2023-12-16 04:38:39 -05:00
Jesse Clark 473217ef31 API: Programming-friendly interface to getFactionInviteRequirements (#953) 2023-12-16 04:27:22 -05:00
David Walker 61ffed9b3a BUGFIX: Fix additionalMsec overflow issue (#941) 2023-12-07 20:34:49 -05:00
Snarling f93bbfbd5d UPDATE: 2.5.1 Release (#952) 2023-11-30 16:46:56 -05:00
Jesse Clark fdcb8306d9 FACTIONS: Add "Rumors" system for learning about faction join requirements (#888) 2023-11-02 10:20:24 -04:00
TheAimMan eed2c5d6d4 BUGFIX: Update NetscriptHelpers.tsx to verify servers are on network when getServer is called (#855) 2023-10-23 04:37:19 -04:00
Jesse Clark 61c311a126 API: Add nextUpdate() promise for systems with bonus time (#845) 2023-10-23 04:24:30 -04:00
missymae#2783 1007ce5e68 API: Add ns.bladeburner.getNextBlackOp() (#815) 2023-10-17 02:18:54 -04:00
Jesse Clark ad6f919d64 CORPORATION: Dramatically lower API RAM costs (#818) 2023-09-27 17:38:30 -04:00
muesli4brekkies c5e2f65cb0 API: Added spawnDelay parameter to ns.spawn options, allowing user defined delay (#807) 2023-09-27 01:31:47 -04:00
David Walker 875bddbbdb BUGFIX: Patch a minor hole in RAM calculation (#820) 2023-09-21 21:44:32 -04:00
Michael Ficocelli 25dae7ec8b UI: Basic Map and Set support in ns.print/tprint (#756) 2023-09-12 01:07:41 -04:00
missymae#2783 8d3f2bd750 GANG: Updates to Docs, UI, API (#773)
API Changes:
Adds ns.gang.getRecruitsAvailable: Gets the number of additional gang members that can currently be recruited
Adds ns.gang.respectForNextRecruit: Gets the respect threshold for recruiting the next gang member
Adds ns.gang.renameMember: Renames a gang member

Plus many doc and ui improvements
2023-09-05 18:07:19 -04:00
Snarling 4ca598defb API: Fix removed functions (#720) 2023-08-07 02:38:38 -04:00