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 packets = [];
|
||||||
const {isDying, life, maxLife} = this.stateDifferences();
|
const {isDying, life, maxLife} = this.stateDifferences();
|
||||||
if (life || maxLife) {
|
if (life || maxLife) {
|
||||||
packets.push(new TraitUpdateAlivePacket(this.state));
|
packets.push(new TraitUpdateAlivePacket({
|
||||||
|
life: this.state.life,
|
||||||
|
maxLife: this.state.maxLife,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
if (isDying) {
|
if (isDying) {
|
||||||
packets.push(new DiedPacket());
|
packets.push(new DiedPacket());
|
||||||
|
|
|
@ -96,7 +96,10 @@ export class Visible extends decorate(Trait) {
|
||||||
packets(informed) {
|
packets(informed) {
|
||||||
const {isVisible, opacity} = this.stateDifferences();
|
const {isVisible, opacity} = this.stateDifferences();
|
||||||
if (isVisible || opacity) {
|
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