Ensure that the inventory is not empty before interacting with an item
This commit is contained in:
parent
c7545e53f7
commit
056ca5cca8
|
@ -123,13 +123,19 @@ class Game:
|
|||
self.inventory_menu.go_up()
|
||||
elif key == KeyValues.DOWN:
|
||||
self.inventory_menu.go_down()
|
||||
elif key == KeyValues.USE:
|
||||
if self.inventory_menu.values:
|
||||
if key == KeyValues.USE:
|
||||
self.inventory_menu.validate().use()
|
||||
elif key == KeyValues.EQUIP:
|
||||
self.inventory_menu.validate().equip()
|
||||
elif key == KeyValues.DROP:
|
||||
self.inventory_menu.validate().use()
|
||||
|
||||
# Ensure that the cursor has a good position
|
||||
self.inventory_menu.position = min(self.inventory_menu.position,
|
||||
len(self.inventory_menu.values)
|
||||
- 1)
|
||||
|
||||
def handle_key_pressed_main_menu(self, key: KeyValues) -> None:
|
||||
"""
|
||||
In the main menu, we can navigate through options.
|
||||
|
|
Loading…
Reference in New Issue