Skip to content

Commit

Permalink
fix wrong level property names
Browse files Browse the repository at this point in the history
  • Loading branch information
Bauumm committed Oct 27, 2024
1 parent 345fc72 commit f9bb15f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions compat/game20/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public.start = async(function(pack_id, level_id, level_options)
game.pack = async.await(assets.get_pack(pack_id))
level.set(game.pack.levels[level_id])
level_status.reset()
style.set(game.pack.styles[level.styleId])
style.set(game.pack.styles[level.style_id])
music.stop()
local pitch = config.get("sync_music_to_dm") and math.pow(game.difficulty_mult, 0.12) or 1
music.play(game.pack.music[level.musicId], not public.first_play, nil, pitch)
music.play(game.pack.music[level.music_id], not public.first_play, nil, pitch)
if not args.headless then
go_sound:play()
end
Expand Down
18 changes: 9 additions & 9 deletions compat/game20/level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ local defaults = {
name = "nullName",
description = "",
author = "",
menuPriority = 0,
menu_priority = 0,
selectable = true,
musicId = "nullMusicId",
styleId = "nullStyleId",
luaFile = "nullLuaPath",
difficultyMults = {},
music_id = "nullMusicId",
style_id = "nullStyleId",
lua_file = "nullLuaPath",
difficulty_multipliers = {},
}

function level.set(level_json)
for key, value in pairs(defaults) do
level[key] = level_json[key] or value
end
local has1 = false
for i = 1, #level.difficultyMults do
if level.difficultyMults[i] == 1 then
for i = 1, #level.difficulty_multipliers do
if level.difficulty_multipliers[i] == 1 then
has1 = true
break
end
end
if not has1 then
level.difficultyMults[#level.difficultyMults + 1] = 1
level.difficulty_multipliers[#level.difficulty_multipliers + 1] = 1
end
table.sort(level.difficultyMults)
table.sort(level.difficulty_multipliers)
end

return level
8 changes: 4 additions & 4 deletions compat/game21/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ public.start = async(function(pack_id, level_id, level_options)
error("Error: level with id '" .. level_id .. "' not found")
end
level_status.reset(config.get("sync_music_to_dm"))
local style_data = game.pack_data.styles[game.level_data.styleId]
local style_data = game.pack_data.styles[game.level_data.style_id]
if style_data == nil then
log("Warn: style with id '" .. game.level_data.styleId .. "' not found")
log("Warn: style with id '" .. game.level_data.style_id .. "' not found")
-- still continue with default style values
end
style.select(style_data or {})
style.compute_colors()
game.difficulty_mult = difficulty_mult
status.reset_all_data()
music.stop()
local new_music = game.pack_data.music[game.level_data.musicId]
local new_music = game.pack_data.music[game.level_data.music_id]
if new_music == nil then
error("Music with id '" .. game.level_data.musicId .. "' doesn't exist!")
error("Music with id '" .. game.level_data.music_id .. "' doesn't exist!")
end
music.play(new_music, not public.first_play, nil, public.refresh_music_pitch())
status.beat_pulse_delay = status.beat_pulse_delay + (music.segment.beat_pulse_delay_offset or 0)
Expand Down

0 comments on commit f9bb15f

Please sign in to comment.