From e0755907348aaba88cfe29be0a3d15a0024cf9f7 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sat, 9 Apr 2022 16:37:23 +0300 Subject: [PATCH] revert this --- src/client/object/player-entity.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/client/object/player-entity.ts b/src/client/object/player-entity.ts index d6235e7..539fa80 100644 --- a/src/client/object/player-entity.ts +++ b/src/client/object/player-entity.ts @@ -8,7 +8,7 @@ import { ChatBubble } from './chat-bubble'; const chatBuilder = new CanvasUtils(); export class PlayerEntity extends PonyEntity { - private uncommittedPackets: Packet[] = []; + private uncommittedPacket: Packet = {}; private _chats: ChatBubble[] = []; constructor(public user: IcyNetUser) { @@ -85,7 +85,7 @@ export class PlayerEntity extends PonyEntity { } public addUncommittedChanges(packet: Packet) { - this.uncommittedPackets.push(packet); + this.uncommittedPacket = { ...this.uncommittedPacket, ...packet }; } public update(dt: number) { @@ -116,8 +116,7 @@ export class PlayerEntity extends PonyEntity { } private commitServerUpdate() { - if (this.uncommittedPackets.length) { - this.setFromPacket(this.uncommittedPackets.splice(0, 1)[0]); - } + this.setFromPacket(this.uncommittedPacket); + this.uncommittedPacket = {}; } }