Skip to content

Commit 2b6da15

Browse files
committed
eeeeeeeeeeeeeeeeeeeeee
1 parent 0bbbdb4 commit 2b6da15

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

source/psychlua/FunkinLua.hx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,17 @@ class FunkinLua {
225225
set('mania', PlayState.mania);
226226
set('trueMania', Note.ammo[PlayState.mania]);
227227

228-
// function addProtectedCallback(lua:State, name:String, func:Dynamic) {
229-
230-
// }
228+
function addProtectedCallback(lua:State, name:String, func:Dynamic) {
229+
Lua_helper.add_callback(lua, name, function(...args:Array<Dynamic>) {
230+
try {
231+
func.apply(this, args);
232+
}
233+
catch (e:Dynamic) {
234+
luaTrace('Error in Lua callback "' + name + '": ' + e, false, false, FlxColor.RED);
235+
}
236+
});
237+
}
238+
}
231239

232240
//Fun cursor things for lua
233241
Lua_helper.add_callback(lua, "getCursorMode", function()

source/states/freeplay/OsuFreeplayState.hx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -427,31 +427,37 @@ class OsuFreeplayState extends MusicBeatState
427427
for (i in 0...FreeplayManager.songList.length)
428428
{
429429

430+
var week:WeekData = WeekData.weeksLoaded.get(WeekData.weeksList[FreeplayManager.songList[i].week]);
431+
432+
var difficulties:Array<String> = Difficulty.loadFromWeek(week);
433+
434+
for (j in 0...difficulties.length)
435+
{
436+
437+
430438
var songBox:SongBox = new SongBox(320, 100);
431439
songBox.loadGraphic(Paths.image('OSUState/bars/background2'));
432440
songBox.setGraphicSize(650, 100);
433441
songBox.setColorTransform(-1, -1, -1, 1, FreeplayManager.songList[i].color[0][0], FreeplayManager.songList[i].color[0][1], FreeplayManager.songList[i].color[0][2], 1);
434-
songBox.ID = i;
442+
songBox.ID = i + j;
435443
this.songBox.add(songBox);
436444

437445
var icon:HealthIcon = new HealthIcon(FreeplayManager.songList[i].songCharacter, false);
438446
icon.setPosition(320, 100);
439-
icon.ID = i;
447+
icon.ID = i + j;
440448
icon.setGraphicSize(Std.int(icon.width / 1.7), Std.int(icon.height / 1.7));
441449
this.iconGrp.add(icon);
442450

443451
try {metadata = FreeplayManager.metadata.get(FreeplayManager.songList[i].songName.toLowerCase());}
444452
catch(e) {metadata = null;}
445453

446454
var text:FlxText = new FlxText(0, 0, 500, '', 20);
447-
if (metadata != null)
448-
text.text = FreeplayManager.songList[i].songName + '\nBy ${metadata.song.artist}';
449-
else
450-
text.text = FreeplayManager.songList[i].songName + '\nBy Unknown';
455+
text.text = FreeplayManager.songList[i].songName + '\n' + difficulties[j];
451456
text.alignment = 'left';
452-
text.ID = i;
457+
text.ID = i + j;
453458
this.textGrp.add(text);
454459
}
460+
}
455461

456462
maxSelected = songBox.length;
457463

0 commit comments

Comments
 (0)