Log IP addresses of connecting players

This commit is contained in:
Markus Scully 2023-06-05 14:37:59 +02:00
parent 20177fe547
commit 8f2c968403
2 changed files with 2 additions and 1 deletions

View file

@ -9,6 +9,7 @@ class Connection {
this.connections = net.connections; this.connections = net.connections;
this.io = net.io; this.io = net.io;
this.socket = socket; this.socket = socket;
this.ip = socket.request.connection.remoteAddress;
this.player = new Player(this); this.player = new Player(this);
this._room = false; this._room = false;

View file

@ -35,7 +35,7 @@ class Room {
this.setTeam(player, this.teamA.size > this.teamB.size ? 'b' : 'a'); this.setTeam(player, this.teamA.size > this.teamB.size ? 'b' : 'a');
this.world.addPlayer(player); this.world.addPlayer(player);
this.sendWorld(player); this.sendWorld(player);
wingbase.log(`${player.name} joined ${this.name}.`); wingbase.log(`[${player.connection.ip}] ${player.name} joined ${this.name}.`);
this.message('roomEnter', player.name, 'team' + player.team); this.message('roomEnter', player.name, 'team' + player.team);
} }