Skip to content

Commit

Permalink
Fix using scanner keys in chest menus
Browse files Browse the repository at this point in the history
  • Loading branch information
ahicks92 committed Sep 30, 2024
1 parent 9d4c725 commit 9e838d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/scanner/entrypoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ end
---@param pindex number
---@param direction 1 | -1
function mod.move_category(pindex, direction)
if global.players[pindex].in_menu then return end
local pstate = player_state[pindex]
sound_for_end(move_category(pindex, pstate, direction))
printout({ "fa.scanner-category-" .. pstate.scanner_cursor.category }, pindex)
Expand All @@ -449,6 +450,7 @@ end
---@param pindex number
---@param direction 1 | -1
function mod.move_subcategory(pindex, direction)
if global.players[pindex].in_menu then return end
local pstate = player_state[pindex]
sound_for_end(move_subcategory(pindex, pstate, direction))
announce_cursor_pos(pindex, pstate)
Expand All @@ -457,18 +459,21 @@ end
---@param pindex number
---@param direction 1 | -1
function mod.move_within_subcategory(pindex, direction)
if global.players[pindex].in_menu then return end
local pstate = player_state[pindex]
sound_for_end(move_in_subcategory(pindex, pstate, direction))
announce_cursor_pos(pindex, pstate)
end

---@param pindex number
function mod.announce_current_item(pindex)
if global.players[pindex].in_menu then return end
local pstate = player_state[pindex]
announce_cursor_pos(pindex, pstate)
end

function mod.resort(pindex)
if global.players[pindex].in_menu then return end
local pstate = player_state[pindex]
local player = assert(game.get_player(pindex))
---@cast player LuaPlayer
Expand Down Expand Up @@ -514,4 +519,5 @@ end
function mod.on_surface_delete(index)
SurfaceScanner.on_surface_delete(index)
end

return mod

0 comments on commit 9e838d2

Please sign in to comment.