Skip to content

Commit

Permalink
fix: check for null animations as well as undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Jameskmonger committed Jul 9, 2023
1 parent 0196052 commit f163a8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/engine/world/actor/player/sync/player-sync-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class PlayerSyncTask extends SyncTask<void> {
if(updateFlags.graphics) {
mask |= 0x200;
}
if(updateFlags.animation !== undefined) {
if(updateFlags.animation !== undefined && updateFlags.animation !== null) {
mask |= 0x1;
}

Expand All @@ -151,7 +151,7 @@ export class PlayerSyncTask extends SyncTask<void> {
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/world/actor/update-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f163a8e

Please sign in to comment.