Skip to content

overlays: don't steal keys while renaming a building - #1624

Open
Alistair-Afton wants to merge 2 commits into
DFHack:masterfrom
Alistair-Afton:fix-overlay-rename-input
Open

Alistair-Afton wants to merge 2 commits into
DFHack:masterfrom
Alistair-Afton:fix-overlay-rename-input

Conversation

@Alistair-Afton

Copy link
Copy Markdown

Summary

Fixes DFHack/dfhack#5764

The machine-toggle pressure plate / gear assembly overlays and the trackstop track stop / roller overlays consumed their hotkeys (x, shift+x, shift+r, shift+v, shift+t, shift+b) even while the building nickname field was open, so typing those characters changed settings instead of entering text.

Each overlay's onInput now skips event handling while view_sheets.building_entering_nickname is set, matching the guard already used by the orders skill restriction overlay.

Testing

In a live fort, instantiated PlateOverlay and fed it a CUSTOM_X keypress with a stubbed super:

  • building_entering_nickname = true: key not consumed by the overlay (falls through to the rename field).
  • building_entering_nickname = false: normal handling resumes.

The pressure plate, gear assembly, track stop, and roller overlays
consumed their hotkeys even while the building nickname field was
open, so typing characters like x, r, or v changed settings instead
of entering text. Skip input handling while
view_sheets.building_entering_nickname is set, matching the guard
already used by the orders skill restriction overlay.

Fixes DFHack/dfhack#5764
@Bumber64

Copy link
Copy Markdown
Member

I'd probably do something like local vs = df.global.game.main_interface.view_sheets, with how long that is.

Then it's easy enough to do if not vs.building_entering_nickname then instead of isRenaming().

Suggested by Bumber64: bind df.global.game.main_interface.view_sheets
once and check building_entering_nickname directly instead of a
wrapper function.
@Alistair-Afton

Alistair-Afton commented Sep 16, 2026

Copy link
Copy Markdown
Author

Done. local vs = df.global.game.main_interface.view_sheets at file scope (it's an inline compound in a static global, so the binding stays live) and if not vs.building_entering_nickname then in all four overlays. Re-verified live that the guard blocks input while renaming and passes through normally.

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.

Bug: trackstop.pressureplate overlay steals input from building renaming

2 participants