tooltips only when interactive

This commit is contained in:
2024-01-28 14:08:10 +01:00
parent d07b3fc4b2
commit e4d58dbd1c
2 changed files with 10 additions and 7 deletions

View File

@@ -156,11 +156,15 @@ func update_tooltip_text():
if(current_target_object == null):
return
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 = "";
var action2_text = "";
var action1_text = get_action_target_text(current_target_object.action3_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action3") if item_in_inventory else get_tooltip_from_current_target("action1")
var action2_text = get_action_target_text(current_target_object.action4_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action4") if item_in_inventory else get_tooltip_from_current_target("action2")
if current_target_object.is_interactive and escoria.current_state == escoria.GAME_STATE.DEFAULT:
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
action1_text = get_action_target_text(current_target_object.action3_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action3") if item_in_inventory else get_tooltip_from_current_target("action1")
action2_text = get_action_target_text(current_target_object.action4_target_texts) if waiting_for_target_item else get_tooltip_from_current_target("action4") if item_in_inventory else get_tooltip_from_current_target("action2")
$tooltip1/label.text = action1_text
$tooltip1.visible = !hidden and action1_text != "";

View File

@@ -28,15 +28,14 @@ func _process(_delta: float):
if not outline is ItemOutline:
return
if isHighlighted != lastHighlightState:
if isHighlighted:
if isHighlighted and escoria.current_state == escoria.GAME_STATE.DEFAULT and get_parent().is_interactive:
outline.show()
else:
outline.hide()
lastHighlightState = isHighlighted
func _input(event):
if(event.is_action_pressed("ui_show_hints")) and escoria.inputs_manager.input_mode == escoria.inputs_manager.INPUT_ALL:
if event.is_action_pressed("ui_show_hints") and escoria.current_state == escoria.GAME_STATE.DEFAULT:
highlight(true)
elif (event.is_action_released("ui_show_hints")):
highlight(false)