debug: add logging to inventory overlay and backpack for click debugging

This commit is contained in:
2026-04-26 22:26:22 -07:00
parent 3393db5020
commit 4fa09e6769
3 changed files with 11 additions and 2 deletions

View File

@@ -224,12 +224,13 @@ func _on_inventory_changed() -> void:
_update_floating_item() _update_floating_item()
func _gui_input(event: InputEvent) -> void: func _gui_input(event: InputEvent) -> void:
print("[BACKPACK] _gui_input: %s, state=%s" % [event, State.keys()[_state]])
if event is InputEventMouseButton and event.pressed and event.button_index == 1: if event is InputEventMouseButton and event.pressed and event.button_index == 1:
print("OBTAINED")
if _state == State.IDLE: if _state == State.IDLE:
print("[BACKPACK] transitioning to OPEN")
transition_to(State.OPEN) transition_to(State.OPEN)
elif _state == State.OPEN: elif _state == State.OPEN:
print("[BACKPACK] transitioning to IDLE")
transition_to(State.IDLE) transition_to(State.IDLE)
func _notification(what: int) -> void: func _notification(what: int) -> void:

View File

@@ -33,6 +33,10 @@ func _ready() -> void:
InventoryManager.combination_attempted.connect(_on_combination_attempted) InventoryManager.combination_attempted.connect(_on_combination_attempted)
func show_overlay() -> void: func show_overlay() -> void:
print("[OVERLAY] show_overlay called, inventory has %d items" % InventoryManager.inventory.size())
func hide_overlay() -> void:
print("[OVERLAY] hide_overlay called")
_refresh_grid() _refresh_grid()
if _fade_tween: if _fade_tween:
_fade_tween.kill() _fade_tween.kill()
@@ -95,6 +99,7 @@ func _refresh_grid() -> void:
grid.columns = SLOTS_PER_ROW grid.columns = SLOTS_PER_ROW
func _on_slot_clicked(item_id: String) -> void: func _on_slot_clicked(item_id: String) -> void:
print("[OVERLAY] _on_slot_clicked: '%s', input_active=%s" % [item_id, input_active])
if not input_active: if not input_active:
return return
@@ -179,6 +184,7 @@ func _update_hover_label() -> void:
hover_label.text = "" hover_label.text = ""
func _on_background_gui_input(event: InputEvent) -> void: func _on_background_gui_input(event: InputEvent) -> void:
print("[OVERLAY] background clicked")
if event is InputEventMouseButton and event.button_index == 1 and event.pressed: if event is InputEventMouseButton and event.button_index == 1 and event.pressed:
hide_overlay() hide_overlay()
close_requested.emit() close_requested.emit()

View File

@@ -35,8 +35,10 @@ func set_hover(hovered: bool) -> void:
item_box.color = Color(0.8, 0.8, 0.8, 1) item_box.color = Color(0.8, 0.8, 0.8, 1)
func _gui_input(event: InputEvent) -> void: func _gui_input(event: InputEvent) -> void:
print("[SLOT:%s] _gui_input: %s" % [item_id, event])
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.button_index == 1 and event.pressed: if event.button_index == 1 and event.pressed:
print("[SLOT:%s] emitting clicked" % item_id)
clicked.emit(item_id) clicked.emit(item_id)
elif event.button_index == 2: elif event.button_index == 2:
right_clicked.emit(item_id) right_clicked.emit(item_id)