add chat
This commit is contained in:
parent
27520842e3
commit
2d177c6b27
16 changed files with 228 additions and 31 deletions
|
@ -34,13 +34,16 @@ class Connection {
|
|||
}
|
||||
|
||||
chat(data) {
|
||||
console.log(this.room);
|
||||
if(this.chatCooldown > 5 || !this.room) return;
|
||||
//if(this.chatCooldown > 5 || !this.room) return;
|
||||
if(!data.msg) return;
|
||||
|
||||
wingbase.log(`${this.room}/${this.player.name}: ${data.msg}`);
|
||||
|
||||
this.chatCooldown++;
|
||||
this.io.to(this.room).emit('chat', {
|
||||
name: this.player.name,
|
||||
msg: data.msg.slice(0, 100)
|
||||
type: 'player',
|
||||
source: this.player.name,
|
||||
message: data.msg.slice(0, 100)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class World {
|
|||
}
|
||||
|
||||
populate() {
|
||||
for (var i = 0; i < 40; i++) {
|
||||
for (var i = 0; i < 5; i++) {
|
||||
let pos = {
|
||||
x: Math.random() * 2000 - 200,
|
||||
y: Math.random() * 500 - 250
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue