From 16279ab1f6a493460956fde0555bb408235490c6 Mon Sep 17 00:00:00 2001 From: Peter Date: Sun, 30 Jul 2023 13:04:16 +0200 Subject: [PATCH] fix: stop creature health bounce when dash opened --- src/ui/interface.js | 1 + src/utility/hexgrid.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/ui/interface.js b/src/ui/interface.js index fe3c8343f..ca139bc68 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -1468,6 +1468,7 @@ export class UI { return; } + game.signals.ui.dispatch('onOpenDash'); if (randomize && !this.lastViewedCreature) { // Optional: select a random creature from the grid this.showRandomCreature(); diff --git a/src/utility/hexgrid.ts b/src/utility/hexgrid.ts index 5a091d976..1f90c1a3e 100644 --- a/src/utility/hexgrid.ts +++ b/src/utility/hexgrid.ts @@ -185,6 +185,7 @@ export class HexGrid { // Events this.game.signals.metaPowers.add(this.handleMetaPowerEvent, this); + this.game.signals.ui.add(this.handleUIEvent, this); } get traps() { @@ -204,6 +205,21 @@ export class HexGrid { } } + handleUIEvent(message, payload) { + if (message === 'onOpenDash') { + // NOTE: This is a rather hacky bugfix. + // If a "query" is going on, and the dash is opened, + // creatures can remain in a "hovered" state. + // This hack undoes the "hovered" state. + this.forEachHex((hex) => { + const creature = hex.creature; + if (creature instanceof Creature) { + creature.resetBounce(); + } + }); + } + } + querySelf(o) { const game = this.game; const defaultOpt = {