Merge branch 'master' into feature/ldoc-return-fixes
This commit is contained in:
@@ -8,7 +8,7 @@ Context = {}
|
||||
|
||||
--- Gets initial data for Context.
|
||||
--- @within Context
|
||||
--- @return result table Initial context data. </br>
|
||||
--- @return result table Initial context data or nil. </br>
|
||||
--- Fields: </br>
|
||||
--- * current_menu_item (number) Index of the currently selected menu item.<br/>
|
||||
--- * splash_timer (number) Remaining frames for the splash screen timer.<br/>
|
||||
@@ -18,7 +18,8 @@ Context = {}
|
||||
--- * minigame_button_mash (table) Button mash minigame state (see Minigame.get_default_button_mash).<br/>
|
||||
--- * minigame_rhythm (table) Rhythm minigame state (see Minigame.get_default_rhythm).<br/>
|
||||
--- * meters (table) Meter values (see Meter.get_initial).<br/>
|
||||
--- * game (table) Current game progress state. Contains: `current_screen` (string) active screen ID, `current_situation` (string|nil) active situation ID.
|
||||
--- * stat_screen_active (boolean) Whether the stat screen overlay is currently shown.<br/>
|
||||
--- * game (table) Current game progress state. Contains: `current_screen` (string) active screen ID, `current_situation` (string|nil) active situation ID.<br/>
|
||||
function Context.initial_data()
|
||||
return {
|
||||
current_menu_item = 1,
|
||||
@@ -28,6 +29,7 @@ function Context.initial_data()
|
||||
content = {}
|
||||
},
|
||||
game_in_progress = false,
|
||||
stat_screen_active = false,
|
||||
minigame_ddr = Minigame.get_default_ddr(),
|
||||
minigame_button_mash = Minigame.get_default_button_mash(),
|
||||
minigame_rhythm = Minigame.get_default_rhythm(),
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user