| @@ -139,6 +139,7 @@ class Player extends Entity { | |||
| this.canShoot = true; | |||
| this.health = 100; | |||
| this.sendSetQueue = []; | |||
| this.name = ""; | |||
| sock.on("request", (req) => { | |||
| if (req.url == "get_id") { | |||
| @@ -146,6 +147,8 @@ class Player extends Entity { | |||
| id: this.id | |||
| }); | |||
| this.name = req.data.name; | |||
| setTimeout(() => { | |||
| game.entities.forEach((e) => e.send(true)); | |||
| }, 100); | |||
| @@ -281,8 +284,10 @@ class Player extends Entity { | |||
| health: this.health | |||
| } | |||
| if (first) | |||
| if (first) { | |||
| obj.type = "player"; | |||
| obj.name = this.name; | |||
| } | |||
| this.game.players.forEach((p) => p.sendSet(obj)); | |||
| } | |||