Skip to content

Add unblockable console key

Hanicef requested to merge Hanicef/SRB2:add-unblockable-console-key into next

Right now, the KeyDown hook is incredibly powerful. It allows handling any raw key at any point, and can take control of most things that SRB2 provides. However, with a power like this, there's also a risk of abuse, and one thing that this hook can do is to block all keyboard input, making the game completely unresponsive. A simple Lua script like this is enough achieve this:

addHook("KeyDown", function ()
	return true
end)

To prevent the game from completely locking up in a case like this, I propose adding a special key combination that will bring up the console which cannot be blocked: Shift + Escape. This combination, when pressed, will bring up the console even if there is a KeyDown hook that would otherwise block it. The key combination is also used in other games for similar purposes, particularly game engines that inherits from the Quake engine has this keybinding hardcoded into itself (try it in Quake, Half-Life or any of it's sequels or derivatives - it works on all of them), so it should be familiar to people who have played any of those games.

Merge request reports

Loading