Skip to content

Commit

Permalink
fix(server): combat crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Veradictus committed Sep 17, 2023
1 parent e9aad9b commit 7fdccfd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/server/src/game/entity/character/combat/combat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ export default class Combat {

private handleLoop(): void {
// No target or target is dead, stop combat.
if (!this.character.hasTarget() || this.character.target?.isDead()) return this.stop();
if (
!this.character.hasTarget() ||
this.character.target?.isDead() ||
this.character.teleporting
)
return this.stop();

// Prevent combat loop from persisting during PVP flag changes.
if (
Expand All @@ -124,9 +129,6 @@ export default class Combat {
)
return this.stop();

// Do not attack while teleporting.
if (this.character.teleporting) return;

this.loopCallback?.(this.lastAttack);

this.checkTargetPosition();
Expand Down

0 comments on commit 7fdccfd

Please sign in to comment.