From f2dba0a801232a23f11a45f6044f2df06c6840ff Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 21 Mar 2019 00:36:06 -0500 Subject: [PATCH] refactor: no nasty params --- packages/entity/list.js | 7 ++----- packages/entity/traits/listed.js | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/entity/list.js b/packages/entity/list.js index 6852053..286e57d 100644 --- a/packages/entity/list.js +++ b/packages/entity/list.js @@ -57,11 +57,8 @@ class EntityListBase { const uuid = entity.instanceUuid; this.entities_PRIVATE[uuid] = entity; this.state_PRIVATE = this.state_PRIVATE.set(uuid, entity.state()); - entity.addTrait('listed', { - params: { - list: this, - }, - }); + entity.addTrait('listed'); + entity.list = this; const onEntityPositionChanged = () => { this.quadTree_PRIVATE.remove(this.quadTreePoint(entity)); this.quadTree_PRIVATE.add(this.recomputeQuadTreePoint(entity)); diff --git a/packages/entity/traits/listed.js b/packages/entity/traits/listed.js index 7269b97..0446b28 100644 --- a/packages/entity/traits/listed.js +++ b/packages/entity/traits/listed.js @@ -6,8 +6,6 @@ import {Rectangle, Vector} from '@avocado/math'; export class Listed extends Trait { initialize() { - this._list = this.params.get('list'); - this.params = this.params.delete('list'); this.lastNearby = I.Set(); } @@ -15,6 +13,10 @@ export class Listed extends Trait { return this._list; } + set list(list) { + this._list = list; + } + methods() { return {