diff --git a/server/index.js b/server/index.js index 8eab83f..9248f81 100644 --- a/server/index.js +++ b/server/index.js @@ -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');