fix: don't double-add entities

This commit is contained in:
cha0s 2019-06-05 20:16:51 -05:00
parent 3197525f03
commit 38a907d9bb

View File

@ -44,6 +44,10 @@ export class EntityList extends decorate(class {}) {
addEntity(entity) { addEntity(entity) {
const uuid = entity.instanceUuid; const uuid = entity.instanceUuid;
// Already exists?
if (this._entities[uuid]) {
return;
}
this._entities[uuid] = entity; this._entities[uuid] = entity;
this._flatEntities.push(entity); this._flatEntities.push(entity);
this._entityTickers.push(entity.tick); this._entityTickers.push(entity.tick);