test
This commit is contained in:
parent
5c043fb224
commit
cfe6e80355
@ -8,7 +8,7 @@ import { ChatBubble } from './chat-bubble';
|
|||||||
const chatBuilder = new CanvasUtils();
|
const chatBuilder = new CanvasUtils();
|
||||||
|
|
||||||
export class PlayerEntity extends PonyEntity {
|
export class PlayerEntity extends PonyEntity {
|
||||||
private uncommittedPacket: Packet = {};
|
private uncommittedPackets: Packet[] = [];
|
||||||
private _chats: ChatBubble[] = [];
|
private _chats: ChatBubble[] = [];
|
||||||
|
|
||||||
constructor(public user: IcyNetUser) {
|
constructor(public user: IcyNetUser) {
|
||||||
@ -85,7 +85,7 @@ export class PlayerEntity extends PonyEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addUncommittedChanges(packet: Packet) {
|
public addUncommittedChanges(packet: Packet) {
|
||||||
this.uncommittedPacket = { ...this.uncommittedPacket, ...packet };
|
this.uncommittedPackets.push(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(dt: number) {
|
public update(dt: number) {
|
||||||
@ -116,7 +116,8 @@ export class PlayerEntity extends PonyEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private commitServerUpdate() {
|
private commitServerUpdate() {
|
||||||
this.setFromPacket(this.uncommittedPacket);
|
if (this.uncommittedPackets.length) {
|
||||||
this.uncommittedPacket = {};
|
this.setFromPacket(this.uncommittedPackets.splice(0, 1)[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user