fix: don't send whole state in packets
This commit is contained in:
parent
9f2e2960c4
commit
c1ddc04703
|
@ -98,7 +98,10 @@ export class Alive extends decorate(Trait) {
|
|||
const packets = [];
|
||||
const {isDying, life, maxLife} = this.stateDifferences();
|
||||
if (life || maxLife) {
|
||||
packets.push(new TraitUpdateAlivePacket(this.state));
|
||||
packets.push(new TraitUpdateAlivePacket({
|
||||
life: this.state.life,
|
||||
maxLife: this.state.maxLife,
|
||||
}));
|
||||
}
|
||||
if (isDying) {
|
||||
packets.push(new DiedPacket());
|
||||
|
|
|
@ -96,7 +96,10 @@ export class Visible extends decorate(Trait) {
|
|||
packets(informed) {
|
||||
const {isVisible, opacity} = this.stateDifferences();
|
||||
if (isVisible || opacity) {
|
||||
return new TraitUpdateVisiblePacket(this.state);
|
||||
return new TraitUpdateVisiblePacket({
|
||||
isVisible: this.state.isVisible,
|
||||
opacity: this.state.opacity,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user