* MISC: Refactor coding contracts for type safety
This refactor does three things without any behavior changes:
* Adds type safety by introducing generic type parameters to the coding
contract definitions, so they can use concrete types instead of
"unknown". This also eliminates a bunch of boilerplate casts.
* Removes the unneeded CodingContractType class. We can use the metadata
type directly.
* Introduces a new hidden state to coding contracts. Instead of
generating and storing the data (which is what is shown to the user as
the problem's input), the state is stored instead. This allows
problems to (for instance) generate the answer up-front, and check the
solution directly against the answer, instead of needing to embed a
solver in the problem (which can then easily be ripped from the source
code).
For compatibility, state == data by default. I plan to make use of this
feature in a followup, but it is unused currently.
This changes the way percantage-based population estimates work, so that
they have a similar mechanism to grow(). This allows natural recovery
from 0, and also falling to 0 in finite steps.
This also changes the formula for reducing estimates to est / (1 + p)
instead of est * (1 - p). The latter becomes overpowered at large p,
we've seen this formula issue elsewhere (such as BN modifiers).
* 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>
Commit d82247a4 was a lazy update, this finishes putting all the entries
in the changelog. The "last updated" date is not changed, since it is
only including changes up to the old date.
Reverts the html-ification introduced in the last changelog update.
Fixed ns.singularity.donateToFaction bug
Fixed a bug within singularity.donateToFaction where you could use it to donate to Shadows Of Anarchy
Also updated the Node version in package-lock.json to 18
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.
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.
There are a bunch of React components that update at the same rate
that the game engine processes cycles. Rather than have each place
that does so start its own timer to update that often, add a new
react hook that triggers an update shortly after the engine completes
a cycle.
* EDITOR: Tweak typescript language server configuration to match use.
- We allow importing files with `.ts`/`.tsx` extensions.
- We use an file-at-a-time transpiler, so we don't support features
that require understanding the full type system.
- We use the classic `React.createElement` transform.
Our IndexDB handling did not have very good error handling. It wasn't
reporting the actual errors that occured, nor was it using actual Error
objects. In some cases it also had overly convoluted Promise use, and it
didn't need to be .tsx either.
The biggest issue was that if any problem occured during the main
load(), this would end up as an unhandled rejection and so it would only
be logged to the console. This extends the previous catch to also cover
this, so that the recovery screen is activated.