refactor: don't early out client/server

This commit is contained in:
cha0s 2019-06-05 21:19:16 -05:00
parent 63fdbab66a
commit e0cdf94df5
2 changed files with 18 additions and 21 deletions

View File

@ -62,18 +62,17 @@ export class Listed extends Trait {
}
resetQuadTreeNodes() {
if (AVOCADO_CLIENT) {
return;
if (AVOCADO_SERVER) {
const aabb = this.entity.visibleAabb;
if (
this.quadTreeAabb.length > 0
&& Rectangle.isInside(this.quadTreeAabb, aabb)
) {
return;
}
this.removeQuadTreeNodes();
this.addQuadTreeNodes();
}
const aabb = this.entity.visibleAabb;
if (
this.quadTreeAabb.length > 0
&& Rectangle.isInside(this.quadTreeAabb, aabb)
) {
return;
}
this.removeQuadTreeNodes();
this.addQuadTreeNodes();
}
listeners() {

View File

@ -86,21 +86,19 @@ export class Emitter extends decorate(Trait) {
return {
addEmitter: (key, emitter) => {
if (AVOCADO_SERVER) {
return;
if (AVOCADO_CLIENT) {
this.emitters[key] = emitter;
this.constructor.addEmitter(emitter);
}
this.emitters[key] = emitter;
this.constructor.addEmitter(emitter);
},
addEmitterRenderer: (key, renderer) => {
if (AVOCADO_SERVER) {
return;
if (AVOCADO_CLIENT) {
if (!this.emitters[key]) {
return;
}
this.emitters[key].addRenderer(renderer);
}
if (!this.emitters[key]) {
return;
}
this.emitters[key].addRenderer(renderer);
},
emitParticle: (key, ...args) => {