- Method `this.runBroadcast()` has been split from `this.canBroadcast()`.
It's now the only method handling command-usage and intended as the main API
for synchronous commands. Async commands will execute both separately.
Note that the `suppressMessage` parameter is now passed to `runBroadcast`.
- The semantics of `broadcasting` have been similarly split.
`this,broadcastMessage` will be set to a truthy value when `this.canBroadcast` is run.
`this,broadcasting` will only be set to `true` once `this.runBroadcast` is executed.
The callback code in TeamValidator and the functions that use it have
been refactored to use Promises.
Pretty much all signatures have been changed, for instance:
TeamValidator.validateTeamSync(format, team)
-> TeamValidator(format).validateTeam(team)
TeamValidator.validateTeam(format, team, callback)
-> TeamValidator(format).prepTeam(team) // returns a Promise
Validators are no longer cached since they're really lightweight. They
contain a format and a Tools instance, and Tools instances are already
cached in Tools anyway. This saves a tiny bit of RAM in exchange for a
tiny bit of CPU time, but more importantly makes the code more
readable.
I'm introducing a new pattern/API for managing the parts of code with
child processes - their process managers are now at .PM and are now
opt-in, so you can use them synchronously without needing to spawn
any processes.
Fixes#2448
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.
This refactor:
- uses arrow functions where appropriate
Note that arrow functions still aren't used in Mocha, where `this`
is sometimes meaningful.
This also removes the need for .bind() nearly everywhere, as well
as the `self = this` trick.
- refactors Validator and Connection into ES6 classes
- no longer uses Array#forEach for iterating arrays
We strongly prefer for (let i = 0; i < arr.length; i++) because of
performance reasons. Most forEaches have been replaced with for..of,
though, which is 5x slower than the long-form loop but 2x faster
than forEach, which is good enough outside of most inner loops.
The only exception is tournaments, which is due for a more invasive
refactor soon anyway.
Joim's previous code apparently already did, but this implementation
does it correctly with the set-intersect system.
As an added bonus of correctly using the set-intersect system, it now
shows up properly in /gsclearn
`Tools.includeMods()` is unfortunately still massively broken and
unable to be loaded on-demand. This commit restores the old Tools
behavior of loading it at the beginning, which is horrible for
startup time but is the only way of fixing incorrect /learn
results in past gens.
The previous displayed message for 'sourcesBefore' in gen 1-2 was
also wrong.
This was, as far as I can tell, a mistaken interpretation of what
'sourcesBefore' means; possibly due to a past bug in its
implementation.
!statcalc gardevoir, spe 252+ scarf
Base 80 at level 100 with 31 IVs, 252+ EVs at +1: 427. (should be 246)
!statcalc gardevoir 252+ spe
Base 80 at level 100 with 31 IVs, 252+ EVs: 284.
/statcalc 252+ speed heatran
/statcalc 252+ev speed heatran.
The 2nd always worked, but the 1st should too. Now it does.
(Also fixed a typo in the command description.)
Most images are hosted in places that already support HTTPS, so all
we need to do is transparently rewrite them to be protocol-local.
For the rest, I don't care enough to enforce HTTPS on them. At
least wait for browsers to complain more about it...
Specifically, Users.users, Users.connections, and Users.pastUsers
are now ES6 Maps. In theory, this should be a minor performance
upgrade, but we still need to profile to make sure.
This command was causing infinite loops that caused PS to die several times.
It was adding new elements on an array that was being looped at the moment for some reason.
The command seems to work better now, even though the functionality may be faulty, but it's prefered to causing an infinite loop.
We may need to revisit this command and change it for one that doesn't tries to use natural language.