playerJoined event broken in TeamVs lobbies
Reproducible as follows:
Insert the following line right before the playerJoined listener in the multiplayer rotation example:
lobby.setSettings(Banchojs.BanchoLobbyTeamModes.TeamVs, Banchojs.BanchoLobbyWinConditions.Score);
For the exact code that I ran, see this paste: https://pastebin.com/qx9PXZci
Result: Upon joining the room, the "playerJoined" callback is never run, so I am not made the host. Leaving the room results in an error. Full log:
cor@c ~/Desktop/bancho_test $ node test.js
We're online!
Lobby created! Name: Multiplayer rotator ggz5i, password: wvelg
Multiplayer link: https://osu.ppy.sh/mp/43248956
(node:26389) UnhandledPromiseRejectionWarning: TypeError: Cannot add property undefined, object is not extensible
at getPlayerByName.then (/home/cor/Desktop/bancho_test/node_modules/bancho.js/lib/Multiplayer/BanchoLobby.js:213:47)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26389) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26389) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^CClosing lobby and disconnecting...
However, we can change the above line to:
lobby.setSettings(Banchojs.BanchoLobbyTeamModes.HeadToHead, Banchojs.BanchoLobbyWinConditions.Score);
Everything then works as expected, with no issues.
Run on Linux Mint 18.3, node version v10.4.0