chore: logs

This commit is contained in:
cha0s 2022-04-05 15:01:47 -05:00
parent 5656659aa2
commit 143052805e

View File

@ -16,6 +16,7 @@ import createPlayerRoom from '../gen/player-room';
import Player from './player';
const debug = D('@humus/universe/server/universe');
const debugSilly = debug.extend('silly');
const pglob = promisify(glob);
@ -43,7 +44,7 @@ export default class Universe {
}
addPlayer({entity, socket}) {
debug('adding player %j', entity);
debug('adding player from user ID %s', socket.req.user.id);
const player = new Player({
entity,
socket,
@ -56,7 +57,6 @@ export default class Universe {
}
if (newRoom) {
const room = this.room(newRoom);
debug('new room', newRoom);
room.addEntity(entity);
entity.startInforming(room);
}
@ -72,7 +72,7 @@ export default class Universe {
}
addRoom(uri, room) {
debug('adding room %s', uri);
debugSilly('adding room %s', uri);
this.$$rooms[uri] = room;
this.$$roomsFlat.push(room);
}
@ -146,13 +146,13 @@ export default class Universe {
}
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 {Entity} = this.$$flecks.get('$avocado/resource.resources');
try {
await stat(join(playerPath, 'index.entity.json'));
const json = JSON.parse((await readFile(join(playerPath, 'index.entity.json'))).toString());
debug('loaded %j', json);
debugSilly('loaded %j', json);
return Entity.load(json);
}
catch (error) {