feat: server REPL
This commit is contained in:
parent
7d779e351b
commit
114832c795
|
@ -11,8 +11,26 @@ const socketServer = new SocketServer();
|
|||
let game;
|
||||
let httpServer;
|
||||
|
||||
|
||||
import repl from 'repl';
|
||||
import {Entity} from '@avocado/entity';
|
||||
import {flowerBarrelJSON} from './create-server-room';
|
||||
const instance = repl.start({
|
||||
prompt: 'humus> ',
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
instance.context.createBarrel = () => {
|
||||
return (new Entity()).fromJSON(flowerBarrelJSON([400, 400]));
|
||||
};
|
||||
instance.context.addEntityToRoom = (entity) => {
|
||||
game.room.addEntityToLayer(entity, 'everything');
|
||||
};
|
||||
|
||||
|
||||
function createGame() {
|
||||
game = new Game();
|
||||
instance.context.game = game;
|
||||
// Listen for connections.
|
||||
httpServer = http.createServer();
|
||||
httpServer.listen(8420, '0.0.0.0');
|
||||
|
|
Loading…
Reference in New Issue
Block a user