Reset mouse cursor on click. Cancel using item if background clicked.

This commit is contained in:
2023-03-08 00:14:29 +01:00
parent 0380acc353
commit 8795986053

View File

@@ -200,6 +200,11 @@ func _process_input(event: InputEvent, is_default_state: bool) -> bool:
## BACKGROUND ##
func click_on_bg(position: Vector2) -> void:
# If we are using an inventory item reset mouse cursor and cancel action
if escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM:
Input.set_custom_mouse_cursor(null)
escoria.action_manager.action_state = ESCActionManager.ACTION_INPUT_STATE.AWAITING_VERB_OR_ITEM
if escoria.main.current_scene.player:
escoria.action_manager.do(
escoria.action_manager.ACTION.BACKGROUND_CLICK,
@@ -236,6 +241,9 @@ func element_unfocused() -> void:
## ITEMS ##
func click_on_item(item_global_id: String, event: InputEvent, action: String) -> void:
# If we are using an inventory item reset mouse cursor
if escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM:
Input.set_custom_mouse_cursor(null)
# If we are awaiting input action use inventory actions (change action1 for action3 and action2 for action4)
if escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM:
@@ -412,8 +420,6 @@ func _on_event_done(return_code: int, _event_name: String):
# Show tooltips, they were hiddeen while performing action
$tooltip_layer/tooltip.show()
#$tooltip_layer/tooltip2.show()
# Reset mouse cursor to (perhaps we were using an inventory item)
Input.set_custom_mouse_cursor(null)
func _on_MenuButton_pressed() -> void: