This is a fictional code snippet, as I don't have access to the original game's source code. However, it should give you an idea of how this feature could be implemented: