The name of "player_string" made me think this is just a string
representation of a player's name. But instead, this variable is
holding the JSON representation of the data block of a
"player-register" event. So a name of "player_data" is much more
clear.
/* The syntax here is using an anonymous function to create a new
object from new_player with just the subset of fields that we
want. */
- const player_string = JSON.stringify((({id, name}) => ({id, name}))(new_player));
- this.broadcast_event("player-join", player_string);
+ const player_data = JSON.stringify((({id, name}) => ({id, name}))(new_player));
+ this.broadcast_event("player-join", player_data);
}
remove_player(id) {