Incorrect game unpause
Bug🐞
**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`:
```gdscript
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:
```gdscript
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.
关闭于 2024-12-08 1 条评论