cleaning up cubescript hooks
- provide a function to easily assemble and execute the command - context-selective execution of hooks - restrict potentially exploitable or harmful hooks to singleplayer-modes
This commit is contained in:
+2
-10
@@ -612,16 +612,8 @@ void keypress(int code, bool isdown, int cooked, SDLMod mod)
|
||||
{
|
||||
if(haskey) execbind(*haskey, isdown);
|
||||
}
|
||||
if(isdown && identexists("KEYPRESS")) // TODO: Remove this if its misued. e.x: /KEYPRESS = [ echo You pressed key code: $arg1 ] // Output: You pressed key code: 32 (if you press the spacebar)
|
||||
{
|
||||
defformatstring(kpi)("KEYPRESS %d", code);
|
||||
execute(kpi);
|
||||
}
|
||||
if (!isdown && identexists("KEYRELEASE"))
|
||||
{
|
||||
defformatstring(kpo)("KEYRELEASE %d", code);
|
||||
execute(kpo);
|
||||
}
|
||||
if(isdown) exechook(HOOK_SP, "KEYPRESS", "KEYPRESS %d", code);
|
||||
else exechook(HOOK_SP, "KEYRELEASE", "%d", code);
|
||||
}
|
||||
|
||||
char *getcurcommand()
|
||||
|
||||
Reference in New Issue
Block a user