refactor: trait packet helpers

This commit is contained in:
cha0s 2019-05-14 05:45:26 -05:00
parent 1334de9a1f
commit 798075b685

View File

@ -89,19 +89,7 @@ export class Alive extends decorate(Trait) {
}
packetsForUpdate() {
const packets = [];
if (
this.previousState.life !== this.state.life
|| this.previousState.maxLife !== this.state.maxLife
) {
packets.push(new TraitAlivePacket({
life: this.state.life,
maxLife: this.state.maxLife,
}, this.entity));
this.previousState.life = this.state.life;
this.previousState.maxLife = this.state.maxLife;
}
return packets;
return this.createTraitPacketUpdates(TraitAlivePacket);
}
listeners() {