I have an "_on_click" on a prop where I add an item to the inventory, hide the prop and show some system text.
I click on the prop and pick it up, the inventory opens and the item appears in it.
If I quickly click while the text is showing (i.e. < 2 seconds) the inventory will close.
When the 2 seconds has elapsed, the inventory appears and closes again.
Steps to reproduce
Create a prop with code similar to this
func _on_click() -> void:
I.Bullets.add()
R.get_prop("Bullets").hide()
await G.show_system_text("You take a speed loader with six rounds of .357-magnum, hollow point, silver-jacketed bullets.")
Run the scene. Click the prop to pick it up.
Immediately click to see the text disappear and the inventory close.
See the inventory close again ~2 seconds later.
Expected vs observed behavior
The inventory should only close once
Environment information (please complete):
Windows 10
Godot 4.4 dev3
Latest dev branch
Additional context
I have tracked down the cause - in inventory_bar.gd :
_add_item has this code:
This will close the inventory automatically 2 seconds after you pick up an item.
_input in the same file has this code
func _input(event: InputEvent) -> void:
<...>
if _is_hidden and rect.has_point(get_global_mouse_position()):
_open()
elif not _is_hidden and not rect.has_point(get_global_mouse_position()):
_close()
The last 2 lines (check that the mouse is not in the inventory panel) close the window immediately once the click to close the text box reenables input processing.
So _add_item opens the window, _input closes it, then _add_item re-closes it.
Bug description
I have an "_on_click" on a prop where I add an item to the inventory, hide the prop and show some system text.
I click on the prop and pick it up, the inventory opens and the item appears in it. If I quickly click while the text is showing (i.e. < 2 seconds) the inventory will close. When the 2 seconds has elapsed, the inventory appears and closes again.
Steps to reproduce
Expected vs observed behavior
The inventory should only close once
Environment information (please complete):
Additional context
I have tracked down the cause - in inventory_bar.gd : _add_item has this code:
This will close the inventory automatically 2 seconds after you pick up an item.
_input in the same file has this code
The last 2 lines (check that the mouse is not in the inventory panel) close the window immediately once the click to close the text box reenables input processing.
So _add_item opens the window, _input closes it, then _add_item re-closes it.