Merge branch 'master' into feature/ldoc-return-fixes
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-26 17:49:21 +01:00
6 changed files with 91 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
--- @section Meter
local METER_MAX = 1000
local METER_DEFAULT = 500
local METER_DECAY_PER_FRAME = 0.02
local METER_GAIN_PER_CHORE = 100
local COMBO_BASE_BONUS = 0.02
local COMBO_MAX_BONUS = 0.16
@@ -90,9 +89,6 @@ function Meter.update()
local m = Context.meters
local in_minigame = string.find(Window.get_current_id(), "^minigame_") ~= nil
if not in_minigame then
m.ism = math.max(0, m.ism - METER_DECAY_PER_FRAME)
m.wpm = math.max(0, m.wpm - METER_DECAY_PER_FRAME)
m.bm = math.max(0, m.bm - METER_DECAY_PER_FRAME)
if m.combo > 0 then
m.combo_timer = m.combo_timer + 1
if m.combo_timer >= COMBO_TIMEOUT_FRAMES then
@@ -122,6 +118,13 @@ function Meter.add(key, amount)
end
end
--- Gets the timer decay as a percentage of the max meter value.
--- @within Meter
--- @return number The decay percentage per revolution (e.g. 2 means -2%).
function Meter.get_timer_decay_percentage()
return math.floor(meter_timer_decay_per_revolution / METER_MAX * 100)
end
--- Called on minigame completion.
--- @within Meter
function Meter.on_minigame_complete()