Skip to content

Fix Godlet Printer double-click bug causing game freeze (v2)#2836

Draft
CyrilBird wants to merge 1 commit intoFreezingMoon:masterfrom
CyrilBird:fix/godlet-printer-2775-v2
Draft

Fix Godlet Printer double-click bug causing game freeze (v2)#2836
CyrilBird wants to merge 1 commit intoFreezingMoon:masterfrom
CyrilBird:fix/godlet-printer-2775-v2

Conversation

@CyrilBird
Copy link

Fixes #2775: Godlet Printer selected but inactive

Problem

When Dark Priest is active, double-clicking the Godlet Printer button or pressing the R hotkey during location picking caused the ability to get stuck, freezing the game until manually deselected.

Root Cause

When materializeInProgress flag was set to prevent re-entrancy, it was only cleared in fnOnCancel and fnOnConfirm callbacks. However, if the user cancelled the ability via:

  • Clicking the ability button again
  • Pressing the R hotkey
  • Pressing Esc

The selectAbility(-1) was called, which calls queryMove() to clean up the temp creature, but the materializeInProgress flag was never reset. This caused subsequent materialize attempts to be silently ignored.

Solution

  1. Added materializeInProgress flag in UI class to prevent re-entrancy
  2. Guard at the start of materialize() to return early if already in progress
  3. Key fix: Reset materializeInProgress in selectAbility(-1) to handle cancellation via ability button/hotkey
  4. Proper cleanup of temporary creature on both cancel and confirm paths

Changes

  • src/ui/interface.ts: Added materializeInProgress flag and reset it in selectAbility(-1)
  • src/abilities/Dark-Priest.ts: Added re-entrancy guard and temp creature cleanup

Difference from PR #2835

The previous PR (#2835) only reset materializeInProgress in fnOnCancel and fnOnConfirm, which didn't cover the case where the user cancels via ability button or hotkey. This PR adds the reset in selectAbility(-1) to cover all cancellation paths.

Testing

  • ✅ Build succeeds
  • ✅ All existing tests pass (84 tests)
  • Fix addresses both button clicks and hotkey triggers

Generated with Claude Code
via Happy

…#2775)

## Problem
When Dark Priest is active, double-clicking the Godlet Printer button or
pressing the R hotkey during location picking caused the ability to get
stuck, freezing the game until manually deselected.

## Root Cause
When `materializeInProgress` flag was set to prevent re-entrancy, it was
only cleared in `fnOnCancel` and `fnOnConfirm` callbacks. However, if the
user cancelled the ability via:
- Clicking the ability button again
- Pressing the R hotkey
- Pressing Esc

The `selectAbility(-1)` was called, which calls `queryMove()` to clean up
the temp creature, but the `materializeInProgress` flag was never reset.
This caused subsequent materialize attempts to be silently ignored.

## Solution
1. Added `materializeInProgress` flag in UI class to prevent re-entrancy
2. Guard at the start of `materialize()` to return early if already in progress
3. **Key fix**: Reset `materializeInProgress` in `selectAbility(-1)` to handle
   cancellation via ability button/hotkey
4. Proper cleanup of temporary creature on both cancel and confirm paths

## Testing
- Verified build succeeds
- All existing tests pass (84 tests)
- Fix addresses both button clicks and hotkey triggers

Fixes FreezingMoon#2775

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@vercel
Copy link

vercel bot commented Feb 20, 2026

@CyrilBird is attempting to deploy a commit to the FreezingMoon Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ancientbeast Ready Ready Preview Feb 21, 2026 10:32am

@DreadKnight
Copy link
Member

@CyrilBird Issue still not fixed. This time big materialize button under cards works fine after bumping into the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Godlet Printer selected but inactive [bounty: 44 XTR]

2 participants