Skip to content

Commit 6e598bb

Browse files
committed
fix: disable input during pause after finishing
Due to the way input was handled, changing the simulation size during the one-second pause after it finishes would update the level scores but not the preview. Keyboard input has been completely disabled as a reasonable mitigation.
1 parent e5e385d commit 6e598bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/levels.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ func _on_Button_focus_entered(size=_level.array.size):
6767
"font_color", GlobalTheme.GREEN)
6868
# Pause a bit to show completely sorted array
6969
if _level.array.is_sorted():
70+
# Prevent race condition caused by keyboard input during pause
71+
set_process_input(false)
7072
$Timer.stop()
7173
yield(get_tree().create_timer(1), "timeout")
7274
$Timer.start()
73-
# Prevent race condition caused by switching levels during pause
74-
if not _level.array.is_sorted():
75-
return
75+
set_process_input(true)
7676
_level = _get_level(get_focus_owner().text).new(ArrayModel.new(size))
7777
_level.active = false
7878
$Preview/InfoBorder/Info/About.text = _cleanup(_level.ABOUT)

0 commit comments

Comments
 (0)