refactor: trait packet helpers
This commit is contained in:
parent
1334de9a1f
commit
798075b685
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user