This commit is contained in:
Asraelite 2016-03-27 23:46:18 +01:00
parent 27520842e3
commit 2d177c6b27
16 changed files with 228 additions and 31 deletions

View file

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

View file

@ -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

View file

@ -28,7 +28,12 @@ class WebServer {
});
app.get('/', (req, res) => {
res.render('index', {});
try {
res.render('index', {});
} catch(err) {
wingbase.error('Renderng error:' + err);
res.render('error/500', { error: err });
}
});
app.use(express.static('public/static'));

View file

@ -26,12 +26,13 @@ function minifyJs(callback) {
}
scripts.sort((a, b) => getPriority(b) - getPriority(a));
scripts = scripts.map(s => s.replace(/(\/\/@\d+\n)/, ''));
let comment = '';
cache = scripts.join('');
// Remove to re-enable minifying.
//Remove to re-enable minifying.
callback(cache); return;
try {