Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: PauseSubState.quitToMenu() and quitToChartEditor() should call onSongEnd() #4199

Closed
3 tasks done
Starexify opened this issue Feb 21, 2025 · 2 comments
Closed
3 tasks done
Labels
status: pending triage Awaiting review. type: enhancement Involves an enhancement or new feature.

Comments

@Starexify
Copy link

Starexify commented Feb 21, 2025

Issue Checklist

  • I have read the Contributing Guide
  • I have checked the Issues/Discussions pages to see if my enhancement has already been suggested
  • I have properly titled my enhancement

What is your suggestion, and why should it be implemented?

My suggestion is that the ScriptEvent onSongEnd() should also be fired from PauseSubState.quitToMenu() and quitToChartEditor() because when leaving a song and trying to cleanup stuff and use onSongEnd() it doesnt seem to call the Event when exiting/ending the song through the pause menu

The methods in question:

/**
* Quit the game and return to the main menu.
* @param state The current PauseSubState.
*/
static function quitToMenu(state:PauseSubState):Void
{
state.allowInput = false;
PlayState.instance.deathCounter = 0;
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
if (PlayStatePlaylist.isStoryMode)
{
PlayStatePlaylist.reset();
state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new funkin.ui.story.StoryMenuState(sticker)));
}
else
{
state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker)));
}
}
/**
* Quit the game and return to the chart editor.
* @param state The current PauseSubState.
*/
static function quitToChartEditor(state:PauseSubState):Void
{
state.close();
if (FlxG.sound.music != null) FlxG.sound.music.pause(); // Don't reset song position!
PlayState.instance.close(); // This only works because PlayState is a substate!
}
}

@Starexify Starexify added status: pending triage Awaiting review. type: enhancement Involves an enhancement or new feature. labels Feb 21, 2025
@Starexify
Copy link
Author

Nevermind, it seems to work but for some reason if I use logic like a for loop in it doesnt seem to fully work, no matter 🤔

@cyn0x8
Copy link
Contributor

cyn0x8 commented Feb 21, 2025

#4172 would negate the need for this with onPlayStateClose and onSongEnd could just be for when the song ends normally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending triage Awaiting review. type: enhancement Involves an enhancement or new feature.
Projects
None yet
Development

No branches or pull requests

2 participants