From 3469524d8c1b839cf9f58ae46aa35bee036866ee Mon Sep 17 00:00:00 2001 From: ItsLJcool Date: Thu, 16 Oct 2025 06:23:31 -0700 Subject: [PATCH] implement onCloseSubState (#789) Seriously, why havent this been added alongside with onOpenSubstate --- source/funkin/backend/MusicBeatState.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 74d95366..4b78b6f6 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -275,6 +275,12 @@ class MusicBeatState extends FlxState implements IBeatCancellableReceiver if (!e.cancelled) super.openSubState(e.substate is FlxSubState ? cast e.substate : subState); } + + public override function closeSubState() { + var e = event("onCloseSubState", EventManager.get(CancellableEvent).recycle()); + if (!e.cancelled) + super.closeSubState(); + } public override function onResize(w:Int, h:Int) { super.onResize(w, h);