- spawning and setting up child processes is now handled by
ProcessManager#constructor rather than needing to be done manually for
each module that uses ProcessManager
- direct references to ProcessManager in ProcessWrapper were removed to
prevent dead ProcessWrapper instances from being leaked when hotpatching
- process-manager.js and verifier.js now use Typescript
This is a surprisingly minor refactor considering how many files it
touches, but most of this is only renames.
In terms of file renames:
- `tools.js` is now `sim/dex.js`
- `battle-engine.js` is now `sim/index.js` and its three classes are
in `sim/battle.js`, `sim/side.js`, and `sim/pokemon.js`
- `prng.js` is now `sim/prng.js`
In terms of variable renames:
- `Tools` is now `Dex`
- `BattleEngine` is now `Sim`
- `BattleEngine.Battle` is now `Sim.Battle`
- `BattleEngine.BattleSide` is now `Sim.Side`
- `BattleEngine.BattlePokemon` is now `Sim.Pokemon`
Currently TypeScript is validating tools.js and is not particularly
strict about anything and we use 'any' a lot and it's not part of
'npm test' yet, but everything has to start somewhere!
tools.js has also been refactored majorly to use accessors rather
than loader functions. This basically means you don't need to do
Tools.includeData() or anything like that anymore. The new system is
also easier to make TypeScript-compatible.
See #3278
Across PS, in most places we use <br /> - however, in some other places we used <br> and in some <br/>. This standardizes that to simply be <br />, since that's what we use in the majority of places.
It now accepts a generation parameter, as well as "pentagon", as
options before the pokemon species.
In addition to making it easier to remember the syntax and supporting
pentagon checks, this also allows /learnall to be used in past gens.
e.g.
`/learn pentagon, mence, dd`
will show:
> In Gen 7, Salamence can learn Dragon Dance only when obtained from:
> gen 7 egg: axew, dragonair, dragonite, dratini, ...
`/learn gen3, mence, dd`
will show:
> In Gen 3, Salamence can learn Dragon Dance only when obtained from:
> gen 3 egg: altaria, charmander, dragonair, dragonite, ...
> gen 3 event: 1 salamence
Tools will be renamed to Dex soon, which is why the code inside Tools
is calling itself "Dex" now, but right now we're just refactoring its
internal code and not officially renaming it yet.
In the meantime, Tools is now an ES6 Class.
A long-standing bug in learnset loading order (the one
test/chat-plugins/datasearch.js tests for) has finally been fixed, so
Tools.includeMods() is no longer necessary to accurately access modded
data.
Tools.mod has been split into Tools.mod(modid) and
Tools.format(format). The issue of Tools.mod being ambiguous about
whether it's passed a mod or a format hasn't been a _bug_ for a while,
but this is still more readable.
Other renames include:
Tools#isLoaded -> Tools#dataLoaded
Tools.includeMods() -> Tools.includeModData()
Tools.preloadMods() -> Tools.includeMods()
Tools.preloadedMods -> Tools.modsLoaded
Tools.moddedTools -> Tools.dexes
Do not just rename your calls of Tools.includeMods() to
Tools.includeModData(). With the learnset loading bug fixed, there's
no reason to use it unless you need direct access to
Tools.dexes[...].data for some reason (you don't, just use
Tools.mod(...).data)
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
The following functions have been renamed:
- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
(notice the lowercase 's')
This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
These changes were supposed to be in de524c1a26 but got lost in my
Git stash...
Once again, this is very experimental code; please don't base any
serious changes on it.