v0.51.3 - 2021-04-16 Y'all broke it on the first day (hydroflame)
-------

Passive faction reputation
* Reworked, from 1 rep / 2 minute. Now is a complicated percentage of the
  reputation you'd gain working for them. It's not op but it feels a bit
  more useful.

Netscript
* print/tprint now take any number of arguments.
* print/tprint will now print object as json.
* print/tprint now handle passing in an undefined argument properly.

Casino
* Cannot bet negative money anymore.
* Roulette max bet is a bit higher.
* Coin Flip has a small cooldown.
* All buttons reject unstrusted mouse events.

Documentation
* Changed a message that said nsjs only works on Chrome.

Bugfix
* hacknet.maxNumNodes now works for both nodes and servers.
* Fixed a bug where the popup boxes would contain data from previous popup boxes.
* .js files will also have the export async function boilerplate.

Misc.
* turned off autocomplete for the terminal text input.
* Fixed an issue on Windows+Firefox where pressing up on the terminal would
  bring the cursor to the begining of the line. (Issue #836)
* Hacknet node names is easier to handle for screen readers.
* Money spent on classes is now tracked independently of work money.
* running coding contract from the terminal will display its name.
This commit is contained in:
hydroflame
2021-04-18 11:18:56 -04:00
committed by GitHub
parent 80b703639e
commit 4e5ebcfe6f
23 changed files with 557 additions and 397 deletions

View File

@@ -686,13 +686,29 @@ function NetscriptFunctions(workerScript) {
});
}
const argsToString = function(args) {
let out = '';
for(let arg of args) {
if(typeof arg === 'object') {
out += JSON.stringify(arg);
continue
}
out += `${arg}`;
}
return out;
}
return {
hacknet : {
numNodes : function() {
return Player.hacknetNodes.length;
},
maxNumNodes : function() {
return MaxNumberHacknetServers;
if (hasHacknetServers()) {
return HacknetServerConstants.MaxServers;
}
return Infinity;
},
purchaseNode : function() {
return purchaseHacknet();
@@ -944,18 +960,17 @@ function NetscriptFunctions(workerScript) {
return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);
});
},
print: function(args){
if (args === undefined) {
throw makeRuntimeErrorMsg("print", "Takes 1 argument.");
print: function(){
if (arguments.length === 0) {
throw makeRuntimeErrorMsg("print", "Takes at least 1 argument.");
}
workerScript.print(args.toString());
workerScript.print(argsToString(arguments));
},
tprint: function(args) {
if (args === undefined || args == null) {
throw makeRuntimeErrorMsg("tprint", "Takes 1 argument.");
tprint: function() {
if (arguments.length === 0) {
throw makeRuntimeErrorMsg("tprint", "Takes at least 1 argument.");
}
var x = args.toString();
post(`${workerScript.scriptRef.filename}: ${args.toString()}`);
post(`${workerScript.scriptRef.filename}: ${argsToString(arguments)}`);
},
clearLog: function() {
workerScript.scriptRef.clearLog();
@@ -4385,4 +4400,4 @@ function NetscriptFunctions(workerScript) {
} // End return
} // End NetscriptFunction()
export { NetscriptFunctions };
export { NetscriptFunctions };