[PUBLIC PR] Press Chart Editor key in Freeplay to open that song (#1061)
Co-authored-by: Lasercar <B_l_u_t_a_c_k@hotmail.com.au>
This commit is contained in:
@@ -45,7 +45,8 @@ import funkin.util.HapticUtil;
|
||||
import funkin.util.MathUtil;
|
||||
import funkin.util.SortUtil;
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.filters.ShaderFilter;
|
||||
import funkin.data.freeplay.style.FreeplayStyleRegistry;
|
||||
import funkin.ui.debug.charting.ChartEditorState;
|
||||
#if FEATURE_DISCORD_RPC
|
||||
import funkin.api.discord.DiscordClient;
|
||||
#end
|
||||
@@ -1844,6 +1845,45 @@ class FreeplayState extends MusicBeatSubState
|
||||
freeplayTxtBg.x = FullScreenScaleMode.gameNotchSize.x;
|
||||
_pressedOnFreeplay = false;
|
||||
}
|
||||
if (controls.DEBUG_CHART && !busy)
|
||||
{
|
||||
busy = true;
|
||||
var targetSongID = grpCapsules.members[curSelected]?.freeplayData?.data.id ?? 'unknown';
|
||||
if (targetSongID == 'unknown')
|
||||
{
|
||||
trace('CHART RANDOM SONG');
|
||||
letterSort.inputEnabled = false;
|
||||
|
||||
var availableSongCapsules:Array<SongMenuItem> = grpCapsules.members.filter(function(cap:SongMenuItem) {
|
||||
// Dead capsules are ones which were removed from the list when changing filters.
|
||||
return cap.alive && cap.freeplayData != null;
|
||||
});
|
||||
|
||||
trace('Available songs: ${availableSongCapsules.map(function(cap) {
|
||||
return cap?.freeplayData?.data.songName;
|
||||
})}');
|
||||
|
||||
if (availableSongCapsules.length == 0)
|
||||
{
|
||||
trace('No songs available!');
|
||||
busy = false;
|
||||
letterSort.inputEnabled = true;
|
||||
FunkinSound.playOnce(Paths.sound('cancelMenu'));
|
||||
return;
|
||||
}
|
||||
|
||||
var targetSong:SongMenuItem = FlxG.random.getObject(availableSongCapsules);
|
||||
|
||||
// Seeing if I can do an animation...
|
||||
curSelected = grpCapsules.members.indexOf(targetSong);
|
||||
changeSelection(0);
|
||||
targetSongID = grpCapsules.members[curSelected]?.freeplayData?.data.id ?? 'unknown';
|
||||
}
|
||||
FlxG.switchState(() -> new ChartEditorState(
|
||||
{
|
||||
targetSongId: targetSongID,
|
||||
}));
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -2498,7 +2538,7 @@ class FreeplayState extends MusicBeatSubState
|
||||
#end
|
||||
}
|
||||
|
||||
if (grpCapsules.countLiving() > 0 && !prepForNewRank)
|
||||
if (grpCapsules.countLiving() > 0 && !prepForNewRank && !busy)
|
||||
{
|
||||
playCurSongPreview(daSongCapsule);
|
||||
grpCapsules.members[curSelected].selected = true;
|
||||
|
||||
Reference in New Issue
Block a user