Skip to content

Commit

Permalink
Merge pull request FreezingMoon#2459 from andretchen0/bugfix-hex-bounce
Browse files Browse the repository at this point in the history
fix: stop creature health bounce when dash opened, closes FreezingMoon#2451
  • Loading branch information
DreadKnight authored Aug 2, 2023
2 parents ca62a93 + 16279ab commit 4d1abf9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions src/utility/hexgrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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 = {
Expand Down

0 comments on commit 4d1abf9

Please sign in to comment.