From 97e3fb296cdc94b805f03d5a3ff28a01bfdc0005 Mon Sep 17 00:00:00 2001 From: bryanthaboi Date: Fri, 31 Jul 2026 10:45:12 -0400 Subject: [PATCH] Update tool_mod_hooks.lua --- tests/engine/tool_mod_hooks.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/engine/tool_mod_hooks.lua b/tests/engine/tool_mod_hooks.lua index 5cb3d8a4..36f1f2a0 100644 --- a/tests/engine/tool_mod_hooks.lua +++ b/tests/engine/tool_mod_hooks.lua @@ -109,10 +109,19 @@ do end TouchControls.draw = function() order[#order + 1] = "touch" end - local fake = { overworld = {}, stack = { states = {} } } + -- Game:draw iterates stack.states and calls each state's draw (it no + -- longer goes through stack:draw), so the fixture must put a drawable + -- state on the stack to observe composition order. + local fake = { + overworld = {}, + stack = { + states = { + { draw = function() order[#order + 1] = "states" end }, + }, + }, + } function fake.stack:visibleBase() return 1 end - function fake.stack:top() return {} end - function fake.stack:draw() order[#order + 1] = "states" end + function fake.stack:top() return self.states[#self.states] end hooks:wrap("render.hud", function(nextFn, game, viewport) T.check(game == fake, "render.hud receives the live Game object")