sloukit / pydew-valley-uzh

Mod of Pydew Valley for an experimental study in Psychology
Creative Commons Zero v1.0 Universal
31 stars 61 forks source link

Bug: (crash) Can't display rclick.png/lclick.png images in keybinds menu #232

Closed larsbutler closed 3 days ago

larsbutler commented 2 weeks ago

Describe the bug

Bug Description

The game crashes if you try to set a keybind to left mouse or right mouse.

Expected Behavior

Game shouldn't crash. :)

Steps to Reproduce

  1. Start game
  2. Click "Enter a Token to Play"
  3. Enter "000" for the token.
  4. Press Enter.
  5. Click Play
  6. Press Esc
  7. Click Options
  8. Click Keybinds
  9. Click on some action on the right (e.g., Move Up)
  10. Click the Left Mouse Button or Right Mouse Button

Game crashes with the above exception here.

Additional Context

Proposed fix:

Version

0.1.0

Which aspect(s) of the project is this bug affecting?

game-gameplay

Screenshots

No response

Relevant log output

$ python main.py
pygame-ce 2.5.0 (SDL 2.30.3, Python 3.12.0)
Traceback (most recent call last):
  File "/path/to/game/main.py", line 366, in <module>
    asyncio.run(game.run())
  File "/home/foo/.pyenv/versions/3.12.0/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/foo/.pyenv/versions/3.12.0/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foo/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/path/to/game/main.py", line 318, in run
    self.event_loop()
  File "/path/to/game/main.py", line 267, in event_loop
    if self.menus[self.current_state].handle_event(event):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/game/src/screens/menu_settings.py", line 58, in handle_event
    or self.current_description.handle_event(event)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/game/src/gui/menu/description.py", line 147, in handle_event
    or self.set_key(event)
       ^^^^^^^^^^^^^^^^^^^
  File "/path/to/game/src/gui/menu/description.py", line 213, in set_key
    self.update_key_value(path, value, unicode)
  File "/path/to/game/src/gui/menu/description.py", line 226, in update_key_value
    image = pygame.image.load(path)
            ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: No such file or directory: '/path/to/game/images/keys/lclick.png'.

Code of Conduct

DangerousVanilla commented 3 days ago

Fixed in PR239