The parent bestof game doesn't get serialized, but their subgames do,
which crashes PS when they get deserialized. Setting the correct flag
prevents that crash.
This minimizes side effects of import/require across the codebase,
and lets the caller be responsible of initializing child processeses,
as well as other async logic, such as restoring saved battles.
The same password is now used across all `/savereplay`s in a battle so
replay links now don't get broken just because someone saved the replay
after you.
I figured PR #11105 would have some unintended side effect, but this
one isn't bad at all. There's no longer an easy way to tell whether
requests are move requests or not, but it's easy enough to instead
track the current turn.
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.
- First, we no longer have separate eslint-no-types configs. Lint
performance shouldn't be enough of a problem to justify the
relevant maintenance complexity.
- Second, our base config should work out-of-the-box now. `npx eslint`
will work as expected, without any CLI flags. You should still use
`npm run lint` which adds the `--cached` flag for performance.
- Third, whatever updates I did fixed style linting, which apparently
has been bugged for quite some time, considering all the obvious
mixed-tabs-and-spaces issues I found in the upgrade.
Also here are some changes to our style rules. In particular:
- Curly brackets (for objects etc) now have spaces inside them. Sorry
for the huge change. ESLint doesn't support our old style, and most
projects use Prettier style, so we might as well match them in this way.
See https://github.com/eslint-stylistic/eslint-stylistic/issues/415
- String + number concatenation is no longer allowed. We now
consistently use template strings for this.
* Use value rules for timer
* lint
* fix rule overrides
* fix the "boolean" value rules
* add limits for number based rules
* Realized that you don't need boolean value rules
* oops
* fix checks for lower bounds
TypeScript 4.8+ supports Lowercase for lowercase strings, which isn't
exactly what ID is, but can be used to type IDs in object keys and data
entries that previously required string. I'm calling it IDEntry in places
where it should be an ID but TypeScript doesn't support that.
Very conveniently, no additional casts will be needed when using ID
where IDEntry is expected.
It's caught at least a few bugs, which is also why I'm PRing: I didn't
write the code for the bugs it found, and don't know if it's the right
way to fix them.
This ballooned into several other type refactors.
* Add a plugin for ladder seasons
* Force battles public during the last 3 days of every month
* Fix bug in generating season schedules
* Another oops
* Testing
* Fix up a few things
* Fix tests
* Ensure season generation functions properly
This took way too long. Yes, it's super complicated, I know. It ended up being a way more finicky problem than you'd expect.
* Increment seasons overall instead of by year
This reinstates the recently-reverted RoomGame refactor/cleanup, but
with the bugs (forfeiting BestOfGame, and autojoin) fixed.
This reinstates:
- 6bccd4f622 Fix crash in bestof when expiring battles
- 2a48cbd064 Cleanup more RoomGame implementations
The latter fixes these, in addition to refactoring:
- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
I don't mind if people bypass this, I'm just hoping this will get
people to read the documentation on how to change it if they do.
The same may be coming to `playerTable` but there's a lot more
that needs to be fixed if we do it that way.
This is mostly just refactoring, but the refactor caught a few bugs:
- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
The main important change is that when `room.destroy()` is called
on an unfinished battle, `room.parent?.game?.onBattleWin?.()` is
now called (it was previously only called for tours, not bestof).
The rest is just about moving the relevant code to more sensible
places.
This refactor removes `player.unlinkUser()` which was used for several
unrelated use cases.
These have been split apart into:
- at the end of a game, `game.setEnded()` now clears `user.games`,
while leaving `player.id` untouched
- when trying to change the user associated with the player, we now
consistently use the higher-level `game.updatePlayer()`
There's a good chance this fixes the lagspikes currently affecting PS.
This replaces some pretty jank code with much cleaner code.
Anything that would be more cleanly implemented by iterating the
players array is now done by iterating the players array.
Some instances of p1/p2 are lying around but we should slowly deprecate
them.