All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #25
76 lines
2.4 KiB
Lua
76 lines
2.4 KiB
Lua
Screen.register({
|
|
id = "toilet",
|
|
name = "Toilet",
|
|
decisions = {
|
|
"go_to_home",
|
|
},
|
|
background = "bedroom",
|
|
init = function()
|
|
Context.stat_screen_active = true
|
|
Meter.hide()
|
|
local cx = Config.screen.width * 0.75
|
|
local cy = Config.screen.height * 0.75
|
|
Focus.start_driven(cx, cy)
|
|
Focus.set_percentage(0.15)
|
|
end,
|
|
update = function()
|
|
if not Context.stat_screen_active then return end
|
|
if Input.select() or Input.player_interact() then
|
|
Focus.stop()
|
|
Context.stat_screen_active = false
|
|
Meter.show()
|
|
end
|
|
end,
|
|
draw = function()
|
|
if not Context.stat_screen_active then return end
|
|
|
|
local sw = Config.screen.width
|
|
local cx = sw / 2
|
|
local bar_w = math.floor(sw * 0.75)
|
|
local bar_x = math.floor((sw - bar_w) / 2)
|
|
local bar_h = 4
|
|
|
|
Print.text_center("day " .. Context.day_count, cx, 10, Config.colors.white)
|
|
|
|
local narrative = "reflecting on my past and present\n...\nboth eventually flushed."
|
|
local wrapped = UI.word_wrap(narrative, 38)
|
|
local text_y = 24
|
|
for _, line in ipairs(wrapped) do
|
|
Print.text_center(line, cx, text_y, Config.colors.light_grey)
|
|
text_y = text_y + 8
|
|
end
|
|
|
|
local m = Context.meters
|
|
local max_val = Meter.get_max()
|
|
local decay_pct = Meter.get_timer_decay_percentage()
|
|
local decay_text = string.format("-%d%%", decay_pct)
|
|
local combo_mult = Meter.get_combo_multiplier()
|
|
local combo_pct = math.floor((combo_mult - 1) * 100)
|
|
local mult_text = string.format("+%d%%", combo_pct)
|
|
local meter_start_y = text_y + 10
|
|
|
|
local meter_list = {
|
|
{ key = "wpm", label = "Work Productivity Meter" },
|
|
{ key = "ism", label = "Impostor Syndrome Meter" },
|
|
{ key = "bm", label = "Burnout Meter" },
|
|
}
|
|
|
|
for i, meter in ipairs(meter_list) do
|
|
local y = meter_start_y + (i - 1) * 20
|
|
|
|
Print.text_center(meter.label, cx, y, Config.colors.white)
|
|
|
|
local bar_y = y + 8
|
|
local fill_w = math.max(0, math.floor((m[meter.key] / max_val) * bar_w))
|
|
rect(bar_x, bar_y, bar_w, bar_h, Meter.COLOR_BG)
|
|
if fill_w > 0 then
|
|
rect(bar_x, bar_y, fill_w, bar_h, Config.colors.blue)
|
|
end
|
|
|
|
local decay_w = print(decay_text, 0, -6, 0, false, 1)
|
|
Print.text(decay_text, bar_x - decay_w - 4, bar_y, Config.colors.light_blue)
|
|
Print.text(mult_text, bar_x + bar_w + 4, bar_y, Config.colors.light_blue)
|
|
end
|
|
end,
|
|
})
|