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