screen init, update, optional decision condition
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful

This commit is contained in:
2026-02-21 23:35:00 +01:00
parent 0b25ecc793
commit 7e1dd28808
13 changed files with 26 additions and 9 deletions

View File

@@ -18,6 +18,8 @@ function GameWindow.draw()
end
function GameWindow.update()
local previous_screen_index = Context.current_screen
if Input.menu_back() then
Context.active_window = WINDOW_MENU
MenuWindow.refresh_menu_items()
@@ -37,6 +39,19 @@ function GameWindow.update()
Context.selected_decision_index = 1 end
local screen = Context.screens[Context.current_screen]
screen.update()
if previous_screen_index ~= Context.current_screen then
screen.init()
end
if Context.current_situation then
local current_situation_obj = Situation.get(Context.current_situation)
if current_situation_obj and current_situation_obj.update then
current_situation_obj.update()
end
end
if screen and screen.decisions and #screen.decisions > 0 then
local available_decisions = {}
for _, decision_id in ipairs(screen.decisions) do