refactor: better interface

This commit is contained in:
cha0s 2019-03-21 01:14:24 -05:00
parent 4da1b827d5
commit fd24ca6c7c

View File

@ -29,12 +29,8 @@ export class Listed extends Trait {
methods() {
return {
nearbyEntities: (size) => {
const location = this._listLocator ?
this._listLocator()
:
this.entity.position;
const position = Vector.add(location, Vector.scale(size, -0.5));
nearbyEntities: (size, position = this.entity.position) => {
position = Vector.add(position, Vector.scale(size, -0.5));
return this._list.within(Rectangle.compose(position, size));
},