Esc and the main menu leave PLACE and DEMOLISH (#139) #145
No reviewers
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder!145
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "139-esc-leaves-place-demolish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #139
What changed
GameState.cancel()is what Esc means in game. If a mode is armed, it sets the mode to NONE and does nothing else; with no mode, it toggles the main menu. One press never does both.interaction_modeto NONE, beforemain_menu_changedfires, so a menu listener never sees an armed mode.game.gdcallsGameState.cancel()onui_cancel, andMenuLayer.visiblenow followsmain_menu_changedinstead of being toggled alongside the flag.PlacementControllerdrops its selected type and rotation whenever PLACE ends. Esc and the menu end PLACE without going throughcancel_placement(), and the panel un-presses the card without emittingbuilding_type_selected(null), so the hidden ghost's state would otherwise survive and the rotate keys would keep acting on it.Verification
test/unit/test_cancel.gd: 12 tests on the mode/menu transitions. Full suite 883 passing, 1 pre-existing pending. The new script fails onmain, becausecancel()does not exist there.tools/screenshot_esc_cancel.gdloads the game scene, presses a card and sends real Escape key events throughInput. Screenshots confirm: ghost visible, then the first Esc removes the ghost with the menu still closed, then the second Esc opens the menu (clock paused).Caveats
ui_cancelfirst. Covered by the manual test, not by a unit test.cancel()clears any non-NONE mode, so it will also cover TERRAIN once that mode is used.🤖 Generated with Claude Code