From 1fbd927bcca1646588243718f041d8c6b566165c Mon Sep 17 00:00:00 2001 From: Microkat <89645987+THEkatinamicrowave@users.noreply.github.com> Date: Thu, 20 Aug 2026 13:20:32 -0400 Subject: [PATCH 1/4] Add `excludeList` to FunkinParentDisabler something that should probably be there. Could also make ParentCancellable typedef that just encompasses FlxTween FlxCamera FlxTimer and FlxSound but I think Dynamic is fine for now --- .../backend/utils/FunkinParentDisabler.hx | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/source/funkin/backend/utils/FunkinParentDisabler.hx b/source/funkin/backend/utils/FunkinParentDisabler.hx index 870721655e..588f74c749 100644 --- a/source/funkin/backend/utils/FunkinParentDisabler.hx +++ b/source/funkin/backend/utils/FunkinParentDisabler.hx @@ -18,28 +18,31 @@ class FunkinParentDisabler extends FlxBasic { var __cameras:Array; var __timers:Array; var __sounds:Array; + var __excludeList:Array; var __replaceUponDestroy:Bool; var __restoreUponDestroy:Bool; - public function new(replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) { + + public function new(excludeList:Array = [], replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) { super(); __replaceUponDestroy = replaceUponDestroy; __restoreUponDestroy = restoreUponDestroy; + __excludeList = excludeList; @:privateAccess { // tweens - __tweens = FlxTween.globalManager._tweens.copy(); - FlxTween.globalManager._tweens = []; + __tweens = FlxTween.globalManager._tweens.copy().filter(t -> !excludeList.contains(t)); + FlxTween.globalManager._tweens = excludeList.filter(t -> t is FlxTween); // timers - __timers = FlxTimer.globalManager._timers.copy(); - FlxTimer.globalManager._timers = []; + __timers = FlxTimer.globalManager._timers.copy().filter(t -> !excludeList.contains(t)); + FlxTimer.globalManager._timers = excludeList.filter(t -> t is FlxTimer); // cameras - __cameras = [for(c in FlxG.cameras.list) if (!c.paused) c]; - for(c in __cameras) c.paused = true; + __cameras = [for (c in FlxG.cameras.list) if (!excludeList.contains(c) && !c.paused) c]; + for (c in __cameras) c.paused = true; // sounds - __sounds = [for(s in FlxG.sound.list) if (s.playing && !s.persist) s]; - for(s in __sounds) s.pause(); + __sounds = [for (s in FlxG.sound.list) if (!excludeList.contains(s) && s.playing && !s.persist) s]; + for (s in __sounds) s.pause(); } } @@ -50,25 +53,26 @@ class FunkinParentDisabler extends FlxBasic { __cameras = []; __timers = []; __sounds = []; + __excludeList = []; } public override function destroy() { super.destroy(); @:privateAccess { if (!__restoreUponDestroy) { - for(t in __tweens) { t.cancel(); t.destroy(); }; - for(t in __timers) { t.cancel(); t.destroy(); }; + for (t in __tweens) { t.cancel(); t.destroy(); }; + for (t in __timers) { t.cancel(); t.destroy(); }; return; } if (__replaceUponDestroy) { FlxTween.globalManager._tweens = __tweens; FlxTimer.globalManager._timers = __timers; } else { - for(t in __tweens) FlxTween.globalManager._tweens.push(t); - for(t in __timers) FlxTimer.globalManager._timers.push(t); + for (t in __tweens) FlxTween.globalManager._tweens.push(t); + for (t in __timers) FlxTimer.globalManager._timers.push(t); } - for(c in __cameras) c.paused = false; - for(s in __sounds) s.play(); + for (c in __cameras) c.paused = false; + for (s in __sounds) s.play(); } } } From b0ab6c4f45514aa2124fccb51e8b31ac11a51a0f Mon Sep 17 00:00:00 2001 From: Microkat <89645987+THEkatinamicrowave@users.noreply.github.com> Date: Thu, 20 Aug 2026 13:26:40 -0400 Subject: [PATCH 2/4] this broke --- source/funkin/backend/MusicBeatTransition.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/MusicBeatTransition.hx b/source/funkin/backend/MusicBeatTransition.hx index 8c70c69887..07fec392dd 100644 --- a/source/funkin/backend/MusicBeatTransition.hx +++ b/source/funkin/backend/MusicBeatTransition.hx @@ -31,7 +31,7 @@ class MusicBeatTransition extends MusicBeatSubstate { public override function create() { if (newState != null) - add(new FunkinParentDisabler(true, false)); + add(new FunkinParentDisabler([], true, false)); transitionCamera = new FlxCamera(); transitionCamera.bgColor = 0; @@ -142,4 +142,4 @@ class MusicBeatTransition extends MusicBeatSubstate { transitionScript.destroy(); super.destroy(); } -} \ No newline at end of file +} From a191cb8f1c0142cdc20b445f2d7bb6231e68b177 Mon Sep 17 00:00:00 2001 From: Microkat <89645987+THEkatinamicrowave@users.noreply.github.com> Date: Thu, 20 Aug 2026 13:57:38 -0400 Subject: [PATCH 3/4] add ParentDisableable abstract type so that the compiler doesn't have to deal with Array every time --- source/funkin/backend/utils/FunkinParentDisabler.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/utils/FunkinParentDisabler.hx b/source/funkin/backend/utils/FunkinParentDisabler.hx index 588f74c749..a03d06ab95 100644 --- a/source/funkin/backend/utils/FunkinParentDisabler.hx +++ b/source/funkin/backend/utils/FunkinParentDisabler.hx @@ -18,11 +18,11 @@ class FunkinParentDisabler extends FlxBasic { var __cameras:Array; var __timers:Array; var __sounds:Array; - var __excludeList:Array; + var __excludeList:Array; var __replaceUponDestroy:Bool; var __restoreUponDestroy:Bool; - public function new(excludeList:Array = [], replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) { + public function new(excludeList:Array = [], replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) { super(); __replaceUponDestroy = replaceUponDestroy; __restoreUponDestroy = restoreUponDestroy; @@ -76,3 +76,10 @@ class FunkinParentDisabler extends FlxBasic { } } } + +abstract ParentDisableable(Any) { + @:from static inline function tween(t:FlxTween):Disableable return cast t; + @:from static inline function timer(t:FlxTimer):Disableable return cast t; + @:from static inline function camera(c:FlxCamera):Disableable return cast c; + @:from static inline function sound(s:FlxSound):Disableable return cast s; +} From 595cd3c4775e87f6ceb17f6282a92685044c38ef Mon Sep 17 00:00:00 2001 From: Microkat <89645987+THEkatinamicrowave@users.noreply.github.com> Date: Thu, 20 Aug 2026 17:20:07 -0400 Subject: [PATCH 4/4] add PauseGameEvent since it should exist anyway and also allows for excludeLists on an event basis --- .../scripting/events/gameplay/PauseGameEvent.hx | 16 ++++++++++++++++ source/funkin/game/PlayState.hx | 6 +++--- source/funkin/menus/PauseSubState.hx | 8 ++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 source/funkin/backend/scripting/events/gameplay/PauseGameEvent.hx diff --git a/source/funkin/backend/scripting/events/gameplay/PauseGameEvent.hx b/source/funkin/backend/scripting/events/gameplay/PauseGameEvent.hx new file mode 100644 index 0000000000..268825e473 --- /dev/null +++ b/source/funkin/backend/scripting/events/gameplay/PauseGameEvent.hx @@ -0,0 +1,16 @@ +package funkin.backend.scripting.events.gameplay; + +import funkin.backend.utils.FunkinParentDisabler.ParentDisableable; + +final class PauseGameEvent extends CancellableEvent { + /** + * List of ParentDisableable instances that FunkinParentDisabler will exclude from + * its disabling list on instanciation. Instances in the list will startDelay enabled. + */ + public var excludeList:Array; + + /** + * Whether the pause will be allowed to trigger the Gitaroo pause menu easter egg. + */ + public var allowGitaroo:Bool; +} \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 1b937ca6c8..97ebd84554 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1302,7 +1302,7 @@ class PlayState extends MusicBeatState * Pauses the game. */ public function pauseGame() { - var e = gameAndCharsEvent("onGamePause", new CancellableEvent()); + var e = gameAndCharsEvent("onGamePause", new PauseGameEvent([], allowGitaroo)); if (e.cancelled) return; persistentUpdate = false; @@ -1310,13 +1310,13 @@ class PlayState extends MusicBeatState paused = true; // 1 / 1000 chance for Gitaroo Man easter egg - if (!chartingMode && allowGitaroo && FlxG.random.bool(Flags.GITAROO_CHANCE)) + if (!chartingMode && e.allowGitaroo && FlxG.random.bool(Flags.GITAROO_CHANCE)) { // gitaroo man easter egg FlxG.switchState(new GitarooPause()); } else { - openSubState(new PauseSubState()); + openSubState(new PauseSubState(e.excludeList)); } updateDiscordPresence(); diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index 5fba37a0be..d8f8b2ad65 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -11,6 +11,7 @@ import funkin.backend.scripting.events.menu.MenuChangeEvent; import funkin.backend.scripting.events.menu.pause.*; import funkin.backend.system.Conductor; import funkin.backend.utils.FunkinParentDisabler; +import funkin.backend.utils.FunkinParentDisabler.ParentDisableable; import funkin.editors.charter.Charter; import funkin.menus.StoryMenuState; import funkin.options.OptionsMenu; @@ -27,6 +28,7 @@ class PauseSubState extends MusicBeatSubstate var deathCounter:FunkinText; var multiplayerText:FunkinText; + var parentDisablerExcludeList:Array; var menuItems:Array; var curSelected:Int = 0; @@ -40,8 +42,10 @@ class PauseSubState extends MusicBeatSubstate private var __cancelDefault:Bool = false; - public function new(?items:Array, ?selectCall:NameEvent->Void) { + public function new(?excludeList:Array, ?items:Array, ?selectCall:NameEvent->Void) { super(); + + parentDisablerExcludeList = excludeList != null ? excludeList : []; menuItems = items != null ? items : Flags.DEFAULT_PAUSE_ITEMS.copy(); this.selectCall = selectCall; } @@ -54,7 +58,7 @@ class PauseSubState extends MusicBeatSubstate if (menuItems.contains("Exit to charter") && !PlayState.chartingMode) menuItems.remove("Exit to charter"); - add(parentDisabler = new FunkinParentDisabler()); + add(parentDisabler = new FunkinParentDisabler(parentDisablerExcludeList)); pauseScript = Script.create(Paths.script(script)); pauseScript.setParent(this);