Expand description
check-keys: fails when game code or player text names a key directly
instead of going through an Action and the player’s keymap.
Controller buttons are treated like keys.
It scans the non-test Rust in the project’s source folders
(CheckKeys::rust) for key and button types (Key::, Chord::,
Button::) and macroquad key reads (KeyCode, is_key_down, …)
outside the files that make up the key pipeline, and scans string
literals there for key names shown to the player ("f select",
"press f", "[F]", "Space", "arrows", …). Text in the asset
folders (.ron strings: tips, item and skill descriptions; .dlg
dialogue) is prose, so there only an instruction to press a key
(press f, hold Shift), a Shift+ chord, WASD or [F] counts;
“Escape!” or “fires arrows” as plain words are fine.
Two lists of keys are read. KEY_WORDS holds the bare words a help bar
shows alone. After a press verb, any name the keymap knows (Key and
Button in shuyi-assets: Tab, Start, PageUp, DpadUp, …) counts
too, in both scans, so a key added to the keymap is found with no change
here.
It is a line-based scanner, not a parser: comments are ignored, and a
#[cfg(test)] item (usually mod tests { … }) is skipped by bracket
counting from the attribute to the end of the item.
Constants§
- MARKER
- The comment that allows the next item (or its own line) to name keys, for
drawing a picture of a keyboard. Only honoured in
CheckKeys::picture_files.
Functions§
- files_
under - Every file under
dir, recursively, sorted so output is stable. - relative
filerelative toroot, with/separators.- run
- Runs the scan over the project at
rootand returns every error (empty = clean). - scan_
dlg - Scans one
.dlgdialogue script: every line but#comments, with theprose_names_keyrule like.rontext. - scan_
ron - Scans one RON data file’s string literals with the
prose_names_keyrule: they are player-facing prose (tips, item and skill descriptions), where “fires arrows” or “Shift the odds” are just words. - scan_
rust - Scans one Rust file (
relis its project-relative path, for messages and the allow-lists).