how to implement TC's "R"

I’m currently learning how to rewrite gameplay logic in Age of Empires IV through mods, I wanna know how the official game implemented TC’s “R” hotkey for recalling villagers. Any insights would be greatly appreciated!