Commit Graph

428 Commits

Author SHA1 Message Date
Jon Hartnett
99aeecbd0e
BUGFIX: Fix ramOverride check (#1787)
ramOverride currently prevents you from actually using exactly all of a server's memory due to a bug in the ram check. Simply replace ">=" with ">" to allow the new ram to equal the max ram.

Test script:
```js
/** @param {NS} ns */
export async function main(ns) {
  ns.tprint(ns.ramOverride(8));
}
```
Expected output (on fresh save):
```js
8
```
Output before this commit:
```js
1.6
```
2024-11-20 12:47:55 -08:00
catloversg
75cf9c88b5
CODEBASE: Fix lint errors 3 (#1758)
This is a really big refactor because it actually *fixes* a lot of the lint errors instead of disabling them.
2024-11-14 08:18:57 -08:00
catloversg
72a63b15cb
API: Return active SF levels in getOwnedSourceFiles and ResetInfo.ownedSF (#1761)
* DOCUMENTATION: Clarify getOwnedSourceFiles when player overrides active levels of SFs
* Return Player.activeSourceFiles instead of Player.sourceFiles
* Get rid of zeroes in the map
2024-11-10 22:56:57 -08:00
catloversg
650cf51acb
DOCUMENTATION: Add more information for deprecated nFormat API (#1762) 2024-11-10 16:27:35 -08:00
catloversg
f6502dd490
CODEBASE: Fix lint errors 1 (#1732) 2024-11-03 22:35:14 -08:00
David Walker
424ae160ba
NETSCRIPT: Fix dynamicRamUsage returned by getRunningScript() (#1704)
Fixes #1700
2024-10-20 00:52:57 -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
catloversg
94eef8ecde
BUGFIX: Fix inconsistencies of error handling in promise-based API (#1377) 2024-08-17 14:23:08 -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
e5a63b4116
MISC: Fix typos in NetscriptDefinitions.d.ts (#1546) 2024-08-04 13:09:50 -07:00
catloversg
1b9676c68e
MISC: Clarify deprecation warning of ns.getTimeSinceLastAug() (#1535) 2024-08-04 00:01:34 -07:00
catloversg
783120c886
FEATURE: BitNode options (#1411) 2024-07-14 14:30:30 -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
catloversg
fd8eae5cf5
MISC: Cancel spawned scripts in Bitverse (#1429) 2024-06-24 22:20:08 -07:00
catloversg
70383d9085
MISC: Change error message when spawning on an invalid server (#1370) 2024-06-07 13:23:04 -07:00
Michael Ficocelli
ed59f325ef
IPVGO: Ensure full name of method is recorded in the possibleLogs list, to be matched later (#1207) 2024-04-09 18:24:57 -07:00
catloversg
fc8958af83
MISC: Remove jquery (#1167)
Changes wget, which was the only thing using it.
2024-03-20 14:20:29 -07:00
FoGsesipod
25ac8432fc
BUGFIX: spawn() log reads "seconds" instead of "milliseconds" (#1158) 2024-03-11 15:25:02 -07: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
4f4c6fe7e5
Move heart.break out of Extra.ts (#1133) 2024-03-04 18:36:14 -05:00
LJ
a5f5c81912
API: Add karma to ns.getPlayer() & document ns.heart.break() (#1131) 2024-03-04 09:35:54 -05:00
Snarling
373ced2efe
GO: Various changes before 2.6.0 (#1120) 2024-02-26 08:05:10 -05:00
LJ
1577467fe1
BUGFIX: Prevent renaming servers to hacknet. (#1112)
* Add hacknet check to renaming
* Handle manual server purchases
* Handle automated server purchases
* Remove unnecessary parenthesis

fixes #1111
2024-02-20 18:22:24 -08:00
LJ
27a8abbdec
PORTS: Support all serializable data. (#1089)
A significant portion of players who use ports are passing objects through them. Currently they are required to handle that themselves via JSON serialization. This PR adds better support for passing objects; which is more convenient, extensive, and optimized (probably, more on this one later).

This adds zero overhead to existing (or when passing any primitive types) port usage, and also isn't a breaking change. The questions to debate here are:

Should objects be supported in the first place?
If so, how exactly do we want to serialize objects?
Based on an extensive discussion in Discord, the overwhelming majority answered "yes" to question one. As for question two, that has been much more hotly contested.

Ultimately, `structuredClone` was used, despite less-than-stellar performance, because other options were worse either in safety, speed, error-handling, or multiple of the above.
2024-02-17 19:15:17 -08:00
Caldwell
8c8af38a3a
MISC: refactor weaken effect calculation (#1076)
so far we calculate the effect of weaken in three +1 places
ns.weaken
ns.weakenAnalyze
terminal weaken

and server.weaken where the bn mult is applied

i extracted the logic into a new netscript helper function getWeakenEffect
this gives us one place if we want to change the formula

a side effect i added the server.cpuCores to the terminal weaken to future proof it if the npc server core pr (#963) is merged
2024-02-16 17:18:16 -08:00
Caldwell
4d551915b3
MISC: move server constants into their own constant (#1075) 2024-02-10 04:13:42 -05:00
LJ
fd5b0f8241
MISC: Use structuredClone() for deep cloning (#1077) 2024-02-10 04:10:19 -05:00
LJ
157ff8ea88
PORTS: Add ns.nextPortWrite() as a safer option (#1036) 2024-01-15 06:10:39 -05:00
Shockwave
7017f3c2f8
API: Fix serverExists() return true for not revealed servers (#1013) 2024-01-07 11:40:07 -05:00
Michael Ficocelli
7ef12a0323
BITNODE: IPvGO territory control strategy game (#934) 2023-12-26 11:45:27 -05:00
David Walker
61ffed9b3a
BUGFIX: Fix additionalMsec overflow issue (#941) 2023-12-07 20:34:49 -05:00
TheAimMan
89fc22f28f
IMPROVEMENT: Apply core bonus for share and stanek (#913) 2023-12-07 20:10:21 -05:00
Caldwell
e992cb966a
CORPORATION: adding prevState and changed state display in the warehouse UI (#861) 2023-10-23 04:48:06 -04:00
alutman
1a052a7daf
API: Change singularity.applyToCompany() to use an enum for job field (#859) 2023-10-17 05:33:16 -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
Jesse Clark
b9d13063ac
Format time in ns.sleep and ns.asleep (#806) 2023-09-17 15:40:25 -04:00
Michael Ficocelli
9a0d688909
NETSCRIPT: Add more helpful error messages to getPurchasedServerCost (#757) 2023-08-28 15:03:16 -04:00
Zelow79
b7ad3395ae
API: Added CompanyName to NetscriptDefinitions (#731) 2023-08-16 17:31:41 -04:00
Snarling
4ca598defb
API: Fix removed functions (#720) 2023-08-07 02:38:38 -04:00
myCatsName
2e84512881
update helper message for killall (#709) 2023-08-05 20:26:37 -04:00
omuretsu
75579a2ff1 Add owned aug and SF info to getResetInfo 2023-08-01 01:40:30 -04:00
Snarling
006fbd528f
DOCS: Add printRaw and tprintRaw docs (#663) 2023-07-07 18:23:26 -04:00
Snarling
a4b826683e
TYPESAFETY: Strict internal typing for AugmentationName (#608) 2023-06-16 17:52:42 -04:00
Snarling
6732549196
ENUMS: Initial Enum Helper rework + Reorganization (#596) 2023-06-12 00:34:20 -04:00
Snarling
40b89baca1
MISC: Various small fixes (#574)
* ns.ls filter can include leading slash in filename
* scp from terminal accepts multiple filenames
* terminal displays root / instead of ~ as base
* cd with no args returns to root
2023-06-06 08:46:07 -04:00
omuretsu
72a631d4ed Another lint fix 2023-05-27 08:46:28 -04:00
omuretsu
8bf13b6fd3 fileExists no longer case sensitive for programs 2023-05-27 08:39:29 -04:00
David Walker
4503da6226
UI: LogBox overhaul (#508) 2023-05-26 08:07:37 -04:00