FIX - allow movement outside phone text fields (#14)

This commit is contained in:
Leon.Schmidt
2026-08-20 15:47:39 +02:00
committed by GitHub
parent daa67cfb1e
commit 5b5e9fe914
8 changed files with 135 additions and 28 deletions
+16 -14
View File
@@ -29,11 +29,11 @@ local function resolve(overrides)
call_focus = false,
camera_active = false,
camera_nui_focused = true,
cursor_disabled = false,
is_open = false,
notification_focus = false,
payphone_focus = false,
sim_picker_open = false,
text_input_focused = false,
}
for key, value in pairs(overrides or {}) do
state[key] = value
@@ -71,22 +71,23 @@ assert(
and movable_phone.focused
and movable_phone.keep_input
and movable_phone.game_input
and movable_phone.block_game,
"an open phone with the cursor active must block GTA hotkeys while keeping NUI input"
and not movable_phone.block_game
and movable_phone.block_look,
"an open phone must allow movement without hiding the NUI cursor"
)
local cursor_disabled_phone = resolve({
local typing_phone = resolve({
allow_movement = true,
cursor_disabled = true,
is_open = true,
text_input_focused = true,
})
assert(
not cursor_disabled_phone.cursor
and cursor_disabled_phone.focused
and cursor_disabled_phone.keep_input
and cursor_disabled_phone.game_input
and not cursor_disabled_phone.block_game,
"toggling Alt must release the NUI cursor while preserving phone and GTA input"
typing_phone.cursor
and typing_phone.focused
and typing_phone.keep_input
and typing_phone.game_input
and typing_phone.block_game,
"a focused phone text input must block GTA controls without hiding the NUI cursor"
)
SkyPhoneFocus.ApplyFocusedControls()
@@ -98,9 +99,10 @@ assert(firing_disabled, "focused phone cursor must block attacks while typing")
all_controls_disabled = {}
firing_disabled = false
SkyPhoneFocus.ApplyGameInputControls(true)
for _, control in ipairs({ 19, 24, 140, 141, 142, 257, 263, 264 }) do
for _, control in ipairs({ 24, 140, 141, 142, 257, 263, 264 }) do
assert(disabled_controls[control], ("phone control %d must remain disabled"):format(control))
end
assert(not disabled_controls[19], "Alt must remain available while no phone text input is focused")
for _, control in ipairs({ 1, 2, 3, 4, 5, 6 }) do
assert(disabled_controls[control], ("look control %d must be disabled while the phone cursor is active"):format(control))
end
@@ -111,8 +113,8 @@ assert(firing_disabled, "player attacks must remain disabled while the phone is
disabled_controls = {}
firing_disabled = false
SkyPhoneFocus.ApplyGameInputControls(false)
assert(not disabled_controls[1] and not disabled_controls[2], "Alt cursor toggle must restore camera look")
assert(firing_disabled, "player attacks must remain disabled after the cursor is toggled off")
assert(not disabled_controls[1] and not disabled_controls[2], "camera passthrough must preserve camera look")
assert(firing_disabled, "player attacks must remain disabled during camera passthrough")
local movable_notification = resolve({ allow_movement = true, notification_focus = true })
assert(