From cdf7b094abf059cbb344b7a02733c9638655b6ec Mon Sep 17 00:00:00 2001 From: Dustinspace217 Date: Wed, 18 Nov 2026 02:41:20 -0800 Subject: [PATCH] Stop scripted button presses repeating in Lua additive button mode In LUA_ADDITIVE_BUTTON_CONTROL mode, game_process_keys merged the script's buttons into the player's and then copied the merged result back into the script's buffer, so any press (the player's or the script's) stayed set and fired again every frame. Clear the script's buffer after the merge instead, so a scripted press acts once like a key press. Scripts set buttons from hooks that run after game_process_keys, so their presses are still merged on the next call before the clear. Fixes #4108 --- code/io/keycontrol.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/io/keycontrol.cpp b/code/io/keycontrol.cpp index cac6e88aa89..fc5a56a3951 100644 --- a/code/io/keycontrol.cpp +++ b/code/io/keycontrol.cpp @@ -1781,7 +1781,8 @@ void game_process_keys() int i; for (i=0; ibi.status[i] |= Player->lua_bi.status[i]; - Player->lua_bi = Player->bi; + // clear after merging so a scripted press acts once, like a key press, instead of repeating every frame + button_info_clear(&Player->lua_bi); } else { // just copy over the values Player->lua_bi = Player->bi;