wxyz-abcd / node-haxball

The most powerful and lightweight API that allows you to develop your original Haxball(www.haxball.com) host, client, and standalone applications both on node.js and browser environments and also includes every possible hack and functionality that you can imagine.
MIT License
34 stars 13 forks source link

Error in playerObject #39

Closed guguxh closed 1 year ago

guguxh commented 1 year ago

Sometimes when a player join the room who you're not the host, a error occur in playerObjectCreated event. This cause a loop and create more than one playerObject for one player.

wxyz-abcd commented 1 year ago

It's not a bug, but a feature. This callback will run for each player object just once. If you just joined the room, there are more than one player inside. It runs once for each one of them. Note that onPlayerJoin does not work like this, that's why I created this callback so that we can now define custom variables inside all player objects by just writing it here once. Of course it's not as simple as that, but you get the idea.