Skip to content

Conversation

@AlealarcViva
Copy link
Contributor

@AlealarcViva AlealarcViva commented Aug 26, 2025

Previously, the player could still move during the introductory
dialogue at the beginning of the first Sokoban puzzle. This happened
because input was handled in _process() instead of _unhandled_input(),
contrary to Dialogue Manager’s documentation. In the main game, the
Player was already migrated to _unhandled_input 9cbeae3,
so Sokoban should behave consistently.

This change updates the Sokoban Player script to handle input
through _unhandled_input() and blocks player control while dialogue
is active. Once the dialogue finishes, control is restored normally.

Success criteria:

  • The player cannot move while the dialogue is active.
  • Player control is enabled only after the dialogue ends.
  • Input handling in Sokoban is now consistent with the rest of the game.
  • No regressions occur in normal Sokoban gameplay after dialogue.

Fixes #493

@AlealarcViva AlealarcViva requested a review from a team as a code owner August 26, 2025 19:13
@AlealarcViva AlealarcViva changed the title issue 493. Correccion de bug en Sokoban issue 493.Fix Sokoban Player movement during dialogue Aug 26, 2025
@AlealarcViva AlealarcViva changed the title issue 493.Fix Sokoban Player movement during dialogue Fix Sokoban Player movement during dialogue Aug 26, 2025
@github-actions
Copy link

github-actions bot commented Aug 27, 2025

Test build no longer available.

Copy link
Collaborator

@manuq manuq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the bug! Excellent!

Two things before merging:

  1. Please fix the coding styles by applying my suggestions.
  2. The pull request title is good! But please improve the pull request description. Here are our guidelines: https://github.com/endlessm/threadbare/blob/main/docs/CONTRIBUTING.md#git-commit-messages-and-pull-request-descriptions . You already have a good description of the problem and what's the solution you made in your planning sheet, so you can use it for the pull request description by translating some parts to English.

func _unhandled_input(event: InputEvent)-> void:
# Handle newly-pressed input directions
if Input.is_action_just_pressed(action_up):
if event.is_action_pressed(action_up):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, InputEvent doesn't have is_action_just_pressed() or is_action_just_released so these changes are correct.



func _process(delta: float) -> void:
func _unhandled_input(event: InputEvent)-> void:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a detail: the coding style is to have a space character between the ->:

Suggested change
func _unhandled_input(event: InputEvent)-> void:
func _unhandled_input(event: InputEvent) -> void:

You can read about the coding style in https://github.com/endlessm/threadbare/blob/main/docs/CONTRIBUTING.md#coding-style . It also tells you how to enforce it when you commit.

And also the coding style checks run automatically for each pull request. Here you can see that it fixed this and the issue below (2 blank lines before func) https://github.com/endlessm/threadbare/actions/runs/17248081317/job/49005301658?pr=1124

Previously, the player could still move during the introductory
dialogue at the beginning of the first Sokoban puzzle. This happened
because input was handled in `_process()` instead of `_unhandled_input()`,
contrary to Dialogue Manager’s documentation. In the main game, the
Player was already migrated to `_unhandled_input` (commit 58e81c9),
so Sokoban should behave consistently.

This change updates the Sokoban Player script to handle input
through `_unhandled_input()` and blocks player control while dialogue
is active. Once the dialogue finishes, control is restored normally.

Success criteria:
- The player cannot move while the dialogue is active.
- Player control is enabled only after the dialogue ends.
- Input handling in Sokoban is now consistent with the rest of the game.
- No regressions occur in normal Sokoban gameplay after dialogue.

Fixes endlessm#493
@manuq manuq changed the title Fix Sokoban Player movement during dialogue Sokoban: Fix player movement during introductory dialogue Aug 28, 2025
@manuq manuq merged commit c621d93 into endlessm:main Aug 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sokoban: Player can be moved during introductory dialogue

2 participants