feat(mods): allow alternate battle grids to own navigation

This commit is contained in:
AverageConsumer
2026-08-10 21:22:09 +02:00
parent 7fa758602a
commit 6a990bf79f
3 changed files with 81 additions and 3 deletions
+9 -2
View File
@@ -145,6 +145,13 @@ function BattleState:statusHUDVisible()
self) ~= false
end
function BattleState:moveGridNavigation()
if self:wideLayout() then return true end
if not Runtime.wantsHook("battle.move_grid_navigation") then return false end
return Runtime.call("battle.move_grid_navigation", function() return false end,
self) == true
end
local Rulesets = {
gen1_faithful = require("src.battle.rulesets.gen1_faithful"),
modern_clean = require("src.battle.rulesets.modern_clean"),
@@ -1994,7 +2001,7 @@ function BattleState:update(dt)
-- The widescreen layout lays the four slots out as a 2x2 grid, so all
-- four directions navigate it; nil means no direction was pressed and
-- A / B / SELECT below behave the same in either layout.
local grid = self:wideLayout()
local grid = self:moveGridNavigation()
and WideBattle.navigate(self.moveIndex, #moves, input)
if grid then
self.moveIndex = grid
@@ -2044,7 +2051,7 @@ function BattleState:update(dt)
local moves = self.mimicMoves
-- the copy menu shares the widescreen move grid, so it navigates the
-- same way there (the classic layout keeps the vertical list)
local grid = self:wideLayout()
local grid = self:moveGridNavigation()
and WideBattle.navigate(self.mimicIndex, #moves, input)
if grid then
self.mimicIndex = grid