Commit Graph

22 Commits

Author SHA1 Message Date
Alexander B
0475b38ae8
RoomGame: Refactor to use generic typing (#8678) 2022-03-13 18:01:54 -07:00
Guangcong Luo
da30a71706 Revert "Remove User#inRooms and User#games (#7815)"
This reverts commit 5c9c84c415.

This also reverts commit 1fc92ef977.
2021-01-30 15:55:55 -05:00
Guangcong Luo
1fc92ef977 Fix bugs in inRooms/games refactor 2021-01-28 20:35:30 -05:00
Mia
5c9c84c415
Remove User#inRooms and User#games (#7815) 2021-01-28 10:41:35 -08:00
Annika
e6a61e52aa
Fix renaming battle rooms (#7399) 2020-11-06 15:14:08 -08:00
Guangcong Luo
46c470671a
Unify /guess (#7387) 2020-09-19 01:24:52 -07:00
Annika
62a2eda1a1
RoomGame: Support room.subGame (#7380) 2020-09-19 00:40:24 -07:00
Guangcong Luo
328ba42a12 Change onChatMessage API to use void return
onChatMessage previously took `string | false`, where `false` means
"let the message through". This is a reversal of what `false` usually
means, so this is now updated to `string | void`, which should be
much clearer.
2020-07-29 15:01:04 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
Guangcong Luo
ddb9a5d11e Improve code documentation 2020-05-26 21:29:34 -04:00
Mia
1628258371
Typescript chat-commands/core (#6484)
Also fix TS line numbers in GitHub Actions
2020-03-23 23:50:35 -07:00
Waleed Hassan
34e215c7a6
Support renaming rooms (#6295) 2020-02-21 00:47:07 -08:00
Waleed Hassan
27563f6380 RoomGame: Uncomment optional functions (#5992)
TypeScript will now recognizes these functions existence so
we don't have to supress the compiler whenever they come up.
2019-11-18 16:43:40 +13:00
Waleed Hassan
28e870c4fb Server: Use readonly where appropriate (#5902) 2019-10-21 16:12:32 +10:30
Waleed Hassan
da4b887054 Rename Room#id -> Room#roomid, User#userid -> User#id (#5826)
These should make it clearer that userids are IDs but roomids aren't.
2019-10-03 18:57:38 +10:00
TheJetOU
f2783c642d Add a RoomID type (#5759) 2019-09-07 14:15:27 -05:00
Guangcong Luo
7e58790121 Fix bugs when logging out during a RoomGame 2019-08-31 10:50:00 -05:00
Guangcong Luo
e0a2cf07e1 Correctly define global types for .ts files
Global types are defined differently for `.ts` files than for `.js`
files, leading to some confusion for past refactors.

This commit defines them correctly.

I'm also considering making certain global types only available under
namespaces, but I don't want to do that to `User` or `Room`, so for
now, there are no changes there, besides putting streams in the
`Streams` namespace (so `WriteStream` is now `Streams.WriteStream`).
2019-08-23 09:33:49 -07:00
TheJetOU
5597916644 TypeScript Rooms and Roomlogs (#5699) 2019-08-14 20:44:57 +02:00
TheJetOU
3c3d897b92 Move JSDoc comments from assignment to declaration (#5701)
This makes IntelliSense show the JSDoc comment.
2019-08-13 17:25:29 +02:00
TheJetOU
4b0be1b5b4 TypeScript RoomGame and RoomBattle (#5692) 2019-08-11 17:03:36 +02:00