Show action3 and action4 if waiting for target item
This commit is contained in:
@@ -144,11 +144,11 @@ func update_tooltip_text():
|
||||
if(current_target_object == null):
|
||||
return
|
||||
|
||||
var itemInInventory = escoria.inventory_manager.inventory_has(current_target_object.global_id)
|
||||
var item_in_inventory = escoria.inventory_manager.inventory_has(current_target_object.global_id)
|
||||
var waiting_for_target_item = escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM
|
||||
|
||||
var action1_text = current_target_object.action1_text if !itemInInventory else current_target_object.action3_text
|
||||
var action2_text = current_target_object.action2_text if !itemInInventory else current_target_object.action4_text
|
||||
|
||||
var action1_text = current_target_object.action3_text if item_in_inventory or waiting_for_target_item else current_target_object.action1_text
|
||||
var action2_text = current_target_object.action4_text if item_in_inventory or waiting_for_target_item else current_target_object.action2_text
|
||||
|
||||
$tooltip1/label.text = action1_text
|
||||
$tooltip1.visible = action1_text != "";
|
||||
|
||||
@@ -241,24 +241,20 @@ 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 we are using an inventory item reset mouse cursor and use inventory actions (change action1 for action3 and action2 for action4)
|
||||
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:
|
||||
action = ACTION3 if action == ACTION1 else ACTION4
|
||||
|
||||
escoria.action_manager.set_current_action(action)
|
||||
var target_obj = escoria.object_manager.get_object(item_global_id).node
|
||||
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
true
|
||||
)
|
||||
|
||||
if (action == ACTION1 && target_obj.action1_text != "") || (action == ACTION2 && target_obj is ESCItemWithTooltip && target_obj.action2_text != ""):
|
||||
|
||||
# Hide tooltip if some action is being performed
|
||||
if escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.COMPLETED:
|
||||
$tooltip_layer/tooltip.hide()
|
||||
|
||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
@@ -415,11 +411,9 @@ func correctPosition(tooltip: ESCRichTooltip, size: Vector2, mouse_position: Vec
|
||||
|
||||
func _on_event_done(return_code: int, _event_name: String):
|
||||
escoria.logger.info(self, "EVENT DONE! code=" + String(return_code))
|
||||
# if return_code == ESCExecution.RC_OK:
|
||||
# escoria.action_manager.clear_current_action()
|
||||
# Show tooltips, they were hiddeen while performing action
|
||||
$tooltip_layer/tooltip.show()
|
||||
#$tooltip_layer/tooltip2.show()
|
||||
|
||||
# Show tooltips, they were hidden while performing action
|
||||
$tooltip_layer/tooltip.update_tooltip_text()
|
||||
|
||||
|
||||
func _on_MenuButton_pressed() -> void:
|
||||
|
||||
Reference in New Issue
Block a user