Skip to content

Commit

Permalink
fix(client): i should probably sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Veradictus committed Sep 24, 2023
1 parent 4ca8a3c commit 445e4f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/client/src/network/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,12 @@ export default class Connection {
attacker.setTarget(target);

// Ensure the attacker and the target are not on the same tile and just move them.
if (attacker.isMob() && attacker.gridX === target.gridX && attacker.gridY === target.gridY)
if (
(attacker.isMob() &&
attacker.gridX === target.gridX &&
attacker.gridY === target.gridY) ||
(attacker.getDistance(target!) > 2 && attacker.attackRange > 1)
)
this.game.findAdjacentTile(attacker);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/renderer/webgl/webgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default class WebGL extends Renderer {

private draw(x = this.camera.x, y = this.camera.y): void {
// Used for low power mode
if (this.hasRenderedFrame() && this.game.isLowPowerMode() && this.mobile) return;
if (this.hasRenderedFrame() && (this.game.isLowPowerMode() || this.mobile)) return;

// Iterate through the drawing contexts and apply the necessary transformations/attributes.
this.forEachDrawingContext((context: WebGLRenderingContext) => {
Expand Down

0 comments on commit 445e4f7

Please sign in to comment.