Browse Source

names

master
mort 8 years ago
parent
commit
6df29100c5
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      js/game.js

+ 6
- 1
js/game.js View File

@@ -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));
}

Loading…
Cancel
Save