Skip to content

Conversation

@Starexify
Copy link

Description

This PR allows modification of the exiting state in OptionsState and StoryMenuState.
Allowing mods to modify the behavior when exiting them instead of being hardcoded to MainMenuState and having to use workarounds that might not always work properly and feel choppy because it goes into the MainMenu for a bit before switching the state again.

Example Script

import funkin.modding.module.ScriptedModule;
import funkin.modding.events.ScriptEvent;
import funkin.ui.options.OptionsState;
import flixel.FlxG;
import funkin.ui.title.TitleState;
import funkin.ui.story.StoryMenuState;

class Testing extends ScriptedModule {
  override public function onStateCreate(event:ScriptEvent) {
    // Set the StoryMenuState exit state to TitleState
    if (!(FlxG.state is StoryMenuState)) return;
    var storymenu:StoryMenuState = FlxG.state;
    storymenu.exitState = () -> new TitleState();

    // Set the OptionsState exit state to TitleState
    if (!(FlxG.state is OptionsState)) return;
    OptionsState.instance.exitState = () -> new TitleState();
  }
}

@github-actions github-actions bot added size: medium A medium pull request with 100 or fewer changes. pr: haxe PR modifies game code. status: pending triage Awaiting review. and removed size: medium A medium pull request with 100 or fewer changes. labels Oct 10, 2025
@Hundrec Hundrec added type: enhancement Involves an enhancement or new feature. size: medium A medium pull request with 100 or fewer changes. topic: mods Related to the creation or use of mods. labels Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. status: pending triage Awaiting review. topic: mods Related to the creation or use of mods. type: enhancement Involves an enhancement or new feature.

Development

Successfully merging this pull request may close these issues.

2 participants