chore: logs
This commit is contained in:
parent
5656659aa2
commit
143052805e
|
@ -16,6 +16,7 @@ import createPlayerRoom from '../gen/player-room';
|
||||||
import Player from './player';
|
import Player from './player';
|
||||||
|
|
||||||
const debug = D('@humus/universe/server/universe');
|
const debug = D('@humus/universe/server/universe');
|
||||||
|
const debugSilly = debug.extend('silly');
|
||||||
|
|
||||||
const pglob = promisify(glob);
|
const pglob = promisify(glob);
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ export default class Universe {
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlayer({entity, socket}) {
|
addPlayer({entity, socket}) {
|
||||||
debug('adding player %j', entity);
|
debug('adding player from user ID %s', socket.req.user.id);
|
||||||
const player = new Player({
|
const player = new Player({
|
||||||
entity,
|
entity,
|
||||||
socket,
|
socket,
|
||||||
|
@ -56,7 +57,6 @@ export default class Universe {
|
||||||
}
|
}
|
||||||
if (newRoom) {
|
if (newRoom) {
|
||||||
const room = this.room(newRoom);
|
const room = this.room(newRoom);
|
||||||
debug('new room', newRoom);
|
|
||||||
room.addEntity(entity);
|
room.addEntity(entity);
|
||||||
entity.startInforming(room);
|
entity.startInforming(room);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ export default class Universe {
|
||||||
}
|
}
|
||||||
|
|
||||||
addRoom(uri, room) {
|
addRoom(uri, room) {
|
||||||
debug('adding room %s', uri);
|
debugSilly('adding room %s', uri);
|
||||||
this.$$rooms[uri] = room;
|
this.$$rooms[uri] = room;
|
||||||
this.$$roomsFlat.push(room);
|
this.$$roomsFlat.push(room);
|
||||||
}
|
}
|
||||||
|
@ -146,13 +146,13 @@ export default class Universe {
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadOrCreateEntity(user) {
|
async loadOrCreateEntity(user) {
|
||||||
debug('loadOrCreateEntity from user id %d', user.id);
|
debugSilly('loadOrCreateEntity from user id %d', user.id);
|
||||||
const playerPath = join(this.$$root, 'players', `${user.id}`);
|
const playerPath = join(this.$$root, 'players', `${user.id}`);
|
||||||
const {Entity} = this.$$flecks.get('$avocado/resource.resources');
|
const {Entity} = this.$$flecks.get('$avocado/resource.resources');
|
||||||
try {
|
try {
|
||||||
await stat(join(playerPath, 'index.entity.json'));
|
await stat(join(playerPath, 'index.entity.json'));
|
||||||
const json = JSON.parse((await readFile(join(playerPath, 'index.entity.json'))).toString());
|
const json = JSON.parse((await readFile(join(playerPath, 'index.entity.json'))).toString());
|
||||||
debug('loaded %j', json);
|
debugSilly('loaded %j', json);
|
||||||
return Entity.load(json);
|
return Entity.load(json);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user