import {create as createEntity} from '@avocado/entity'; // Create an entity for a new connection. export function createEntityForConnection(socket) { let entity = createEntity(); entity = entity.fromJSON({ traits: { animated: { params: { animations: { idle: { offset: [0, -12], uri: '/idle.animation.json', }, moving: { offset: [0, -12], uri: '/moving.animation.json', }, } }, }, collider: {}, directional: { params: { directionCount: 4, }, }, existent: {}, followed: {}, graphical: {}, mobile: { state: { speed: 100, }, }, physical: {}, positioned: { state: { x: 100, y: 100, }, }, shaped: { params: { shape: { type: 'rectangle', position: [0, 0], size: [8, 8], }, }, }, }, }); entity.addTrait('controllable'); entity.addTrait('informed'); // Embed socket. entity.socket = socket; return entity; }