refact by claude
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:
Zsolt Tasnadi
2026-02-23 10:22:41 +01:00
parent 272a54ea87
commit 7deeffa8d6
20 changed files with 85 additions and 77 deletions

View File

@@ -2,7 +2,9 @@ local INPUT_KEY_UP = 0
local INPUT_KEY_DOWN = 1
local INPUT_KEY_LEFT = 2
local INPUT_KEY_RIGHT = 3
local INPUT_KEY_A = 4 local INPUT_KEY_B = 5 local INPUT_KEY_Y = 7
local INPUT_KEY_A = 4
local INPUT_KEY_B = 5
local INPUT_KEY_Y = 7
local INPUT_KEY_SPACE = 48
local INPUT_KEY_BACKSPACE = 51
local INPUT_KEY_ENTER = 50

View File

@@ -123,10 +123,13 @@ function UI.draw_decision_selector(decisions, selected_decision_index)
if #decisions > 0 then
local selected_decision = decisions[selected_decision_index]
local decision_label = selected_decision.label
local text_width = #decision_label * 4 local text_y = bar_y + 4
local text_x = (Config.screen.width - text_width) / 2
Print.text("<", 2, text_y, Config.colors.green)
Print.text(decision_label, text_x, text_y, Config.colors.item) Print.text(">", Config.screen.width - 6, text_y, Config.colors.green) end
local text_width = #decision_label * 4
local text_y = bar_y + 4
local text_x = (Config.screen.width - text_width) / 2
Print.text("<", 2, text_y, Config.colors.green)
Print.text(decision_label, text_x, text_y, Config.colors.item)
Print.text(">", Config.screen.width - 6, text_y, Config.colors.green)
end
end
--- Draws meters.

View File

@@ -1,5 +1,3 @@
--- Utility functions.
Util = {}
--- Safely wraps an index for an array.
-- @param array table The array to index.
@@ -15,16 +13,13 @@ function Util.go_to_screen_by_id(screen_id)
local screen = Screen.get_by_id(screen_id)
if screen then
Context.game.current_screen = screen_id
local all_decisions_for_screen = Decision.get_for_screen(screen)
Context.game.decisions = Decision.filter_available(all_decisions_for_screen)
Context.game.selected_decision_index = 1
screen.init() -- Initialize the new screen
screen.init()
else
PopupWindow.show({"Error: Screen '" .. screen_id .. "' not found!"})
end
end
-- Checks if a table contains a specific value.
--- Checks if a table contains a specific value.
-- @param t table The table to check.
-- @param value any The value to look for.
function Util.contains(t, value)