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

Incorrect game unpause #203

Closed
aromancev opened this issue Sep 21, 2024 · 1 comment
Closed

Incorrect game unpause #203

aromancev opened this issue Sep 21, 2024 · 1 comment
Assignees
Labels
Bug🐞 Something isn't working

Comments

@aromancev
Copy link

aromancev commented Sep 21, 2024

Describe the bug
Game unpauses if it was paused before the console was opened.

To Reproduce
Steps to reproduce the behavior:

  1. Pause the game via code on startup.
  2. Open the console.
  3. Observe that the game was unpaused.

Expected behavior
Game pause state should never change when pause_if_input is false.

Desktop (please complete the following information):

  • OS: Windows

Additional context
More specifically, this code in res://addons/panku_console/modules/interactive_shell/module.gd:

if _is_gui_open and pause_if_input:
    _was_tree_paused = core.get_tree().paused
    core.get_tree().paused = true
else:
    if core.get_tree().paused:
        core.get_tree().paused = _was_tree_paused

Never sets the correct value for _was_tree_paused because pause_if_input is always false. It should probably be something like this instead:

if pause_if_input:
	if _is_gui_open:
		_was_tree_paused = core.get_tree().paused
		core.get_tree().paused = true
	else:
		if core.get_tree().paused:
			core.get_tree().paused = _was_tree_paused

Sorry, I don't have time to create a PR or check for unintended side effects of that change at the moment.

@worron worron added the Bug🐞 Something isn't working label Sep 21, 2024
@worron worron self-assigned this Sep 21, 2024
@worron
Copy link
Collaborator

worron commented Sep 21, 2024

Thanks for report, you solution seems good, no side effects I can see.

@worron worron closed this as completed in d3b241d Dec 8, 2024
worron added a commit that referenced this issue Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants