refactor: rename
This commit is contained in:
parent
0c17da218f
commit
15df8e1d43
|
@ -67,7 +67,7 @@ export class EntityList extends decorate(class {}) {
|
||||||
if (AVOCADO_SERVER) {
|
if (AVOCADO_SERVER) {
|
||||||
this._informedEntities.set(entity, []);
|
this._informedEntities.set(entity, []);
|
||||||
}
|
}
|
||||||
entity.setIntoList(this);
|
entity.attachToList(this);
|
||||||
entity.once('destroy', () => {
|
entity.once('destroy', () => {
|
||||||
this.removeEntity(entity);
|
this.removeEntity(entity);
|
||||||
// In the process of destroying, allow entities to specify tickers that
|
// In the process of destroying, allow entities to specify tickers that
|
||||||
|
@ -167,7 +167,7 @@ export class EntityList extends decorate(class {}) {
|
||||||
if (AVOCADO_SERVER) {
|
if (AVOCADO_SERVER) {
|
||||||
this._informedEntities.delete(entity);
|
this._informedEntities.delete(entity);
|
||||||
}
|
}
|
||||||
entity.removeFromList();
|
entity.detachFromList();
|
||||||
delete this._entities[uuid];
|
delete this._entities[uuid];
|
||||||
this._flatEntities.splice(this._flatEntities.indexOf(entity), 1);
|
this._flatEntities.splice(this._flatEntities.indexOf(entity), 1);
|
||||||
this._entityTickers.splice(this._entityTickers.indexOf(entity.tick), 1);
|
this._entityTickers.splice(this._entityTickers.indexOf(entity.tick), 1);
|
||||||
|
|
|
@ -16,7 +16,7 @@ export class Listed extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.entity.removeFromList();
|
this.entity.detachFromList();
|
||||||
}
|
}
|
||||||
|
|
||||||
addQuadTreeNodes() {
|
addQuadTreeNodes() {
|
||||||
|
@ -92,7 +92,7 @@ export class Listed extends Trait {
|
||||||
methods() {
|
methods() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
removeFromList: () => {
|
detachFromList: () => {
|
||||||
const list = this.entity.list;
|
const list = this.entity.list;
|
||||||
if (!list) {
|
if (!list) {
|
||||||
return;
|
return;
|
||||||
|
@ -102,7 +102,7 @@ export class Listed extends Trait {
|
||||||
this.entity.emit('removedFromList', list);
|
this.entity.emit('removedFromList', list);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIntoList: (list) => {
|
attachToList: (list) => {
|
||||||
this.entity.list = list;
|
this.entity.list = list;
|
||||||
this.addQuadTreeNodes();
|
this.addQuadTreeNodes();
|
||||||
this.entity.emit('addedToList');
|
this.entity.emit('addedToList');
|
||||||
|
|
|
@ -107,12 +107,12 @@ export class Room extends decorate(Resource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
onEntityAddedToRoom(entity) {
|
onEntityAddedToRoom(entity) {
|
||||||
entity.setIntoRoom(this);
|
entity.attachToRoom(this);
|
||||||
this.emit('entityAdded', entity)
|
this.emit('entityAdded', entity)
|
||||||
}
|
}
|
||||||
|
|
||||||
onEntityRemovedFromRoom(entity) {
|
onEntityRemovedFromRoom(entity) {
|
||||||
entity.removeFromRoom();
|
entity.detachFromRoom();
|
||||||
this.emit('entityRemoved', entity);
|
this.emit('entityRemoved', entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ export class Roomed extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.entity.removeFromRoom();
|
this.entity.detachFromRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
methods() {
|
methods() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
removeFromRoom: () => {
|
detachFromRoom: () => {
|
||||||
const room = this.entity.room;
|
const room = this.entity.room;
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return;
|
return;
|
||||||
|
@ -22,7 +22,7 @@ export class Roomed extends Trait {
|
||||||
this.entity.emit('removedFromRoom', room);
|
this.entity.emit('removedFromRoom', room);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIntoRoom: (room) => {
|
attachToRoom: (room) => {
|
||||||
this.entity.room = room;
|
this.entity.room = room;
|
||||||
this.entity.emit('addedToRoom');
|
this.entity.emit('addedToRoom');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user