From f163a8e0a8b1d8df4b2e800c003ec97c5dfec9e1 Mon Sep 17 00:00:00 2001 From: James Monger Date: Sun, 9 Jul 2023 22:24:29 +0100 Subject: [PATCH] fix: check for null animations as well as undefined fixes #398 --- src/engine/world/actor/player/sync/player-sync-task.ts | 4 ++-- src/engine/world/actor/update-flags.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/world/actor/player/sync/player-sync-task.ts b/src/engine/world/actor/player/sync/player-sync-task.ts index 920fceac5..8c5a6d452 100644 --- a/src/engine/world/actor/player/sync/player-sync-task.ts +++ b/src/engine/world/actor/player/sync/player-sync-task.ts @@ -125,7 +125,7 @@ export class PlayerSyncTask extends SyncTask { if(updateFlags.graphics) { mask |= 0x200; } - if(updateFlags.animation !== undefined) { + if(updateFlags.animation !== undefined && updateFlags.animation !== null) { mask |= 0x1; } @@ -151,7 +151,7 @@ export class PlayerSyncTask extends SyncTask { updateMaskData.put(position.y * 2 + 1, 'SHORT', 'LITTLE_ENDIAN'); } - if(updateFlags.animation !== undefined) { + if(updateFlags.animation !== undefined && updateFlags.animation !== null) { const animation = updateFlags.animation; if(animation === null || animation.id === -1) { diff --git a/src/engine/world/actor/update-flags.ts b/src/engine/world/actor/update-flags.ts index 4344c7308..59e6ffde6 100644 --- a/src/engine/world/actor/update-flags.ts +++ b/src/engine/world/actor/update-flags.ts @@ -95,7 +95,7 @@ export class UpdateFlags { public get updateBlockRequired(): boolean { return this._appearanceUpdateRequired || this._chatMessages.length !== 0 || this._facePosition !== null || - this._graphics !== null || this._animation !== undefined || this._faceActor !== undefined || this._damage !== null; + this._graphics !== null || (this._animation !== undefined && this._animation !== null) || (this._faceActor !== undefined && this._faceActor !== null) || this._damage !== null; } public get mapRegionUpdateRequired(): boolean {